class documentation

MongoDB implementation of the execution store repository.

Method __init__ Initialize the execution store repository.
Method cleanup Delete all stores in the global store collection.
Method clear_cache Clear all keys with either a ttl or policy="eviction".
Method count_keys Count the number of keys in a store.
Method count_stores Count the number of stores in the store collection.
Method count_stores_global Count the number of stores in the global store collection.
Method create_store Create a store in the store collection.
Method delete_key Delete a key from a store.
Method delete_store Delete a store.
Method delete_store_global Delete a store from the global store collection.
Method get_key Get a key from a store.
Method get_store Get a store from the store collection.
Method has_key Check if a key exists in a store.
Method has_store Check if a store exists in the store collection.
Method has_store_global Check if a store exists in the global store collection.
Method list_keys List all keys in a store.
Method list_stores List all stores in the store collection.
Method list_stores_global List all stores in the global store collection.
Method set_cache_key Set a cache key in a store.
Method set_key Set a key in a store.
Method update_ttl Update the TTL of a key.
Constant COLLECTION_NAME Undocumented
Method _create_indexes Undocumented
Instance Variable _collection Undocumented

Inherited from ExecutionStoreRepo:

Instance Variable _dataset_id Undocumented
def __init__(self, collection, dataset_id: ObjectId | None = None, is_cache=False): (source)

Initialize the execution store repository.

Parameters
collectionUndocumented
dataset_id:Optional[ObjectId]the dataset ID to operate on
is_cache:Falsewhether the store is a cache store
def cleanup(self) -> int: (source)

Delete all stores in the global store collection.

Returns
intthe number of documents deleted
def clear_cache(self, store_name=None) -> int: (source)

Clear all keys with either a ttl or policy="eviction".

Parameters
store_name:str, optionalthe name of the store to clear. If None, all stores will be queried for deletion.
Returns
intUndocumented
def count_keys(self, store_name: str) -> int: (source)

Count the number of keys in a store.

Parameters
store_name:strthe name of the store to count keys for
Returns
intthe number of keys in the store
def count_stores(self) -> int: (source)

Count the number of stores in the store collection.

Returns
intthe number of stores
def count_stores_global(self) -> int: (source)

Count the number of stores in the global store collection.

Returns
intthe number of stores
def create_store(self, store_name: str, metadata: dict[str, Any] | None = None, policy: str = 'persist') -> StoreDocument: (source)

Create a store in the store collection.

Parameters
store_name:strthe name of the store to create
metadata:Optional[Dict[str, Any]]the metadata to store with the store
policy:strUndocumented
Returns
StoreDocumentthe created store document
def delete_key(self, store_name: str, key: str) -> bool: (source)

Delete a key from a store.

Parameters
store_name:strthe name of the store to delete the key from
key:strthe key to delete
Returns
boolTrue if the key was deleted, False otherwise
def delete_store(self, store_name: str) -> int: (source)

Delete a store.

Parameters
store_name:strthe name of the store to delete
Returns
intthe number of documents deleted
def delete_store_global(self, store_name: str) -> int: (source)

Delete a store from the global store collection.

Parameters
store_name:strthe name of the store to delete
Returns
intthe number of documents deleted
def get_key(self, store_name: str, key: str) -> KeyDocument | None: (source)

Get a key from a store.

Parameters
store_name:strthe name of the store to get the key from
key:strthe key to get
Returns
Optional[KeyDocument]the key document, or None if the key does not exist
def get_store(self, store_name: str) -> StoreDocument | None: (source)

Get a store from the store collection.

Parameters
store_name:strthe name of the store to get
Returns
Optional[StoreDocument]the store document, or None if the store does not exist
def has_key(self, store_name: str, key: str) -> bool: (source)

Check if a key exists in a store.

Parameters
store_name:strthe name of the store to check
key:strthe key to check
Returns
boolTrue if the key exists, False otherwise
def has_store(self, store_name: str) -> bool: (source)

Check if a store exists in the store collection.

Parameters
store_name:strthe name of the store to check
Returns
boolTrue if the store exists, False otherwise
def has_store_global(self, store_name: str) -> bool: (source)

Check if a store exists in the global store collection.

Parameters
store_name:strthe name of the store to check
Returns
boolTrue if the store exists, False otherwise
def list_keys(self, store_name: str) -> list[str]: (source)

List all keys in a store.

Parameters
store_name:strthe name of the store to list keys for
Returns
List[str]a list of keys in the store
def list_stores(self) -> list[str]: (source)

List all stores in the store collection.

Returns
List[str]a list of store names
def list_stores_global(self) -> list[StoreDocument]: (source)

List all stores in the global store collection.

Returns
List[StoreDocument]a list of store documents
def set_cache_key(self, store_name, key, value, ttl=None): (source)

Set a cache key in a store.

Parameters
store_name:strthe name of the store to set the cache key in
key:strthe cache key to set
value:Anythe value to set
ttl:Optional[int]the TTL of the cache key
Returns
KeyDocumentthe created or updated cache key document
def set_key(self, store_name: str, key: str, value: Any, ttl: int | None = None, policy: str = 'persist') -> KeyDocument: (source)

Set a key in a store.

Parameters
store_name:strThe name of the store to set the key in.
key:strThe key to set.
value:AnyThe value to associate with the key.
ttl:Optional[int]Optional TTL (in seconds) after which the key will expire and be automatically removed.
policy:strThe eviction policy for the key. One of: - "persist" (default): Key is persistent until deleted. - "evict": Key is eligible for eviction or cache clearing.
Returns
KeyDocumentThe created or updated key document.
def update_ttl(self, store_name: str, key: str, ttl: int) -> bool: (source)

Update the TTL of a key.

Parameters
store_name:strthe name of the store to update the TTL for
key:strthe key to update the TTL for
ttl:intthe new TTL
Returns
boolTrue if the TTL was updated, False otherwise
COLLECTION_NAME: str = (source)

Undocumented

Value
'execution_store'
def _create_indexes(self): (source)

Undocumented

_collection = (source)

Undocumented