[][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<PathBuf>,
}

Fields

index_handle: Indexmanifest_handle: Manifestsegment_handle: SegmentHandlerpath: PathBufuuid: Uuid

Connection uuid, used for read locks.

read_lock_path: Arc<PathBuf>

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

Methods

impl MultiFile[src]

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

Opens a new MultiFile backend with default settings

Subject to change in the near future

Errors

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

Errors

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, 
[src]

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, 
[src]

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, 
[src]

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, 
[src]

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, 
[src]

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
[src]

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

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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]