pip_services3_components.state.IStateStore module

class pip_services3_components.state.IStateStore.IStateStore

Bases: abc.ABC

Interface for state storages that are used to store and retrieve transaction states.

abstract delete(correlation_id: Optional[str], key: str) → Any

Deletes a state from the store by its key.

Parameters
  • correlation_id – (optional) transaction id to trace execution through call chain.

  • key – a unique value key.

Returns

deleted item

abstract load(correlation_id: Optional[str], key: str) → Any

Loads state from the store using its key. If value is missing in the store it returns None.

Parameters
  • correlation_id – (optional) transaction id to trace execution through call chain.

  • key – a unique state key.

Returns

the state value or None if value wasn’t found.

abstract load_bulk(correlation_id: Optional[str], keys: List[str]) → List[pip_services3_components.state.StateValue.StateValue]

Loads an array of states from the store using their keys.

Parameters
  • correlation_id – (optional) transaction id to trace execution through call chain.

  • keys – unique state keys.

Returns

an array with state values and their corresponding keys.

abstract save(correlation_id: Optional[str], key: str, value: Any) → Any

Saves state into the store.

Parameters
  • correlation_id – (optional) transaction id to trace execution through call chain.

  • key – a unique state key.

  • value – a state value.

Returns

The state that was stored in the store.