fiftyone.factory.repos.execution_store#
Execution store repository interface and implementations.
Classes:
Abstract base class for execution store repositories. |
|
|
Base class for execution store repositories. |
|
MongoDB implementation of the execution store repository. |
|
In-memory implementation of execution store repository. |
- class fiftyone.factory.repos.execution_store.AbstractExecutionStoreRepo#
Bases:
ABCAbstract base class for execution store repositories.
Methods:
create_store(store_name[, metadata, policy])Create a store in the store collection.
get_store(store_name)Get a store from the store collection.
has_store(store_name)Check if a store exists in the store collection.
List all stores in the store collection.
Count the number of stores in the store collection.
delete_store(store_name)Delete a store.
set_key(store_name, key, value[, ttl, policy])Set a key in a store.
set_cache_key(store_name, key, value[, ttl])Set a cache key in a store.
has_key(store_name, key)Check if a key exists in a store.
get_key(store_name, key)Get a key from a store.
update_ttl(store_name, key, ttl)Update the TTL of a key.
delete_key(store_name, key)Delete a key from a store.
list_keys(store_name)List all keys in a store.
count_keys(store_name)Count the number of keys in a store.
cleanup()Delete all stores in the global store collection.
clear_cache([store_name])Clear all keys with either a
ttlorpolicy="evict".has_store_global(store_name)Check if a store exists in the global store collection.
List all stores in the global store collection.
Count the number of stores in the global store collection.
delete_store_global(store_name)Delete a store from the global store collection.
- abstract create_store(store_name: str, metadata: Dict[str, Any] | None = None, policy: str = 'persist') StoreDocument#
Create a store in the store collection.
- Parameters:
store_name (str) – the name of the store to create
metadata (Optional[Dict[str, Any]]) – the metadata to store with the store
- Returns:
the created store document
- Return type:
- abstract get_store(store_name: str) StoreDocument | None#
Get a store from the store collection.
- Parameters:
store_name (str) – the name of the store to get
- Returns:
the store document, or None if the store does not exist
- Return type:
Optional[StoreDocument]
- abstract has_store(store_name: str) bool#
Check if a store exists in the store collection.
- Parameters:
store_name (str) – the name of the store to check
- Returns:
True if the store exists, False otherwise
- Return type:
bool
- abstract list_stores() List[str]#
List all stores in the store collection.
- Returns:
a list of store names
- Return type:
List[str]
- abstract count_stores() int#
Count the number of stores in the store collection.
- Returns:
the number of stores
- Return type:
int
- abstract delete_store(store_name: str) int#
Delete a store.
- Parameters:
store_name (str) – the name of the store to delete
- Returns:
the number of documents deleted
- Return type:
int
- abstract set_key(store_name: str, key: str, value: Any, ttl: int | None = None, policy: str = 'persist') KeyDocument#
Set a key in a store.
- Parameters:
store_name (str) – The name of the store to set the key in.
key (str) – The key to set.
value (Any) – The value to associate with the key.
ttl (Optional[int]) – Optional TTL (in seconds) after which the key will expire and be automatically removed.
policy (str) – The eviction policy for the key. One of: -
"persist"(default): Key is persistent until deleted. -"evict": Key is eligible for eviction or cache clearing.
- Returns:
The created or updated key document.
- Return type:
- abstract set_cache_key(store_name: str, key: str, value: Any, ttl: int | None = None) KeyDocument#
Set a cache key in a store. :param store_name: the name of the store to set the cache key in :type store_name: str :param key: the cache key to set :type key: str :param value: the value to set :type value: Any :param ttl: the TTL of the cache key :type ttl: Optional[int]
- Returns:
the created or updated cache key document
- Return type:
- abstract has_key(store_name: str, key: str) bool#
Check if a key exists in a store.
- Parameters:
store_name (str) – the name of the store to check
key (str) – the key to check
- Returns:
True if the key exists, False otherwise
- Return type:
bool
- abstract get_key(store_name: str, key: str) KeyDocument | None#
Get a key from a store.
- Parameters:
store_name (str) – the name of the store to get the key from
key (str) – the key to get
- Returns:
the key document, or None if the key does not exist
- Return type:
Optional[KeyDocument]
- abstract update_ttl(store_name: str, key: str, ttl: int) bool#
Update the TTL of a key.
- Parameters:
store_name (str) – the name of the store to update the TTL for
key (str) – the key to update the TTL for
ttl (int) – the new TTL
- Returns:
True if the TTL was updated, False otherwise
- Return type:
bool
- abstract delete_key(store_name: str, key: str) bool#
Delete a key from a store.
- Parameters:
store_name (str) – the name of the store to delete the key from
key (str) – the key to delete
- Returns:
True if the key was deleted, False otherwise
- Return type:
bool
- abstract list_keys(store_name: str) List[str]#
List all keys in a store.
- Parameters:
store_name (str) – the name of the store to list keys for
- Returns:
a list of keys in the store
- Return type:
List[str]
- abstract count_keys(store_name: str) int#
Count the number of keys in a store.
- Parameters:
store_name (str) – the name of the store to count keys for
- Returns:
the number of keys in the store
- Return type:
int
- abstract cleanup() int#
Delete all stores in the global store collection.
- Returns:
the number of documents deleted
- Return type:
int
- abstract clear_cache(store_name: str | None = None) int#
Clear all keys with either a
ttlorpolicy="evict".- Parameters:
store_name (Optional[str]) – the name of the store to clear. If None, all stores will be queried for deletion.
- Returns:
the number of documents deleted
- Return type:
int
- abstract has_store_global(store_name: str) bool#
Check if a store exists in the global store collection.
- Parameters:
store_name (str) – the name of the store to check
- Returns:
True if the store exists, False otherwise
- Return type:
bool
- abstract list_stores_global() List[StoreDocument]#
List all stores in the global store collection.
- Returns:
a list of store documents
- Return type:
- abstract count_stores_global() int#
Count the number of stores in the global store collection.
- Returns:
the number of stores
- Return type:
int
- abstract delete_store_global(store_name: str) int#
Delete a store from the global store collection.
- Parameters:
store_name (str) – the name of the store to delete
- Returns:
the number of documents deleted
- Return type:
int
- class fiftyone.factory.repos.execution_store.ExecutionStoreRepo(dataset_id: ObjectId | None = None, notification_service: ChangeStreamNotificationService | None = None)#
Bases:
AbstractExecutionStoreRepoBase class for execution store repositories.
Each instance operates in a context: - If a dataset_id is provided, it operates on stores associated with that dataset. - If no dataset_id is provided, it operates on stores not associated with any dataset.
To operate on all stores across all contexts, use the
XXX_global()methods that this class provides.Methods:
subscribe(store_name, callback)Subscribe to changes in a store.
unsubscribe(subscription_id)Unsubscribe from changes in a store.
cleanup()Delete all stores in the global store collection.
clear_cache([store_name])Clear all keys with either a
ttlorpolicy="evict".count_keys(store_name)Count the number of keys in a store.
Count the number of stores in the store collection.
Count the number of stores in the global store collection.
create_store(store_name[, metadata, policy])Create a store in the store collection.
delete_key(store_name, key)Delete a key from a store.
delete_store(store_name)Delete a store.
delete_store_global(store_name)Delete a store from the global store collection.
get_key(store_name, key)Get a key from a store.
get_store(store_name)Get a store from the store collection.
has_key(store_name, key)Check if a key exists in a store.
has_store(store_name)Check if a store exists in the store collection.
has_store_global(store_name)Check if a store exists in the global store collection.
list_keys(store_name)List all keys in a store.
List all stores in the store collection.
List all stores in the global store collection.
set_cache_key(store_name, key, value[, ttl])Set a cache key in a store.
set_key(store_name, key, value[, ttl, policy])Set a key in a store.
update_ttl(store_name, key, ttl)Update the TTL of a key.
- subscribe(store_name: str, callback: Callable[[str], None]) str#
Subscribe to changes in a store.
- Parameters:
store_name (str) – the name of the store to subscribe to
callback (Callable[[str], None]) – the callback to call when a change occurs
- Returns:
the subscription ID
- Return type:
str
- Raises:
ValueError – if no notification service is available
- unsubscribe(subscription_id: str) bool#
Unsubscribe from changes in a store.
- Parameters:
subscription_id (str) – the subscription ID to unsubscribe
- Returns:
True if the subscription was removed, False otherwise
- Return type:
bool
- Raises:
ValueError – if no notification service is available
- abstract cleanup() int#
Delete all stores in the global store collection.
- Returns:
the number of documents deleted
- Return type:
int
- abstract clear_cache(store_name: str | None = None) int#
Clear all keys with either a
ttlorpolicy="evict".- Parameters:
store_name (Optional[str]) – the name of the store to clear. If None, all stores will be queried for deletion.
- Returns:
the number of documents deleted
- Return type:
int
- abstract count_keys(store_name: str) int#
Count the number of keys in a store.
- Parameters:
store_name (str) – the name of the store to count keys for
- Returns:
the number of keys in the store
- Return type:
int
- abstract count_stores() int#
Count the number of stores in the store collection.
- Returns:
the number of stores
- Return type:
int
- abstract count_stores_global() int#
Count the number of stores in the global store collection.
- Returns:
the number of stores
- Return type:
int
- abstract create_store(store_name: str, metadata: Dict[str, Any] | None = None, policy: str = 'persist') StoreDocument#
Create a store in the store collection.
- Parameters:
store_name (str) – the name of the store to create
metadata (Optional[Dict[str, Any]]) – the metadata to store with the store
- Returns:
the created store document
- Return type:
- abstract delete_key(store_name: str, key: str) bool#
Delete a key from a store.
- Parameters:
store_name (str) – the name of the store to delete the key from
key (str) – the key to delete
- Returns:
True if the key was deleted, False otherwise
- Return type:
bool
- abstract delete_store(store_name: str) int#
Delete a store.
- Parameters:
store_name (str) – the name of the store to delete
- Returns:
the number of documents deleted
- Return type:
int
- abstract delete_store_global(store_name: str) int#
Delete a store from the global store collection.
- Parameters:
store_name (str) – the name of the store to delete
- Returns:
the number of documents deleted
- Return type:
int
- abstract get_key(store_name: str, key: str) KeyDocument | None#
Get a key from a store.
- Parameters:
store_name (str) – the name of the store to get the key from
key (str) – the key to get
- Returns:
the key document, or None if the key does not exist
- Return type:
Optional[KeyDocument]
- abstract get_store(store_name: str) StoreDocument | None#
Get a store from the store collection.
- Parameters:
store_name (str) – the name of the store to get
- Returns:
the store document, or None if the store does not exist
- Return type:
Optional[StoreDocument]
- abstract has_key(store_name: str, key: str) bool#
Check if a key exists in a store.
- Parameters:
store_name (str) – the name of the store to check
key (str) – the key to check
- Returns:
True if the key exists, False otherwise
- Return type:
bool
- abstract has_store(store_name: str) bool#
Check if a store exists in the store collection.
- Parameters:
store_name (str) – the name of the store to check
- Returns:
True if the store exists, False otherwise
- Return type:
bool
- abstract has_store_global(store_name: str) bool#
Check if a store exists in the global store collection.
- Parameters:
store_name (str) – the name of the store to check
- Returns:
True if the store exists, False otherwise
- Return type:
bool
- abstract list_keys(store_name: str) List[str]#
List all keys in a store.
- Parameters:
store_name (str) – the name of the store to list keys for
- Returns:
a list of keys in the store
- Return type:
List[str]
- abstract list_stores() List[str]#
List all stores in the store collection.
- Returns:
a list of store names
- Return type:
List[str]
- abstract list_stores_global() List[StoreDocument]#
List all stores in the global store collection.
- Returns:
a list of store documents
- Return type:
- abstract set_cache_key(store_name: str, key: str, value: Any, ttl: int | None = None) KeyDocument#
Set a cache key in a store. :param store_name: the name of the store to set the cache key in :type store_name: str :param key: the cache key to set :type key: str :param value: the value to set :type value: Any :param ttl: the TTL of the cache key :type ttl: Optional[int]
- Returns:
the created or updated cache key document
- Return type:
- abstract set_key(store_name: str, key: str, value: Any, ttl: int | None = None, policy: str = 'persist') KeyDocument#
Set a key in a store.
- Parameters:
store_name (str) – The name of the store to set the key in.
key (str) – The key to set.
value (Any) – The value to associate with the key.
ttl (Optional[int]) – Optional TTL (in seconds) after which the key will expire and be automatically removed.
policy (str) – The eviction policy for the key. One of: -
"persist"(default): Key is persistent until deleted. -"evict": Key is eligible for eviction or cache clearing.
- Returns:
The created or updated key document.
- Return type:
- abstract update_ttl(store_name: str, key: str, ttl: int) bool#
Update the TTL of a key.
- Parameters:
store_name (str) – the name of the store to update the TTL for
key (str) – the key to update the TTL for
ttl (int) – the new TTL
- Returns:
True if the TTL was updated, False otherwise
- Return type:
bool
- class fiftyone.factory.repos.execution_store.MongoExecutionStoreRepo(collection, dataset_id: ObjectId | None = None, notification_service: ChangeStreamNotificationService | None = None)#
Bases:
ExecutionStoreRepoMongoDB implementation of the execution store repository.
Attributes:
Methods:
create_store(store_name[, metadata, policy])Create a store in the store collection.
clear_cache([store_name])Clear all keys with either a
ttlorpolicy="evict".get_store(store_name)Get a store from the store collection.
has_store(store_name)Check if a store exists in the store collection.
List all stores in the store collection.
Count the number of stores in the store collection.
delete_store(store_name)Delete a store.
set_key(store_name, key, value[, ttl, policy])Set a key in a store.
set_cache_key(store_name, key, value[, ttl])Set a cache key in a store.
has_key(store_name, key)Check if a key exists in a store.
get_key(store_name, key)Get a key from a store.
update_ttl(store_name, key, ttl)Update the TTL of a key.
delete_key(store_name, key)Delete a key from a store.
list_keys(store_name)List all keys in a store.
count_keys(store_name)Count the number of keys in a store.
cleanup()Delete all stores in the global store collection.
has_store_global(store_name)Check if a store exists in the global store collection.
List all stores in the global store collection.
Count the number of stores in the global store collection.
delete_store_global(store_name)Delete a store from the global store collection.
subscribe(store_name, callback)Subscribe to changes in a store.
unsubscribe(subscription_id)Unsubscribe from changes in a store.
- COLLECTION_NAME = 'execution_store'#
- create_store(store_name: str, metadata: Dict[str, Any] | None = None, policy: str = 'persist') StoreDocument#
Create a store in the store collection.
- Parameters:
store_name (str) – the name of the store to create
metadata (Optional[Dict[str, Any]]) – the metadata to store with the store
- Returns:
the created store document
- Return type:
- clear_cache(store_name=None) int#
Clear all keys with either a
ttlorpolicy="evict".- Parameters:
store_name (Optional[str]) – the name of the store to clear. If None, all stores will be queried for deletion.
- Returns:
the number of documents deleted
- Return type:
int
- get_store(store_name: str) StoreDocument | None#
Get a store from the store collection.
- Parameters:
store_name (str) – the name of the store to get
- Returns:
the store document, or None if the store does not exist
- Return type:
Optional[StoreDocument]
- has_store(store_name: str) bool#
Check if a store exists in the store collection.
- Parameters:
store_name (str) – the name of the store to check
- Returns:
True if the store exists, False otherwise
- Return type:
bool
- list_stores() List[str]#
List all stores in the store collection.
- Returns:
a list of store names
- Return type:
List[str]
- count_stores() int#
Count the number of stores in the store collection.
- Returns:
the number of stores
- Return type:
int
- delete_store(store_name: str) int#
Delete a store.
- Parameters:
store_name (str) – the name of the store to delete
- Returns:
the number of documents deleted
- Return type:
int
- set_key(store_name: str, key: str, value: Any, ttl: int | None = None, policy: str = 'persist') KeyDocument#
Set a key in a store.
- Parameters:
store_name (str) – The name of the store to set the key in.
key (str) – The key to set.
value (Any) – The value to associate with the key.
ttl (Optional[int]) – Optional TTL (in seconds) after which the key will expire and be automatically removed.
policy (str) – The eviction policy for the key. One of: -
"persist"(default): Key is persistent until deleted. -"evict": Key is eligible for eviction or cache clearing.
- Returns:
The created or updated key document.
- Return type:
- set_cache_key(store_name, key, value, ttl=None)#
Set a cache key in a store. :param store_name: the name of the store to set the cache key in :type store_name: str :param key: the cache key to set :type key: str :param value: the value to set :type value: Any :param ttl: the TTL of the cache key :type ttl: Optional[int]
- Returns:
the created or updated cache key document
- Return type:
- has_key(store_name: str, key: str) bool#
Check if a key exists in a store.
- Parameters:
store_name (str) – the name of the store to check
key (str) – the key to check
- Returns:
True if the key exists, False otherwise
- Return type:
bool
- get_key(store_name: str, key: str) KeyDocument | None#
Get a key from a store.
- Parameters:
store_name (str) – the name of the store to get the key from
key (str) – the key to get
- Returns:
the key document, or None if the key does not exist
- Return type:
Optional[KeyDocument]
- update_ttl(store_name: str, key: str, ttl: int) bool#
Update the TTL of a key.
- Parameters:
store_name (str) – the name of the store to update the TTL for
key (str) – the key to update the TTL for
ttl (int) – the new TTL
- Returns:
True if the TTL was updated, False otherwise
- Return type:
bool
- delete_key(store_name: str, key: str) bool#
Delete a key from a store.
- Parameters:
store_name (str) – the name of the store to delete the key from
key (str) – the key to delete
- Returns:
True if the key was deleted, False otherwise
- Return type:
bool
- list_keys(store_name: str) List[str]#
List all keys in a store.
- Parameters:
store_name (str) – the name of the store to list keys for
- Returns:
a list of keys in the store
- Return type:
List[str]
- count_keys(store_name: str) int#
Count the number of keys in a store.
- Parameters:
store_name (str) – the name of the store to count keys for
- Returns:
the number of keys in the store
- Return type:
int
- cleanup() int#
Delete all stores in the global store collection.
- Returns:
the number of documents deleted
- Return type:
int
- has_store_global(store_name: str) bool#
Check if a store exists in the global store collection.
- Parameters:
store_name (str) – the name of the store to check
- Returns:
True if the store exists, False otherwise
- Return type:
bool
- list_stores_global() List[StoreDocument]#
List all stores in the global store collection.
- Returns:
a list of store documents
- Return type:
- count_stores_global() int#
Count the number of stores in the global store collection.
- Returns:
the number of stores
- Return type:
int
- delete_store_global(store_name: str) int#
Delete a store from the global store collection.
- Parameters:
store_name (str) – the name of the store to delete
- Returns:
the number of documents deleted
- Return type:
int
- subscribe(store_name: str, callback: Callable[[str], None]) str#
Subscribe to changes in a store.
- Parameters:
store_name (str) – the name of the store to subscribe to
callback (Callable[[str], None]) – the callback to call when a change occurs
- Returns:
the subscription ID
- Return type:
str
- Raises:
ValueError – if no notification service is available
- unsubscribe(subscription_id: str) bool#
Unsubscribe from changes in a store.
- Parameters:
subscription_id (str) – the subscription ID to unsubscribe
- Returns:
True if the subscription was removed, False otherwise
- Return type:
bool
- Raises:
ValueError – if no notification service is available
- class fiftyone.factory.repos.execution_store.InMemoryExecutionStoreRepo(dataset_id: ObjectId | None = None, notification_service: ChangeStreamNotificationService | None = None)#
Bases:
ExecutionStoreRepoIn-memory implementation of execution store repository.
Methods:
create_store(store_name[, metadata, policy])Create a store in the store collection.
clear_cache([store_name])Clear all keys with either a
ttlorpolicy="evict".get_store(store_name)Get a store from the store collection.
has_store(store_name)Check if a store exists in the store collection.
List all stores in the store collection.
Count the number of stores in the store collection.
delete_store(store_name)Delete a store.
set_key(store_name, key, value[, ttl, policy])Set a key in a store.
set_cache_key(store_name, key, value[, ttl])Set a cache key in a store.
has_key(store_name, key)Check if a key exists in a store.
get_key(store_name, key)Get a key from a store.
update_ttl(store_name, key, ttl)Update the TTL of a key.
update_policy(store_name, key, policy)delete_key(store_name, key)Delete a key from a store.
list_keys(store_name)List all keys in a store.
count_keys(store_name)Count the number of keys in a store.
cleanup()Delete all stores in the global store collection.
has_store_global(store_name)Check if a store exists in the global store collection.
List all stores in the global store collection.
Count the number of stores in the global store collection.
delete_store_global(store_name)Delete a store from the global store collection.
subscribe(store_name, callback)Subscribe to changes in a store.
unsubscribe(subscription_id)Unsubscribe from changes in a store.
- create_store(store_name: str, metadata: Dict[str, Any] | None = None, policy: str = 'persist') StoreDocument#
Create a store in the store collection.
- Parameters:
store_name (str) – the name of the store to create
metadata (Optional[Dict[str, Any]]) – the metadata to store with the store
- Returns:
the created store document
- Return type:
- clear_cache(store_name=None) int#
Clear all keys with either a
ttlorpolicy="evict".- Parameters:
store_name (Optional[str]) – the name of the store to clear. If None, all stores will be queried for deletion.
- Returns:
the number of documents deleted
- Return type:
int
- get_store(store_name: str) StoreDocument | None#
Get a store from the store collection.
- Parameters:
store_name (str) – the name of the store to get
- Returns:
the store document, or None if the store does not exist
- Return type:
Optional[StoreDocument]
- has_store(store_name: str) bool#
Check if a store exists in the store collection.
- Parameters:
store_name (str) – the name of the store to check
- Returns:
True if the store exists, False otherwise
- Return type:
bool
- list_stores() List[str]#
List all stores in the store collection.
- Returns:
a list of store names
- Return type:
List[str]
- count_stores() int#
Count the number of stores in the store collection.
- Returns:
the number of stores
- Return type:
int
- delete_store(store_name: str) int#
Delete a store.
- Parameters:
store_name (str) – the name of the store to delete
- Returns:
the number of documents deleted
- Return type:
int
- set_key(store_name: str, key: str, value: Any, ttl: int | None = None, policy: str = 'persist') KeyDocument#
Set a key in a store.
- Parameters:
store_name (str) – The name of the store to set the key in.
key (str) – The key to set.
value (Any) – The value to associate with the key.
ttl (Optional[int]) – Optional TTL (in seconds) after which the key will expire and be automatically removed.
policy (str) – The eviction policy for the key. One of: -
"persist"(default): Key is persistent until deleted. -"evict": Key is eligible for eviction or cache clearing.
- Returns:
The created or updated key document.
- Return type:
- set_cache_key(store_name: str, key: str, value: Any, ttl: int | None = None) None#
Set a cache key in a store. :param store_name: the name of the store to set the cache key in :type store_name: str :param key: the cache key to set :type key: str :param value: the value to set :type value: Any :param ttl: the TTL of the cache key :type ttl: Optional[int]
- Returns:
the created or updated cache key document
- Return type:
- has_key(store_name: str, key: str) bool#
Check if a key exists in a store.
- Parameters:
store_name (str) – the name of the store to check
key (str) – the key to check
- Returns:
True if the key exists, False otherwise
- Return type:
bool
- get_key(store_name: str, key: str) KeyDocument | None#
Get a key from a store.
- Parameters:
store_name (str) – the name of the store to get the key from
key (str) – the key to get
- Returns:
the key document, or None if the key does not exist
- Return type:
Optional[KeyDocument]
- update_ttl(store_name: str, key: str, ttl: int) bool#
Update the TTL of a key.
- Parameters:
store_name (str) – the name of the store to update the TTL for
key (str) – the key to update the TTL for
ttl (int) – the new TTL
- Returns:
True if the TTL was updated, False otherwise
- Return type:
bool
- update_policy(store_name: str, key: str, policy: str) bool#
- delete_key(store_name: str, key: str) bool#
Delete a key from a store.
- Parameters:
store_name (str) – the name of the store to delete the key from
key (str) – the key to delete
- Returns:
True if the key was deleted, False otherwise
- Return type:
bool
- list_keys(store_name: str) List[str]#
List all keys in a store.
- Parameters:
store_name (str) – the name of the store to list keys for
- Returns:
a list of keys in the store
- Return type:
List[str]
- count_keys(store_name: str) int#
Count the number of keys in a store.
- Parameters:
store_name (str) – the name of the store to count keys for
- Returns:
the number of keys in the store
- Return type:
int
- cleanup() int#
Delete all stores in the global store collection.
- Returns:
the number of documents deleted
- Return type:
int
- has_store_global(store_name: str) bool#
Check if a store exists in the global store collection.
- Parameters:
store_name (str) – the name of the store to check
- Returns:
True if the store exists, False otherwise
- Return type:
bool
- list_stores_global() List[StoreDocument]#
List all stores in the global store collection.
- Returns:
a list of store documents
- Return type:
- count_stores_global() int#
Count the number of stores in the global store collection.
- Returns:
the number of stores
- Return type:
int
- delete_store_global(store_name: str) int#
Delete a store from the global store collection.
- Parameters:
store_name (str) – the name of the store to delete
- Returns:
the number of documents deleted
- Return type:
int
- subscribe(store_name: str, callback: Callable[[str], None]) str#
Subscribe to changes in a store.
- Parameters:
store_name (str) – the name of the store to subscribe to
callback (Callable[[str], None]) – the callback to call when a change occurs
- Returns:
the subscription ID
- Return type:
str
- Raises:
ValueError – if no notification service is available
- unsubscribe(subscription_id: str) bool#
Unsubscribe from changes in a store.
- Parameters:
subscription_id (str) – the subscription ID to unsubscribe
- Returns:
True if the subscription was removed, False otherwise
- Return type:
bool
- Raises:
ValueError – if no notification service is available