nat.object_store.interfaces#
Classes#
Abstract interface for an object store. |
Module Contents#
- class ObjectStore#
Bases:
abc.ABC
Abstract interface for an object store.
Implementations may integrate with various object stores, such as S3, MySQL, etc.
- abstractmethod put_object(
- key: str,
- item: nat.object_store.models.ObjectStoreItem,
- Async:
Save an ObjectStoreItem in the object store with the given key. If the key already exists, raise an error.
- Args:
key (str): The key to save the item under. item (ObjectStoreItem): The item to save.
- Raises:
KeyAlreadyExistsError: If the key already exists.
- abstractmethod upsert_object(
- key: str,
- item: nat.object_store.models.ObjectStoreItem,
- Async:
Save an ObjectStoreItem in the object store with the given key. If the key already exists, update the item.
- Args:
key (str): The key to save the item under. item (ObjectStoreItem): The item to save.
- abstractmethod get_object(key: str) nat.object_store.models.ObjectStoreItem #
- Async:
Get an ObjectStoreItem from the object store by key.
- Args:
key (str): The key to get the item from.
- Returns:
ObjectStoreItem: The item retrieved from the object store.
- Raises:
NoSuchKeyError: If the item does not exist.