yr.kv_get_with_param

yr.kv_get_with_param#

yr.kv_get_with_param(keys: List[str], get_params: GetParams, timeout: int = 300) List[bytes | memoryview][source]#

Provides the kv_get_with_param interface, which supports offset reading of data.

Parameters:
  • keys (List[str]) – A list of keys specifying the data to be retrieved.

  • get_params (GetParams) – A set of attributes configured for retrieving the value, including parameters such as offset and size.

  • timeout (int) – The timeout in seconds. Defaults to 300. A value of -1 indicates permanent blocking wait. The parameter must be greater than or equal to -1.

Returns:

Returns one or a list of retrieved data items. Data type is Union[bytes, List[bytes]].

Raises:
  • ValueError – If the get_params list of GetParam type is an empty list.

  • ValueError – If the number of items in the get_params list does not match the number of items in the keys list.

  • RuntimeError – If kv_get_with_param() is called without initialization, an exception will be thrown.

  • RuntimeError – If data retrieval from the data system fails.

Example

>>> get_param = yr.GetParam()
>>> get_param.offset = 0
>>> get_param.size = 0
>>> params = yr.GetParams()
>>> params.get_params = [get_param]
>>> v1 = yr.kv_get_with_param(["kv-key"], params, 10)