pub struct Plan<I: Item> {
pub collection_plans: Vec<CollectionPlan<I>>,
pub stale_collections: Vec<MappingUid>,
/* 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>>
§stale_collections: Vec<MappingUid>
Implementations§
source§impl<I: Item> Plan<I>
impl<I: Item> Plan<I>
sourcepub async fn execute(
self,
status: &StatusDatabase,
on_error: impl Fn(SyncError<I>),
) -> Result<(), StatusError>
pub async fn execute( self, status: &StatusDatabase, on_error: impl Fn(SyncError<I>), ) -> 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.
Analyses the provided StoragePair
, fetches necessary metadata, and prepares a plan of
actions required to synchronise both storages.
This function only performs read operations. The status database should be opened in read-only mode.
§Errors
See: PlanError
.