CloudHome

Trait CloudHome 

Source
pub trait CloudHome: Send + Sync {
    // Required methods
    fn write<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        data: Vec<u8>,
    ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn read_range<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
        start: u64,
        end: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'life1, 'async_trait>(
        &'life0 self,
        prefix: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<bool, CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn grant_access<'life0, 'life1, 'async_trait>(
        &'life0 self,
        member_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<CloudHomeJoinInfo, CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn revoke_access<'life0, 'life1, 'async_trait>(
        &'life0 self,
        member_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn probe<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}
Expand description

Low-level cloud storage. Implementations handle a single library.

All methods deal in raw bytes. No encryption or path layout logic.

Required Methods§

Source

fn write<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Write bytes to a key, creating or overwriting.

Source

fn read<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read the full contents of a key.

Source

fn read_range<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, start: u64, end: u64, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read a byte range from a key. start is inclusive, end is exclusive.

Source

fn list<'life0, 'life1, 'async_trait>( &'life0 self, prefix: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all keys under a prefix.

Source

fn delete<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete a key. Not an error if the key does not exist.

Source

fn exists<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check whether a key exists.

Source

fn grant_access<'life0, 'life1, 'async_trait>( &'life0 self, member_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<CloudHomeJoinInfo, CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Grant access to a member and return connection info for the cloud home. For S3 this ignores member_id and returns bucket/region/endpoint (access is managed externally via IAM/pre-shared credentials). For consumer clouds this shares the folder with the member’s account.

Source

fn revoke_access<'life0, 'life1, 'async_trait>( &'life0 self, member_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Revoke a previously granted access. No-op for backends where access is controlled externally (e.g. S3 with pre-shared credentials).

Provided Methods§

Source

fn probe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), CloudHomeError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Verify the backend is reachable with the configured credentials. Setup flows call this before persisting credentials, so a typo or missing bucket fails fast at setup time instead of via a delayed reconnect banner. Default implementation issues a no-op list against a sentinel prefix — backends override with cheaper provider-specific auth checks (e.g. S3 HeadBucket) where available.

Implementors§