pub struct VdirStorage<I: Item> {
pub path: Utf8PathBuf,
pub extension: String,
/* private fields */
}
Expand description
A vdir
filesystem directory containing zero or more directories.
Each child directory is treated as Collection
. Nested subdirectories are not supported.
§Hrefs
Internally, all href
s are paths relative to the base directory.
Fields§
§path: Utf8PathBuf
The path to a directory containing a storage.
Each top-level subdirectory will be treated as a separate collection, and individual files
inside these are each treated as an Item
.
extension: String
Filename extension for items in a storage. Files with matching extension are treated a items for a collection, and all other files are ignored.
Implementations§
source§impl<I: Item> VdirStorage<I>
impl<I: Item> VdirStorage<I>
pub fn new(path: Utf8PathBuf, extension: String) -> Self
Trait Implementations§
source§impl<I: Item> Storage<I> for VdirStorage<I>where
I::Property: PropertyWithFilename,
impl<I: Item> Storage<I> for VdirStorage<I>where
I::Property: PropertyWithFilename,
source§fn delete_item<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
href: &'life1 str,
etag: &'life2 Etag,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_item<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
href: &'life1 str,
etag: &'life2 Etag,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
§Quirks
Checking the etag is vulnerable to TOCTOU race conditions. Filesystem APIs do not provide facilities to work around this.
source§fn check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Checks that the storage works. This includes validating credentials, and reachability. Read more
source§fn discover_collections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Discovery, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn discover_collections<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Discovery, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Finds existing collections for this storage.
source§fn create_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Collection, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Collection, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a new collection with a specified
href
.source§fn destroy_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn destroy_collection<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes an existing collection. Read more
source§fn list_items<'life0, 'life1, 'async_trait>(
&'life0 self,
collection_href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ItemRef>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_items<'life0, 'life1, 'async_trait>(
&'life0 self,
collection_href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ItemRef>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Enumerates items in a given collection.
source§fn get_item<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(I, Etag), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_item<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(I, Etag), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetches a single item from given collection. Read more
source§fn get_many_items<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
hrefs: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<FetchedItem<I>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_many_items<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
hrefs: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<FetchedItem<I>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Fetches multiple items. Read more
source§fn get_all_items<'life0, 'life1, 'async_trait>(
&'life0 self,
collection_href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FetchedItem<I>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_all_items<'life0, 'life1, 'async_trait>(
&'life0 self,
collection_href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<FetchedItem<I>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Fetch all items from a given collection. Read more
source§fn set_property<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
href: &'life1 str,
meta: I::Property,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn set_property<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
href: &'life1 str,
meta: I::Property,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Sets the value of a property for a given collection.
source§fn unset_property<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
meta: I::Property,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn unset_property<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
meta: I::Property,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Unsets a property for a given collection.
source§fn get_property<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
meta: I::Property,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_property<'life0, 'life1, 'async_trait>(
&'life0 self,
href: &'life1 str,
meta: I::Property,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns the value of a property for a given collection.
source§fn add_item<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection_href: &'life1 str,
item: &'life2 I,
) -> Pin<Box<dyn Future<Output = Result<ItemRef, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn add_item<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection_href: &'life1 str,
item: &'life2 I,
) -> Pin<Box<dyn Future<Output = Result<ItemRef, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Saves a new item into a given collection
source§fn update_item<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
href: &'life1 str,
etag: &'life2 Etag,
item: &'life3 I,
) -> Pin<Box<dyn Future<Output = Result<Etag, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn update_item<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
href: &'life1 str,
etag: &'life2 Etag,
item: &'life3 I,
) -> Pin<Box<dyn Future<Output = Result<Etag, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Updates the contents of an existing item.
source§fn href_for_collection_id(&self, id: &CollectionId) -> Result<Href, Error>
fn href_for_collection_id(&self, id: &CollectionId) -> Result<Href, Error>
source§fn list_properties<'life0, 'life1, 'async_trait>(
&'life0 self,
collection_href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ListedProperty<I::Property>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_properties<'life0, 'life1, 'async_trait>(
&'life0 self,
collection_href: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<ListedProperty<I::Property>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List all properties of a collection.
Auto Trait Implementations§
impl<I> Freeze for VdirStorage<I>
impl<I> RefUnwindSafe for VdirStorage<I>where
I: RefUnwindSafe,
impl<I> Send for VdirStorage<I>
impl<I> Sync for VdirStorage<I>
impl<I> Unpin for VdirStorage<I>where
I: Unpin,
impl<I> UnwindSafe for VdirStorage<I>where
I: UnwindSafe,
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> 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<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.