Struct bonsaidb::files::BonsaiFiles

source ·
pub struct BonsaiFiles;
Expand description

A default configuration for storing files within BonsaiDb.

Trait Implementations§

source§

impl Debug for BonsaiFiles

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl FileConfig for BonsaiFiles

§

type Metadata = Option<()>

The type of the metadata stored in File. If you do not need to store metadata, you can set this type to ().
source§

const BLOCK_SIZE: usize = 65_536usize

The maximum size for each write to an underlying file. The file will be stored by breaking the data written into chunks no larger than BLOCK_SIZE.
source§

fn files_name() -> CollectionName

Returns the unique collection name to use to store Files.
source§

fn blocks_name() -> CollectionName

Returns the unique collection name to use to store file blocks.
source§

fn register_collections(schema: &mut Schematic) -> Result<(), Error>

Registers the collections for this configuration into schema.
source§

fn build<NameOrPath>(name_or_path: NameOrPath) -> FileBuilder<'static, Self>
where NameOrPath: AsRef<str>, Self::Metadata: Default,

Builds a new file. If name_or_path starts with a /, the argument is treated as a full path to the file being built. Otherwise, the argument is treated as the file’s name.
source§

fn build_with_metadata<NameOrPath>( name_or_path: NameOrPath, metadata: Self::Metadata ) -> FileBuilder<'static, Self>
where NameOrPath: AsRef<str>,

Builds a new file. If name_or_path starts with a /, the argument is treated as a full path to the file being built. Otherwise, the argument is treated as the file’s name. The file’s metadata will be metadata upon creation. The file’s metadata will be metadata upon creation.
source§

fn get<Database>( id: u32, database: &Database ) -> Result<Option<File<Blocking<Database>, Self>>, Error>
where Database: Connection + Clone,

Returns the file with the unique id given, if found. This function only loads metadata about the file, it does not load the contents of the file.
source§

fn load<Database>( path: &str, database: &Database ) -> Result<Option<File<Blocking<Database>, Self>>, Error>
where Database: Connection + Clone,

Returns the file located at path, if found. This function only loads metadata about the file, it does not load the contents of the file.
source§

fn load_or_create<Database>( path: &str, expect_present: bool, database: &Database ) -> Result<File<Blocking<Database>, Self>, Error>
where Database: Connection + Clone, Self::Metadata: Default,

Returns the file locate at path, or creates an empty file if not currently present. Read more
source§

fn load_or_create_with_metadata<Database>( path: &str, metadata: Self::Metadata, expect_present: bool, database: &Database ) -> Result<File<Blocking<Database>, Self>, Error>
where Database: Connection + Clone,

Returns the file locate at path, or creates an empty file if not currently present. Read more
source§

fn delete<Database>(path: &str, database: &Database) -> Result<bool, Error>
where Database: Connection + Clone,

Deletes the file at path. Returns true if a file was deleted. Does not error if the file is not found.
source§

fn list<Database>( path: &str, database: &Database ) -> Result<Vec<File<Blocking<Database>, Self>>, Error>
where Database: Connection + Clone,

Returns all files that have a containing path of exactly path. It will only return files that have been created, and will not return “virtual” directories that are part of a file’s path but have never been created. Read more
source§

fn list_recursive<Database>( path: &str, database: &Database ) -> Result<Vec<File<Blocking<Database>, Self>>, Error>
where Database: Connection + Clone,

Returns all files that have a path starting with path. Read more
source§

fn stats<Database>(database: &Database) -> Result<Statistics, Error>
where Database: Connection + Clone,

Returns statistics for all files contained within this collection. This is equivalent to calling Self::stats_for_path with "/" for the path.
source§

fn stats_for_path<Database>( path: &str, database: &Database ) -> Result<Statistics, Error>
where Database: Connection + Clone,

Returns statistics for all files whose path starts with path.
source§

fn get_async<'life0, 'async_trait, Database>( id: u32, database: &'life0 Database ) -> Pin<Box<dyn Future<Output = Result<Option<File<Async<Database>, Self>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Database: 'async_trait + AsyncConnection + Clone, Self: 'async_trait,

Returns the file with the unique id given, if found. This function only loads metadata about the file, it does not load the contents of the file.
source§

fn load_async<'life0, 'life1, 'async_trait, Database>( path: &'life0 str, database: &'life1 Database ) -> Pin<Box<dyn Future<Output = Result<Option<File<Async<Database>, Self>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Database: 'async_trait + AsyncConnection + Clone, Self: 'async_trait,

Returns the file located at path, if found. This function only loads metadata about the file, it does not load the contents of the file.
source§

fn load_or_create_async<'life0, 'life1, 'async_trait, Database>( path: &'life0 str, expect_present: bool, database: &'life1 Database ) -> Pin<Box<dyn Future<Output = Result<File<Async<Database>, Self>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self::Metadata: Default, Database: 'async_trait + AsyncConnection + Clone, Self: 'async_trait,

Returns the file locate at path, or creates an empty file if not currently present. Read more
source§

fn load_or_create_with_metadata_async<'life0, 'life1, 'async_trait, Database>( path: &'life0 str, metadata: Self::Metadata, expect_present: bool, database: &'life1 Database ) -> Pin<Box<dyn Future<Output = Result<File<Async<Database>, Self>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Database: 'async_trait + AsyncConnection + Clone, Self: 'async_trait,

Returns the file locate at path, or creates an empty file if not currently present. Read more
source§

fn delete_async<'life0, 'life1, 'async_trait, Database>( path: &'life0 str, database: &'life1 Database ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Database: 'async_trait + AsyncConnection + Clone, Self: 'async_trait,

Deletes the file at path. Returns true if a file was deleted. Does not error if the file is not found.
source§

fn list_async<'life0, 'life1, 'async_trait, Database>( path: &'life0 str, database: &'life1 Database ) -> Pin<Box<dyn Future<Output = Result<Vec<File<Async<Database>, Self>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Database: 'async_trait + AsyncConnection + Clone, Self: 'async_trait,

Returns all files that have a containing path of exactly path. It will only return files that have been created, and will not return “virtual” directories that are part of a file’s path but have never been created. Read more
source§

fn list_recursive_async<'life0, 'life1, 'async_trait, Database>( path: &'life0 str, database: &'life1 Database ) -> Pin<Box<dyn Future<Output = Result<Vec<File<Async<Database>, Self>>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Database: 'async_trait + AsyncConnection + Clone, Self: 'async_trait,

Returns all files that have a path starting with path. Read more
source§

fn stats_async<'life0, 'async_trait, Database>( database: &'life0 Database ) -> Pin<Box<dyn Future<Output = Result<Statistics, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Database: 'async_trait + AsyncConnection + Clone, Self: 'async_trait,

Returns statistics for all files contained within this collection. This is equivalent to calling Self::stats_for_path_async with "/" for the path.
source§

fn stats_for_path_async<'life0, 'life1, 'async_trait, Database>( path: &'life0 str, database: &'life1 Database ) -> Pin<Box<dyn Future<Output = Result<Statistics, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Database: 'async_trait + AsyncConnection + Clone, Self: 'async_trait,

Returns statistics for all files whose path starts with path.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more