pub struct PosixBackend { /* private fields */ }
Expand description
State of the backend needed to satisfy the storage APIs.
Implementations§
Source§impl PosixBackend
impl PosixBackend
Sourcepub fn new<P: AsRef<Path>>(
base: P,
cache: StorageCacheConfig,
options: &FileBackendConfig,
) -> Self
pub fn new<P: AsRef<Path>>( base: P, cache: StorageCacheConfig, options: &FileBackendConfig, ) -> Self
Instantiates a new backend.
§Parameters
base
: Directory in which we keep the files. shared among all instances of the backend.
Trait Implementations§
Source§impl StorageBackend for PosixBackend
impl StorageBackend for PosixBackend
Source§fn create_named(
&self,
name: &StoragePath,
) -> Result<Box<dyn FileWriter>, StorageError>
fn create_named( &self, name: &StoragePath, ) -> Result<Box<dyn FileWriter>, StorageError>
Create a new file with the given
name
, automatically creating any
parent directories within name
that don’t already exist.Source§fn open(&self, name: &StoragePath) -> Result<Arc<dyn FileReader>, StorageError>
fn open(&self, name: &StoragePath) -> Result<Arc<dyn FileReader>, StorageError>
Opens
name
for reading.Source§fn list(
&self,
parent: &StoragePath,
cb: &mut dyn FnMut(&StoragePath, StorageFileType),
) -> Result<(), StorageError>
fn list( &self, parent: &StoragePath, cb: &mut dyn FnMut(&StoragePath, StorageFileType), ) -> Result<(), StorageError>
Calls
cb
with the name of each of the files under parent
. This is a
non-recursive list: it does not include files under sub-directories of
parent
.fn delete(&self, name: &StoragePath) -> Result<(), StorageError>
fn delete_recursive(&self, name: &StoragePath) -> Result<(), StorageError>
Source§fn usage(&self) -> Arc<AtomicI64>
fn usage(&self) -> Arc<AtomicI64>
Returns a value that represents the number of bytes of storage in use.
The storage backend updates this value when its own functions cause more
or less storage to be used: Read more
Source§fn file_system_path(&self) -> Option<&Path>
fn file_system_path(&self) -> Option<&Path>
Returns the base directory path on the local file system if the storage backend
uses local disk.
Source§fn create(&self) -> Result<Box<dyn FileWriter>, StorageError>
fn create(&self) -> Result<Box<dyn FileWriter>, StorageError>
Creates a new persistent file used for writing data. The backend selects
a name.
Source§fn create_with_prefix(
&self,
prefix: &Path,
) -> Result<Box<dyn FileWriter>, StorageError>
fn create_with_prefix( &self, prefix: &Path, ) -> Result<Box<dyn FileWriter>, StorageError>
Creates a new persistent file used for writing data, giving the file’s
name the specified
prefix
. See also create
.fn delete_if_exists(&self, name: &Path) -> Result<(), StorageError>
fn exists(&self, name: &Path) -> Result<bool, StorageError>
Auto Trait Implementations§
impl Freeze for PosixBackend
impl RefUnwindSafe for PosixBackend
impl Send for PosixBackend
impl Sync for PosixBackend
impl Unpin for PosixBackend
impl UnwindSafe for PosixBackend
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.