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

Method size

acouchbase/datastructures.py:528–553  ·  view source on GitHub ↗

Get the number of items in the map. :param key: The document ID of the map :return int: The number of items in the map .. seealso:: :meth:`map_add`

(self)

Source from the content-addressed store, hash-verified

526 raise InvalidArgumentException(message=f'Key: {mapkey} is not in the map.') from None
527
528 async def size(self) -> int:
529 """
530 Get the number of items in the map.
531
532 :param key: The document ID of the map
533 :return int: The number of items in the map
534
535 .. seealso:: :meth:`map_add`
536 """
537 op_type = DatastructureOperationType.MapSize
538 async with ObservableRequestHandler(op_type, self._impl.observability_instruments) as ds_obs_handler:
539 ds_obs_handler.create_kv_span(self._impl._request_builder._collection_dtls.get_details_as_dict())
540 kv_op_type = KeyValueOperationType.LookupIn
541 async with ObservableRequestHandler(kv_op_type, self._impl.observability_instruments) as obs_handler:
542 op = count('')
543 req, transcoder = self._impl.request_builder.build_lookup_in_request(self._key,
544 (op,),
545 obs_handler,
546 parent_span=ds_obs_handler.wrapped_span) # noqa: E501
547 sd_res: LookupInResult = await self._execute_op(self._impl.lookup_in,
548 req,
549 obs_handler,
550 ds_obs_handler.wrapped_span,
551 create_type=True,
552 transcoder=transcoder)
553 return sd_res.value[0].get('value', None)
554
555 async def exists(self, key: str) -> bool:
556 """

Callers 12

test_listMethod · 0.45
test_mapMethod · 0.45
test_setsMethod · 0.45
test_queueMethod · 0.45
test_kv_ds_listMethod · 0.45
test_kv_ds_mapMethod · 0.45
test_kv_ds_queueMethod · 0.45
test_kv_ds_setMethod · 0.45
test_kv_ds_listMethod · 0.45
test_kv_ds_mapMethod · 0.45
test_kv_ds_queueMethod · 0.45
test_kv_ds_setMethod · 0.45

Calls 7

_execute_opMethod · 0.95
countFunction · 0.90
get_details_as_dictMethod · 0.80
create_kv_spanMethod · 0.45
getMethod · 0.45

Tested by 12

test_listMethod · 0.36
test_mapMethod · 0.36
test_setsMethod · 0.36
test_queueMethod · 0.36
test_kv_ds_listMethod · 0.36
test_kv_ds_mapMethod · 0.36
test_kv_ds_queueMethod · 0.36
test_kv_ds_setMethod · 0.36
test_kv_ds_listMethod · 0.36
test_kv_ds_mapMethod · 0.36
test_kv_ds_queueMethod · 0.36
test_kv_ds_setMethod · 0.36