Skip to main content

ProviderConnector

Struct ProviderConnector 

Source
pub struct ProviderConnector { /* private fields */ }
Expand description

The provider composition root retains the supplied clock and id source, and the one HTTP client every connection it makes sends through.

Implementations§

Source§

impl ProviderConnector

Source

pub fn new(clock: ClockRef, ids: IdSourceRef) -> Self

Retain the capabilities used to construct subsequent connections.

Source

pub fn with_folder_api(self, api: String) -> Self

Send account and folder calls to an in-process provider API in application tests.

Source

pub async fn empty_s3_bucket( &self, config: StorageConfig, credentials: S3Credentials, ) -> Result<EmptiedS3Bucket, EmptyS3BucketError>

Delete every object and abort every unfinished upload in an S3 location’s bucket, once its root shows it holds only stores, with this connector’s clock, ids and HTTP client (api.md E14). A development tool outside the sync protocol.

Trait Implementations§

Source§

impl StorageConnector for ProviderConnector

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 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 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 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).
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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,