Struct bindle::provider::embedded::EmbeddedProvider
source · pub struct EmbeddedProvider<T> { /* private fields */ }Expand description
An embedded database backend for storing and retrieving bindles and parcels.
Given a storage directory, EmbeddedProvider brings its own storage layout for keeping track of Bindles.
An EmbeddedProvider needs a search engine implementation. When invoices are created or yanked, the index will be updated.
Implementations§
Trait Implementations§
source§impl<T: Clone> Clone for EmbeddedProvider<T>
impl<T: Clone> Clone for EmbeddedProvider<T>
source§impl<T: Search + Send + Sync> Provider for EmbeddedProvider<T>
impl<T: Search + Send + Sync> Provider for EmbeddedProvider<T>
source§fn create_invoice<'life0, 'async_trait, I>(
&'life0 self,
invoice: I
) -> Pin<Box<dyn Future<Output = Result<(Invoice, Vec<Label>)>> + Send + 'async_trait>>where
I: Signed + Verified + Send + Sync + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
fn create_invoice<'life0, 'async_trait, I>( &'life0 self, invoice: I ) -> Pin<Box<dyn Future<Output = Result<(Invoice, Vec<Label>)>> + Send + 'async_trait>>where I: Signed + Verified + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,
This takes an invoice and creates it in storage. Returns the newly created invoice and a
list of missing parcels Read more
source§fn get_yanked_invoice<'life0, 'async_trait, I>(
&'life0 self,
id: I
) -> Pin<Box<dyn Future<Output = Result<Invoice>> + Send + 'async_trait>>where
I: TryInto<Id> + Send + 'async_trait,
I::Error: Into<ProviderError>,
Self: 'async_trait,
'life0: 'async_trait,
fn get_yanked_invoice<'life0, 'async_trait, I>( &'life0 self, id: I ) -> Pin<Box<dyn Future<Output = Result<Invoice>> + Send + 'async_trait>>where I: TryInto<Id> + Send + 'async_trait, I::Error: Into<ProviderError>, Self: 'async_trait, 'life0: 'async_trait,
Load an invoice, even if it is yanked. This is called by the default implementation of
get_invoicesource§fn yank_invoice<'life0, 'async_trait, I>(
&'life0 self,
id: I
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
I: TryInto<Id> + Send + 'async_trait,
I::Error: Into<ProviderError>,
Self: 'async_trait,
'life0: 'async_trait,
fn yank_invoice<'life0, 'async_trait, I>( &'life0 self, id: I ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where I: TryInto<Id> + Send + 'async_trait, I::Error: Into<ProviderError>, Self: 'async_trait, 'life0: 'async_trait,
Remove an invoice by ID
source§fn create_parcel<'life0, 'life1, 'async_trait, I, R, B>(
&'life0 self,
bindle_id: I,
parcel_id: &'life1 str,
data: R
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
I: TryInto<Id> + Send + 'async_trait,
I::Error: Into<ProviderError>,
R: Stream<Item = Result<B>> + Unpin + Send + Sync + 'static + 'async_trait,
B: Buf + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_parcel<'life0, 'life1, 'async_trait, I, R, B>( &'life0 self, bindle_id: I, parcel_id: &'life1 str, data: R ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where I: TryInto<Id> + Send + 'async_trait, I::Error: Into<ProviderError>, R: Stream<Item = Result<B>> + Unpin + Send + Sync + 'static + 'async_trait, B: Buf + Send + 'async_trait, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Creates a parcel with the associated sha. The parcel can be anything that implements
Stream Read moresource§fn get_parcel<'life0, 'life1, 'async_trait, I>(
&'life0 self,
bindle_id: I,
parcel_id: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<Bytes>> + Unpin + Send + Sync>>> + Send + 'async_trait>>where
I: TryInto<Id> + Send + 'async_trait,
I::Error: Into<ProviderError>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_parcel<'life0, 'life1, 'async_trait, I>( &'life0 self, bindle_id: I, parcel_id: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Stream<Item = Result<Bytes>> + Unpin + Send + Sync>>> + Send + 'async_trait>>where I: TryInto<Id> + Send + 'async_trait, I::Error: Into<ProviderError>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Get a specific parcel using its SHA. Read more
source§fn parcel_exists<'life0, 'life1, 'async_trait, I>(
&'life0 self,
bindle_id: I,
parcel_id: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
I: TryInto<Id> + Send + 'async_trait,
I::Error: Into<ProviderError>,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn parcel_exists<'life0, 'life1, 'async_trait, I>( &'life0 self, bindle_id: I, parcel_id: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where I: TryInto<Id> + Send + 'async_trait, I::Error: Into<ProviderError>, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Checks if the given parcel exists in storage. Read more
source§fn get_invoice<'life0, 'async_trait, I>(
&'life0 self,
id: I
) -> Pin<Box<dyn Future<Output = Result<Invoice>> + Send + 'async_trait>>where
I: TryInto<Id> + Send + 'async_trait,
I::Error: Into<ProviderError>,
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn get_invoice<'life0, 'async_trait, I>( &'life0 self, id: I ) -> Pin<Box<dyn Future<Output = Result<Invoice>> + Send + 'async_trait>>where I: TryInto<Id> + Send + 'async_trait, I::Error: Into<ProviderError>, Self: Sync + 'async_trait, 'life0: 'async_trait,
Load an invoice and return it Read more
source§fn validate_parcel<'life0, 'life1, 'async_trait, I>(
&'life0 self,
bindle_id: I,
parcel_id: &'life1 str
) -> Pin<Box<dyn Future<Output = Result<Label>> + Send + 'async_trait>>where
I: TryInto<Id> + Send + 'async_trait,
I::Error: Into<ProviderError>,
Self: Sync + 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn validate_parcel<'life0, 'life1, 'async_trait, I>( &'life0 self, bindle_id: I, parcel_id: &'life1 str ) -> Pin<Box<dyn Future<Output = Result<Label>> + Send + 'async_trait>>where I: TryInto<Id> + Send + 'async_trait, I::Error: Into<ProviderError>, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,
Checks if the given parcel ID exists within an invoice. The default implementation will fetch
the parcel and check if the given parcel ID exists. Returns the parcel label if valid. Most
providers should implement some sort of caching for
get_yanked_invoice to avoid fetching
the invoice every single time a parcel is requested. Provider implementations may also
implement this function to include other validation logic if desired.