pub trait BucketLogProvider:
Send
+ Sync
+ Debug
+ Clone
+ 'static {
type Error: Display + Debug;
// Required methods
fn exists<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn heads<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Link>, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn append<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
name: String,
current: Link,
previous: Option<Link>,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn height<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<u64, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn has<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
link: Link,
) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_buckets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>, BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided method
fn head<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
height: Option<u64>,
) -> Pin<Box<dyn Future<Output = Result<(Link, u64), BucketLogError<Self::Error>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Required Associated Types§
Required Methods§
fn exists<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn heads<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Link>, BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn heads<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Vec<Link>, BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn append<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
name: String,
current: Link,
previous: Option<Link>,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
name: String,
current: Link,
previous: Option<Link>,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Append a version of the bucket to the log
§Arguments
id- The UUID of the bucketname- The friendly name for the bucketcurrent- The current link of the recordprevious- The previous link of the recordheight- The reported depth of the bucket version within the chain
Should fail with the following errors to be considered correct:
Err(BucketLogError::Conflict)- The append causes a conflict with the current logErr(BucketLogError::InvalidHeight)- The height is not greater than the previous height
Sourcefn height<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<u64, BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn height<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<u64, BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Return the greatest height of the bucket version within the chain
§Arguments
id- The UUID of the bucket
§Returns
Result<u64, BucketLogError<Self::Error>>- The height of the bucket version within the chain
NOTE: while this returns a BucketLogError, it should only ever return a BucketLogError::NotFound or ProviderError
Sourcefn has<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
link: Link,
) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
link: Link,
) -> Pin<Box<dyn Future<Output = Result<Vec<u64>, BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn list_buckets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>, BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_buckets<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Uuid>, BucketLogError<Self::Error>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all bucket IDs that have log entries
§Returns
Ok(Vec<Uuid>)- The list of bucket IDsErr(BucketLogError)- An error occurred while fetching bucket IDs
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.