[][src]Struct asuran::repository::Repository

pub struct Repository<T> {
    backend: T,
    compression: Compression,
    hmac: HMAC,
    encryption: Encryption,
    key: Key,
    pipeline: Pipeline,
    pub queue_depth: usize,
}

Provides an interface to the storage-backed key value store

File access is abstracted behind a swappable backend, all backends should use roughly the same format, but leeway is made for cases such as S3 having a flat directory structure

Fields

backend: Tcompression: Compression

Default compression for new chunks

hmac: HMAC

Default MAC algorthim for new chunks

encryption: Encryption

Default encryption algorthim for new chunks

key: Key

Encryption key for this repo

pipeline: Pipeline

Pipeline used for chunking

queue_depth: usize

Depth of queues to build

Implementations

impl<T: BackendClone + 'static> Repository<T>[src]

pub fn new(
    backend: T,
    compression: Compression,
    hmac: HMAC,
    encryption: Encryption,
    key: Key,
    pipeline_tasks: usize
) -> Repository<T>
[src]

Creates a new repository with the specificed backend and defaults

pub fn with(
    backend: T,
    settings: ChunkSettings,
    key: Key,
    pipeline_tasks: usize
) -> Repository<T>
[src]

Creates a new repository, accepting a ChunkSettings and a ThreadPool

pub async fn commit_index<'_>(&'_ self)[src]

Commits the index to storage

This should be called every time an archive or manifest is written, at the very least

pub async fn write_raw<'_>(
    &'_ mut self,
    chunk: Chunk
) -> Result<(ChunkID, bool), RepositoryError>
[src]

Writes a chunk directly to the repository

Will return (Chunk_ID, Already_Present)

Already_Present will be true if the chunk already exists in the repository.

pub async fn write_chunk<'_>(
    &'_ mut self,
    data: Vec<u8>
) -> Result<(ChunkID, bool), RepositoryError>
[src]

Writes a chunk to the repo

Uses all defaults

Will return None if writing the chunk fails. Will not write the chunk if it already exists. Bool in return value will be true if the chunk already existed in the Repository, and false otherwise

pub async fn write_chunk_with_id<'_>(
    &'_ mut self,
    data: Vec<u8>,
    id: ChunkID
) -> Result<(ChunkID, bool), RepositoryError>
[src]

Writes a chunk to the repo

Uses all defaults

Will return None if writing the chunk fails. Will not write the chunk if it already exists.

Manually sets the id of the written chunk. This should be used carefully, as it has potential to damage the repository.

Primiarly intended for writing the manifest

pub async fn has_chunk<'_>(&'_ self, id: ChunkID) -> bool[src]

Determines if a chunk exists in the index

pub async fn read_chunk<'_>(
    &'_ mut self,
    id: ChunkID
) -> Result<Vec<u8>, RepositoryError>
[src]

Reads a chunk from the repo

Returns none if reading the chunk fails

pub async fn count_chunk<'_>(&'_ self) -> usize[src]

Provides a count of the number of chunks in the repository

pub fn chunk_settings(&self) -> ChunkSettings[src]

Returns the current default chunk settings for this repository

pub fn key(&self) -> &Key[src]

Gets a refrence to the repository's key

pub fn backend_manifest(&self) -> T::Manifest[src]

Provides a handle to the backend manifest

pub async fn close(__arg0: Self)[src]

Performs any work that would normally be done in a drop impl, but needs to be done asyncronsyly.

Calls into the backend's implementation

pub async fn seen_versions<'_>(&'_ self) -> HashSet<(Version, Uuid)>[src]

Returns a set of all version and implementation pairs that have touched this repository in the past.

Trait Implementations

impl<T: Clone> Clone for Repository<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for Repository<T>

impl<T> Send for Repository<T> where
    T: Send

impl<T> Sync for Repository<T> where
    T: Sync

impl<T> Unpin for Repository<T> where
    T: Unpin

impl<T> !UnwindSafe for Repository<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?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> 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]