Struct chunk_store::ChunkStore [] [src]

pub struct ChunkStore<Key, Value> { /* fields omitted */ }

ChunkStore is a store of data held as serialised files on disk, implementing a maximum disk usage to restrict storage.

The data chunks are deleted when the ChunkStore goes out of scope.

Methods

impl<Key, Value> ChunkStore<Key, Value> where
    Key: Decodable + Encodable,
    Value: Decodable + Encodable
[src]

Creates new ChunkStore with max_space allowed storage space.

The data is stored in a temporary directory that contains prefix in its name and is placed in the root directory. If root doesn't exist, it will be created.

Creates new ChunkStore with max_space allowed storage space.

The data is stored in a temporary directory that contains prefix in its name and is placed in the system temp directory.

Stores a new data chunk under key.

If there is not enough storage space available, returns Error::NotEnoughSpace. In case of

If the key already exists, it will be overwritten.

Deletes the data chunk stored under key.

If the data doesn't exist, it does nothing and returns Ok. In the case of an IO error, it returns Error::Io.

Returns a data chunk previously stored under key.

If the data file can't be accessed, it returns Error::ChunkNotFound.

Tests if a data chunk has been previously stored under key.

Lists all keys of currently-data stored.

Returns the maximum amount of storage space available for this ChunkStore.

Returns the amount of storage space already used by this ChunkStore.