Trait microkelvin::Store
source ·
[−]pub trait Store {
type Identifier;
fn get(&self, ident: &Self::Identifier) -> &[u8]ⓘ;
fn request_buffer(&self) -> TokenBuffer;
fn persist(&self) -> Result<(), ()>;
fn commit(&self, buffer: &mut TokenBuffer) -> Self::Identifier;
fn extend(&self, buffer: &mut TokenBuffer) -> Result<(), ()>;
fn return_token(&self, token: Token);
}
Expand description
A type that works as a handle to a Storage
backend.
Associated Types
type Identifier
type Identifier
The identifier used for refering to stored values
Required methods
Gets a reference to an archived value
fn request_buffer(&self) -> TokenBuffer
fn request_buffer(&self) -> TokenBuffer
Request a buffer to write data
Persist to underlying storage.
To keep the trait simple, the error type is omitted, and will have to be returned by other means, for example in logging.
fn commit(&self, buffer: &mut TokenBuffer) -> Self::Identifier
fn commit(&self, buffer: &mut TokenBuffer) -> Self::Identifier
Commit written bytes to the
Request additional bytes for writing
fn return_token(&self, token: Token)
fn return_token(&self, token: Token)
Return the token to the store