class documentation

class StorageDriver(ABC): (source)

View In Hierarchy

Base driver for storing and retrieve payloads from external storage systems.

Warning

This API is experimental.

Method name Returns the name of this driver instance. A driver may allow its name to be parameterized at construction time so that multiple instances of the same driver class can coexist in ExternalStorage.drivers...
Async Method retrieve Retrieves payloads from external storage for the given StorageDriverClaim list. The returned list must be the same length as claims.
Async Method store Stores payloads in external storage and returns a StorageDriverClaim for each one. The returned list must be the same length as payloads.
Method type Returns the type of the storage driver. This string should be the same across all instantiations of the same driver class. This allows the equivalent driver implementation in different languages to be named the same.
@abstractmethod
def name(self) -> str: (source)

Returns the name of this driver instance. A driver may allow its name to be parameterized at construction time so that multiple instances of the same driver class can coexist in ExternalStorage.drivers with distinct names.

@abstractmethod
async def retrieve(self, context: StorageDriverRetrieveContext, claims: Sequence[StorageDriverClaim]) -> list[Payload]: (source)

Retrieves payloads from external storage for the given StorageDriverClaim list. The returned list must be the same length as claims.

@abstractmethod
async def store(self, context: StorageDriverStoreContext, payloads: Sequence[Payload]) -> list[StorageDriverClaim]: (source)

Stores payloads in external storage and returns a StorageDriverClaim for each one. The returned list must be the same length as payloads.

def type(self) -> str: (source)

Returns the type of the storage driver. This string should be the same across all instantiations of the same driver class. This allows the equivalent driver implementation in different languages to be named the same.

Defaults to the class name. Subclasses may override this to return a stable, language-agnostic identifier.