Skip to main content

SectionStorage

Trait SectionStorage 

Source
pub trait SectionStorage: Send + Sync {
    // Required methods
    fn initialize<E: Encode>(
        &mut self,
        header: &E,
    ) -> Result<usize, EncodeError>;
    fn post_update_header<E: Encode>(
        &mut self,
        header: &E,
    ) -> Result<usize, EncodeError>;
    fn append<E: Encode>(&mut self, entry: &E) -> Result<usize, EncodeError>;
    fn flush(&mut self) -> CuResult<usize>;
}
Expand description

A Storage is an append-only structure that can update a header section.

Required Methods§

Source

fn initialize<E: Encode>(&mut self, header: &E) -> Result<usize, EncodeError>

This rewinds the storage, serialize the header and jumps to the beginning of the user data storage.

Source

fn post_update_header<E: Encode>( &mut self, header: &E, ) -> Result<usize, EncodeError>

This updates the header leaving the position to the end of the user data storage.

Source

fn append<E: Encode>(&mut self, entry: &E) -> Result<usize, EncodeError>

Appends the entry to the user data storage.

Source

fn flush(&mut self) -> CuResult<usize>

Flushes the section to the underlying storage

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§