pub struct LocalBackend { /* private fields */ }
Expand description
A local backend.
Implementations§
Source§impl LocalBackend
impl LocalBackend
Sourcepub fn new(
path: impl AsRef<str>,
options: impl IntoIterator<Item = (String, String)>,
) -> RusticResult<Self>
pub fn new( path: impl AsRef<str>, options: impl IntoIterator<Item = (String, String)>, ) -> RusticResult<Self>
Create a new LocalBackend
§Arguments
path
- The base path of the backendoptions
- Additional options for the backend
§Errors
- If the directory could not be created.
§Options
post-create-command
- The command to call after a file was created.post-delete-command
- The command to call after a file was deleted.
Trait Implementations§
Source§impl Clone for LocalBackend
impl Clone for LocalBackend
Source§fn clone(&self) -> LocalBackend
fn clone(&self) -> LocalBackend
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for LocalBackend
impl Debug for LocalBackend
Source§impl ReadBackend for LocalBackend
impl ReadBackend for LocalBackend
Source§fn list_with_size(&self, tpe: FileType) -> RusticResult<Vec<(Id, u32)>>
fn list_with_size(&self, tpe: FileType) -> RusticResult<Vec<(Id, u32)>>
Source§fn read_partial(
&self,
tpe: FileType,
id: &Id,
_cacheable: bool,
offset: u32,
length: u32,
) -> RusticResult<Bytes>
fn read_partial( &self, tpe: FileType, id: &Id, _cacheable: bool, offset: u32, length: u32, ) -> RusticResult<Bytes>
Reads partial data of the given file.
§Arguments
tpe
- The type of the file.id
- The id of the file.cacheable
- Whether the file is cacheable.offset
- The offset to read from.length
- The length to read.
§Errors
- If the file could not be opened.
- If the file could not be sought to the given position.
- If the length of the file could not be converted to u32.
- If the exact length of the file could not be read.
Source§fn needs_warm_up(&self) -> bool
fn needs_warm_up(&self) -> bool
Specify if the backend needs a warming-up of files before accessing them.
Source§impl WriteBackend for LocalBackend
impl WriteBackend for LocalBackend
Source§fn create(&self) -> RusticResult<()>
fn create(&self) -> RusticResult<()>
Source§fn write_bytes(
&self,
tpe: FileType,
id: &Id,
_cacheable: bool,
buf: Bytes,
) -> RusticResult<()>
fn write_bytes( &self, tpe: FileType, id: &Id, _cacheable: bool, buf: Bytes, ) -> RusticResult<()>
Write the given bytes to the given file.
§Arguments
tpe
- The type of the file.id
- The id of the file.cacheable
- Whether the file is cacheable.buf
- The bytes to write.
§Errors
- If the file could not be opened.
- If the length of the bytes could not be converted to u64.
- If the length of the file could not be set.
- If the bytes could not be written to the file.
- If the OS Metadata could not be synced to disk.
- If the file does not have a parent directory.
- If the parent directory could not be created.
- If the file cannot be opened, due to missing permissions.
- If the file cannot be written to, due to lack of space on the disk.
Auto Trait Implementations§
impl Freeze for LocalBackend
impl RefUnwindSafe for LocalBackend
impl Send for LocalBackend
impl Sync for LocalBackend
impl Unpin for LocalBackend
impl UnwindSafe for LocalBackend
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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