[−][src]Trait dodo::Storage
Bytes storage backend.
Each entry is identified by a unique id. Storage implementations may choose to lock entries while they are read or written to.
Associated Types
type Read: Read
Reader.
type Write: Write
Writer.
type Iterator: Iterator<Item = Result<Uuid>>
Iterator.
Required methods
fn new(&mut self) -> Result<(Uuid, Self::Write)>
Create a new entry in this storage, returning his id and a writer.
Returned id is guaranteed to be unique (inside this specific instance of storage, that is).
fn read(&self, entry: Uuid) -> Result<Self::Read>
Provide a reader to an entry, if it exists.
fn write(&mut self, entry: Uuid) -> Result<Self::Write>
Provide a writer to an entry. If it exists, this writer overrides (and truncates) the bytes. If it doesn't exists, a new entry is created.
fn overwrite(&mut self, entry: Uuid) -> Result<Self::Write>
Provide a writer to an entry, only if it exists. This writer override (and truncates) the bytes.
fn delete(&mut self, entry: Uuid) -> Result<()>
Delete an entry.
This does not fail if the entry doesn't exists.
fn clear(&mut self) -> Result<()>
Empties this storage.
Everything in this storage will be deleted. Use at your own risks.
fn iter(&self) -> Result<Self::Iterator>
Provide an iterator listing the entries currently in this storage.
The returned iterator is lazy and doesn't lock anything, meaning returned entries might not even exist when consumed.