Struct asuran::repository::Repository [−][src]
pub struct Repository<T> {
pub queue_depth: usize,
// some fields omitted
}
Expand description
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
queue_depth: usize
Depth of queues to build
Implementations
pub fn new(
backend: T,
compression: Compression,
hmac: HMAC,
encryption: Encryption,
key: Key,
pipeline_tasks: usize
) -> Repository<T>
pub fn new(
backend: T,
compression: Compression,
hmac: HMAC,
encryption: Encryption,
key: Key,
pipeline_tasks: usize
) -> Repository<T>
Creates a new repository with the specificed backend and defaults
pub fn with(
backend: T,
settings: ChunkSettings,
key: Key,
pipeline_tasks: usize
) -> Repository<T>
pub fn with(
backend: T,
settings: ChunkSettings,
key: Key,
pipeline_tasks: usize
) -> Repository<T>
Creates a new repository, accepting a ChunkSettings and a ThreadPool
Commits the index to storage
This should be called every time an archive or manifest is written, at the very least
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>
pub async fn write_chunk(
&mut self,
data: Vec<u8>
) -> Result<(ChunkID, bool), RepositoryError>
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
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
Reads a chunk from the repo
Returns none if reading the chunk fails
Provides a count of the number of chunks in the repository
Returns the current default chunk settings for this repository
Provides a handle to the backend manifest
Performs any work that would normally be done in a drop impl, but needs to be done asyncronsyly.
Calls into the backend’s implementation
Trait Implementations
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
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more