pub trait BucketStateProvider:
Send
+ Sync
+ Debug {
// Required methods
fn check_bucket_sync<'life0, 'life1, 'async_trait>(
&'life0 self,
bucket_id: Uuid,
target_link: &'life1 Link,
) -> Pin<Box<dyn Future<Output = Result<SyncStatus, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_bucket_link<'life0, 'async_trait>(
&'life0 self,
bucket_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Link>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn handle_announce<'life0, 'async_trait>(
&'life0 self,
bucket_id: Uuid,
peer_id: String,
new_link: Link,
previous_link: Option<Link>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for providing bucket state information to the JAX protocol handler
This trait abstracts away the storage layer (database + blobs) so that
the protocol handler in common can query bucket state without depending
on the service crate.
Required Methods§
Sourcefn check_bucket_sync<'life0, 'life1, 'async_trait>(
&'life0 self,
bucket_id: Uuid,
target_link: &'life1 Link,
) -> Pin<Box<dyn Future<Output = Result<SyncStatus, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn check_bucket_sync<'life0, 'life1, 'async_trait>(
&'life0 self,
bucket_id: Uuid,
target_link: &'life1 Link,
) -> Pin<Box<dyn Future<Output = Result<SyncStatus, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Check the sync status of a bucket given a target link
This compares the target_link against the current state of the bucket:
- NotFound: The bucket doesn’t exist
- InSync: The target_link matches the current bucket link
- Behind: The target_link is in the bucket’s history (older version)
- Unsynced: The target_link is not in the bucket’s history (different branch or newer)
Sourcefn get_bucket_link<'life0, 'async_trait>(
&'life0 self,
bucket_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Link>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_bucket_link<'life0, 'async_trait>(
&'life0 self,
bucket_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Link>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get the current link for a bucket
Returns None if the bucket doesn’t exist
Sourcefn handle_announce<'life0, 'async_trait>(
&'life0 self,
bucket_id: Uuid,
peer_id: String,
new_link: Link,
previous_link: Option<Link>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_announce<'life0, 'async_trait>(
&'life0 self,
bucket_id: Uuid,
peer_id: String,
new_link: Link,
previous_link: Option<Link>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle an incoming announce message from a peer
This should trigger a sync event to process the announced update