[][src]Trait asuran::repository::backend::common::sync_backend::SyncBackend

pub trait SyncBackend: 'static + Send + Debug {
    type SyncManifest: SyncManifest + 'static;
    type SyncIndex: SyncIndex + 'static;
    fn get_index(&mut self) -> &mut Self::SyncIndex;
fn get_manifest(&mut self) -> &mut Self::SyncManifest;
fn write_key(&mut self, key: EncryptedKey) -> Result<()>;
fn read_key(&mut self) -> Result<EncryptedKey>;
fn read_chunk(&mut self, location: SegmentDescriptor) -> Result<Chunk>;
fn write_chunk(&mut self, chunk: Chunk) -> Result<SegmentDescriptor>; }

Note: In this version of the trait, the get index and get archive methods return mutable references, instead of owned values. As this version of the trait is intrinsically single threaded, implementers are expected to own a single instance of their Index and Manifest impls, and the reference will never leak outside of their container task.

Also note, that we do not have the close method, as the wrapper type will handle that for us.

Associated Types

type SyncManifest: SyncManifest + 'static

type SyncIndex: SyncIndex + 'static

Loading content...

Required methods

fn get_index(&mut self) -> &mut Self::SyncIndex

fn get_manifest(&mut self) -> &mut Self::SyncManifest

fn write_key(&mut self, key: EncryptedKey) -> Result<()>

fn read_key(&mut self) -> Result<EncryptedKey>

fn read_chunk(&mut self, location: SegmentDescriptor) -> Result<Chunk>

fn write_chunk(&mut self, chunk: Chunk) -> Result<SegmentDescriptor>

Loading content...

Implementors

impl SyncBackend for FlatFile[src]

type SyncManifest = Self

type SyncIndex = Self

impl SyncBackend for Mem[src]

type SyncManifest = Self

type SyncIndex = Self

Loading content...