Struct wither::migration::IntervalMigration
[−]
[src]
pub struct IntervalMigration { pub name: String, pub threshold: DateTime<Utc>, pub filter: Document, pub set: Option<Document>, pub unset: Option<Document>, }
A migration type which allows execution until the specifed threshold
date. Then will no-op.
This migration type works nicely in environments where multiple instances of the system — in
which this migration is defined — are continuously running, even during deployment cycles.
Highly available systems. With an IntervalMigration
, each instance will execute the
migration at boottime, until the threshold
date is passed. This will compensate for
write-heavy workloads, as the final instance to be updated will ensure schema convergence.
As long as you ensure your migrations are idempotent — WHICH YOU ALWAYS SHOULD — this
will work quite nicely.
Fields
name: String
The name for this migration. Must be unique per collection.
threshold: DateTime<Utc>
The UTC datetime when this migration should no longer execute.
Use something like: chrono::Utc.ymd(2017, 11, 20).and_hms(22, 37, 34)
.
filter: Document
The filter to be used for selecting the documents to update.
set: Option<Document>
The document to be used for the $set
operation of the update.
unset: Option<Document>
The document to be used for the $unset
operation of the update.
Trait Implementations
impl Migration for IntervalMigration
[src]
fn execute<'c>(&self, coll: &'c Collection) -> Result<()>
[src]
The function which is to execute this migration.