Skip to content

memory

Classes:

  • MemoryStorage

    A storage backend for testing that saves data to local files.

Attributes:

  • memory_storage

    Default instance of MemoryStorage for testing purposes.

memory_storage module-attribute

memory_storage = MemoryStorage()

Default instance of MemoryStorage for testing purposes.

MemoryStorage

MemoryStorage(chunk_size: int = 5 * 1024 ** 2)

Bases: Storage[str]

A storage backend for testing that saves data to local files.

Methods:

deserialize_config

deserialize_config(config: str) -> C

Deserialize the configuration from a JSON string.

read_data async

read_data(key: str) -> bytes

Load data from the given location.

read_data_stream async

read_data_stream(location: str) -> AsyncGenerator[bytes]

Load a stream of data from the given location.

serialize_config

serialize_config(config: C) -> str

Serialize the configuration to a JSON string.

write_data async

write_data(
    data: bytes, digest: Digest, _tags: TagMap
) -> str

Save the given data.

write_data_stream async

write_data_stream(
    data_stream: AsyncIterable[bytes],
    get_digest: GetStreamDigest,
    _tags: TagMap,
) -> str

Save the given data stream.