pub struct Plan<I: Item> {
pub collection_plans: Vec<CollectionPlan<I>>,
/* private fields */
}
Expand description
Actions that would synchronise a pair of storages.
Use Plan::new
to create new instances.
Use Plan::collection_plans
) to inspect the plan and render it into a human-friendly
representation, into a CSV, or into any other format that is necessary.
Use Plan::execute
to execute this plan and apply changes to the provided Storage
instances.
Fields§
§collection_plans: Vec<CollectionPlan<I>>
Implementations§
source§impl<I: Item> Plan<I>
impl<I: Item> Plan<I>
sourcepub async fn execute(
self,
status: &StatusDatabase,
on_error: impl Fn(SyncError),
) -> Result<(), StatusError>
pub async fn execute( self, status: &StatusDatabase, on_error: impl Fn(SyncError), ) -> Result<(), StatusError>
Executes a synchronization plan.
§Non-fatal errors
When a non-fatal error occurs (e.g.: an item being uploaded is rejected), the on_error
function will be called with details on the exact error.
§Errors
A StatusError
is returned in case writing to the status database fails.
source§impl<I: Item> Plan<I>
impl<I: Item> Plan<I>
sourcepub async fn new(
pair: &StoragePair<I>,
status: Option<&StatusDatabase>,
) -> Result<Plan<I>, PlanError>
pub async fn new( pair: &StoragePair<I>, status: Option<&StatusDatabase>, ) -> Result<Plan<I>, PlanError>
Create a new plan for a given storage pair.
§Errors
Returns an error if:
- There is an error discovering remote collections.
- A mapping is defined by collection id, but the id is invalid for the underlying storage.
- There is an error reading the state of existing items.
- The same collection is mapped more than once.
pub fn storage_a(&self) -> &dyn Storage<I>
pub fn storage_b(&self) -> &dyn Storage<I>
Trait Implementations§
Auto Trait Implementations§
impl<I> Freeze for Plan<I>
impl<I> !RefUnwindSafe for Plan<I>
impl<I> Send for Plan<I>
impl<I> Sync for Plan<I>
impl<I> Unpin for Plan<I>
impl<I> !UnwindSafe for Plan<I>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
source§fn try_octets_into(
self,
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self, ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
source§fn octets_into(self) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.