[][src]Struct asuran::repository::backend::multifile::MultiFile

pub struct MultiFile {
    index_handle: Index,
    manifest_handle: Manifest,
    segment_handle: SegmentHandler,
    path: PathBuf,
    uuid: Uuid,
    read_lock_path: Arc<Path>,


index_handle: Indexmanifest_handle: Manifestsegment_handle: SegmentHandlerpath: PathBufuuid: Uuid

Connection uuid, used for read locks.

read_lock_path: Arc<Path>

Path to readlock for this connection, must be deleted on close


impl MultiFile[src]

pub async fn open_defaults<'_>(
    path: impl AsRef<Path>,
    chunk_settings: Option<ChunkSettings>,
    key: &'_ Key,
    queue_depth: usize
) -> Result<MultiFile>

Opens a new MultiFile backend with default settings

Subject to change in the near future


Will error if creating or locking any of the index or manifest files fails (such as if the user does not have permissions for that directory), or if any other I/O error occurs

pub fn read_key(path: impl AsRef<Path>) -> Result<EncryptedKey>[src]

Reads the encrypted key off the disk

Does not require that the repository be opened first

Note: this path is the repository root path, not the key path


Will error if the key is corrupted or deserialization otherwise fails

Trait Implementations

impl Backend for MultiFile[src]

type Manifest = Manifest

type Index = Index

fn get_index(&self) -> Self::Index[src]

Clones the internal MFManifest

fn get_manifest(&self) -> Self::Manifest[src]

Clones the internal MFIndex

fn write_key<'life0, 'life1, 'async_trait>(
    &'life0 self,
    key: &'life1 EncryptedKey
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 

Locks the keyfile and writes the key

Will return Err if writing the key fails

fn read_key<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<EncryptedKey>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Attempts to read the key from the repository

Returns Err if the key doesn't exist or of another error occurs

fn read_chunk<'life0, 'async_trait>(
    &'life0 mut self,
    location: SegmentDescriptor
) -> Pin<Box<dyn Future<Output = Result<Chunk>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Starts reading a chunk, and returns a oneshot recieve with the result of that process

fn write_chunk<'life0, 'async_trait>(
    &'life0 mut self,
    chunk: Chunk
) -> Pin<Box<dyn Future<Output = Result<SegmentDescriptor>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Starts writing a chunk, and returns a oneshot reciever with the result of that process

fn close<'life0, 'async_trait>(
    &'life0 mut self
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

Closes out the index, segment handler, and manifest cleanly, making sure all operations are completed and all drop impls from inside the tasks are called

impl Clone for MultiFile[src]

impl Debug for MultiFile[src]

Auto Trait Implementations

impl !RefUnwindSafe for MultiFile

impl Send for MultiFile

impl Sync for MultiFile

impl Unpin for MultiFile

impl !UnwindSafe for MultiFile

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> BackendClone for T where
    T: Backend + Clone + ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> WithSubscriber for T[src]