pub trait BlobStore: Debug + Send + Sync + 'static {
    type Error: From<NoError> + From<Error> + Debug;

    fn read(&self, id: &[u8]) -> Result<Blob<'static>, Self::Error>;
    fn write(&self, data: &[u8]) -> Result<Vec<u8>, Self::Error>;
    fn sync(&self) -> Result<(), Self::Error>;

    fn needs_deep_detach(&self) -> bool { ... }
}
Expand description

A generic blob store with variable id size

Required Associated Types

The error. Use NoError for a store that can never fail

Required Methods

Read a blob with the given id. Since ids can be of arbitrary size, passed as a slice

Write a blob, returning an id into a target vec tgt.

If this returns an error, the tgt vec is guaranteed to be unmodified.

Ensure all data is persisted

Provided Methods

True if the store needs deep detach. This is true for basically all stores except the special NoStore store

Implementors

The implementation of NoStore will panic whenever it is used