pub enum Backend {
Local(LocalBackend),
Server(ServerBackend),
}Variants§
Local(LocalBackend)
Server(ServerBackend)
Implementations§
Source§impl Backend
impl Backend
Sourcepub fn init(&self, compression: Compression) -> Result<bool>
pub fn init(&self, compression: Compression) -> Result<bool>
Initialize the backend storage
Idempotent: returns true if the backend was already initialized.
Sourcepub fn check_access(&self) -> Result<()>
pub fn check_access(&self) -> Result<()>
Check that the current user can access the backend. Called once before batch operations so auth/permission problems fail fast with a single error instead of once per file.
Sourcepub fn store(&self, req: StoreRequest<'_>) -> Result<StoreResult>
pub fn store(&self, req: StoreRequest<'_>) -> Result<StoreResult>
Store file to backend under req.hashes, compressing it.
The source is passed uncompressed, the hash we send is only for (optional) verification by
a server
Sourcepub fn retrieve(&self, req: RetrieveRequest<'_>) -> Result<bool>
pub fn retrieve(&self, req: RetrieveRequest<'_>) -> Result<bool>
Retrieve content by hash to target path, optionally decompressing. Returns true if the file was copied to the target path.
Sourcepub fn remove(&self, hash: &Hashes) -> Result<()>
pub fn remove(&self, hash: &Hashes) -> Result<()>
Remove content by hash (for rollback). Best-effort, may silently fail.
Sourcepub fn get_audit_entries(&self, files: &[PathBuf]) -> Result<Vec<AuditEntry>>
pub fn get_audit_entries(&self, files: &[PathBuf]) -> Result<Vec<AuditEntry>>
Read the whole audit file, filtered by the given file paths.
If files is empty, return the full audit log
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Backend
impl<'de> Deserialize<'de> for Backend
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Backend
Auto Trait Implementations§
impl !Freeze for Backend
impl RefUnwindSafe for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl UnsafeUnpin for Backend
impl UnwindSafe for Backend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more