MCPcopy Index your code
hub / github.com/couchbase/couchbase-python-client / push

Method push

couchbase/datastructures.py:933–954  ·  view source on GitHub ↗

Adds a new item to the back of the queue. Args: value (JSONType): The value to push onto the queue.

(self, value: JSONType)

Source from the content-addressed store, hash-verified

931 transcoder=transcoder)
932
933 def push(self, value: JSONType) -> None:
934 """Adds a new item to the back of the queue.
935
936 Args:
937 value (JSONType): The value to push onto the queue.
938
939 """
940 op_type = DatastructureOperationType.QueuePush
941 with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
942 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
943 kv_op_type = KeyValueOperationType.MutateIn
944 with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
945 op = array_prepend('', value)
946 req = self._impl.request_builder.build_mutate_in_request(self._key,
947 (op,),
948 obs_handler,
949 parent_span=ds_obs_handler.wrapped_span)
950 self._execute_op(self._impl.mutate_in,
951 req,
952 obs_handler,
953 ds_obs_handler.wrapped_span,
954 create_type=True)
955
956 def pop(self, timeout: Optional[timedelta] = None) -> Any:
957 """Removes an item from the front of the queue.

Callers 3

test_queueMethod · 0.45
test_kv_ds_queueMethod · 0.45
test_kv_ds_queueMethod · 0.45

Calls 6

_execute_opMethod · 0.95
array_prependFunction · 0.90
get_details_as_dictMethod · 0.80
create_kv_spanMethod · 0.45

Tested by 3

test_queueMethod · 0.36
test_kv_ds_queueMethod · 0.36
test_kv_ds_queueMethod · 0.36