Skip to main content

StorageConnector

Trait StorageConnector 

Source
pub trait StorageConnector: Send + Sync {
    // Required method
    fn connect<'life0, 'async_trait>(
        &'life0 self,
        config: StorageConfig,
        auth: ProviderAuth,
        device: DeviceId,
        publications: Arc<dyn PublicationGate>,
        cooldown: Arc<dyn Cooldown>,
        transfers: Arc<TransferBudget>,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<StorageConnection>, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn account_label<'life0, 'async_trait>(
        &'life0 self,
        _auth: ProviderAuth,
        _cooldown: Arc<dyn Cooldown>,
    ) -> Pin<Box<dyn Future<Output = Result<String, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn onedrive_root<'life0, 'async_trait>(
        &'life0 self,
        _auth: ProviderAuth,
        _cooldown: Arc<dyn Cooldown>,
    ) -> Pin<Box<dyn Future<Output = Result<StorageFolder, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn onedrive_folders<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _parent: &'life1 StorageConfig,
        _auth: ProviderAuth,
        _cooldown: Arc<dyn Cooldown>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<StorageFolder>, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn create_onedrive_folder<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _parent: &'life1 StorageConfig,
        _name: &'life2 str,
        _auth: ProviderAuth,
        _cooldown: Arc<dyn Cooldown>,
    ) -> Pin<Box<dyn Future<Output = Result<StorageFolder, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn dropbox_shared_folders<'life0, 'async_trait>(
        &'life0 self,
        _auth: ProviderAuth,
        _cooldown: Arc<dyn Cooldown>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<StorageFolder>, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn create_dropbox_shared_folder<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _name: &'life1 str,
        _auth: ProviderAuth,
        _cooldown: Arc<dyn Cooldown>,
    ) -> Pin<Box<dyn Future<Output = Result<StorageFolder, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn prepare_cloudkit<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _container: &'life1 str,
        _store: StoreId,
    ) -> Pin<Box<dyn Future<Output = Result<StorageConfig, StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn detect_s3<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _config: StorageConfig,
        _credentials: S3Credentials,
        _store: StoreId,
        runs: &'life1 S3DetectionRuns,
        _waits: &'life2 SetupWaits,
    ) -> Pin<Box<dyn Future<Output = S3DetectionRun> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn check_new_store<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _config: StorageConfig,
        _auth: ProviderAuth,
        _store: StoreId,
        _waits: &'life1 SetupWaits,
    ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Constructs provider connections without committing settings or credentials. Tests replace the connection boundary with in-memory storage.

Required Methods§

Source

fn connect<'life0, 'async_trait>( &'life0 self, config: StorageConfig, auth: ProviderAuth, device: DeviceId, publications: Arc<dyn PublicationGate>, cooldown: Arc<dyn Cooldown>, transfers: Arc<TransferBudget>, ) -> Pin<Box<dyn Future<Output = Result<Arc<StorageConnection>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Validate settings and wrap the selected native provider once. The caller verifies the connection before publication. Every request waits for the store’s shared cooldown; a rejected OAuth token is refreshed in the sign-in’s custody (§20.2). A setup call makes its own connection beside it (StorageConnection::during_setup) for its requests to draw on its waits (§20.8). The connection writes for device: what it stages sits in that device’s reserved folder (D10).

Provided Methods§

Source

fn account_label<'life0, 'async_trait>( &'life0 self, _auth: ProviderAuth, _cooldown: Arc<dyn Cooldown>, ) -> Pin<Box<dyn Future<Output = Result<String, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read the signed-in account’s display label before recording a member’s location.

Source

fn onedrive_root<'life0, 'async_trait>( &'life0 self, _auth: ProviderAuth, _cooldown: Arc<dyn Cooldown>, ) -> Pin<Box<dyn Future<Output = Result<StorageFolder, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read the signed-in OneDrive root.

Source

fn onedrive_folders<'life0, 'life1, 'async_trait>( &'life0 self, _parent: &'life1 StorageConfig, _auth: ProviderAuth, _cooldown: Arc<dyn Cooldown>, ) -> Pin<Box<dyn Future<Output = Result<Vec<StorageFolder>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Read all immediate OneDrive child folders.

Source

fn create_onedrive_folder<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _parent: &'life1 StorageConfig, _name: &'life2 str, _auth: ProviderAuth, _cooldown: Arc<dyn Cooldown>, ) -> Pin<Box<dyn Future<Output = Result<StorageFolder, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Create a OneDrive folder without renaming or replacing an occupied name.

Source

fn dropbox_shared_folders<'life0, 'async_trait>( &'life0 self, _auth: ProviderAuth, _cooldown: Arc<dyn Cooldown>, ) -> Pin<Box<dyn Future<Output = Result<Vec<StorageFolder>, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Read all shared Dropbox namespaces.

Source

fn create_dropbox_shared_folder<'life0, 'life1, 'async_trait>( &'life0 self, _name: &'life1 str, _auth: ProviderAuth, _cooldown: Arc<dyn Cooldown>, ) -> Pin<Box<dyn Future<Output = Result<StorageFolder, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Make a folder named name at the top of the signed-in Dropbox and share it, refusing a name already taken.

Source

fn prepare_cloudkit<'life0, 'life1, 'async_trait>( &'life0 self, _container: &'life1 str, _store: StoreId, ) -> Pin<Box<dyn Future<Output = Result<StorageConfig, StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create the owner’s CloudKit location from the entitled container. A connector without native CloudKit support refuses this capability.

Source

fn detect_s3<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _config: StorageConfig, _credentials: S3Credentials, _store: StoreId, runs: &'life1 S3DetectionRuns, _waits: &'life2 SetupWaits, ) -> Pin<Box<dyn Future<Output = S3DetectionRun> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Probe an S3 location’s service (§20.7), writing only fresh objects under the store’s .coven-check/<run>/ prefix for runs.run and deleting them, also on failure, then removing what each of runs.earlier left there. The caller recorded runs.run before calling; the answer names the runs whose probes and uploads are confirmed gone. A connector without native S3 refuses this capability. A rate-limited probe is sent again while setup’s waits allow (§20.8).

Source

fn check_new_store<'life0, 'life1, 'async_trait>( &'life0 self, _config: StorageConfig, _auth: ProviderAuth, _store: StoreId, _waits: &'life1 SetupWaits, ) -> Pin<Box<dyn Future<Output = Result<(), StorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Before a store’s first setup at a location it needs to itself (a Dropbox shared folder, a OneDrive folder, or an S3 bucket), refuse a location whose root holds anything outside the store’s folder or the coven-location marker (§20.3). Reads only. A connector without that provider refuses this capability. A rate-limited listing is sent again while setup’s waits allow.

Implementors§