Skip to main content

MigrationConfig

Struct MigrationConfig 

Source
pub struct MigrationConfig {
    pub enabled: bool,
    pub dual_write_legacy: bool,
    pub allow_shed: bool,
    pub retire_legacy: bool,
    pub shed_hold_hours: u64,
    pub retire_delay_hours: u64,
    pub copier_slack_mb: u64,
    pub copier_throttle_mib_per_sec: u64,
    pub wave_hours: u64,
    pub tick_secs: u64,
    pub batch_chunks: usize,
    pub lock_dir: Option<PathBuf>,
}
Expand description

Operator-facing controls for the migration.

Fields§

§enabled: bool

Run the background copier at all.

Turning this off leaves a node reading the union of both stores forever. It never frees the LMDB’s disk, so it is an escape hatch rather than a supported mode.

§dual_write_legacy: bool

Write every new chunk to the legacy environment as well as the file store.

Costs roughly a gigabyte per node per month at the observed fill rate, and buys the ability to roll the fleet back: a chunk uploaded during the bridge to holders that all revert to a pre-migration build would otherwise be gone from every one of them. Automatically irrelevant once the legacy environment is retired.

§allow_shed: bool

Allow a node that cannot fit its payload to drop its furthest keys.

An operator who would rather add disk than shed can set this to false. The node then keeps both stores and never frees the LMDB’s space.

§retire_legacy: bool

Delete chunks.mdb once the retirement gate is satisfied.

On in this release, because it is the only step that returns disk. It is also the only destructive step in the whole migration and the only one that cannot be undone, which is why everything in front of it is a gate: the wave the node is assigned to, the shed hold, the reduced commitment reaching the close group, possession of every chunk being given up proven elsewhere, a re-read of every remaining chunk, and a retention delay on top.

Deliberately never serialised. A node writes its effective configuration back to disk, so shipping this as an ordinary field would bake R1’s false into every operator’s config file and R2 would then never retire anything. The release phase belongs to the build, not to the operator’s file. ANT_MIGRATION_RETIRE_LEGACY overrides it for a canary.

§shed_hold_hours: u64

Hours after this build first starts before a node may shed anything.

Long enough for peers still on a pre-R1 build to upgrade, because one of those still penalises a shedder at the full audit weight.

§retire_delay_hours: u64

Hours between committing to the file-backed key set and deleting chunks.mdb.

Clamped up to MIN_RETIRE_DELAY_HOURS. Longer buys a rollback window on nodes that can afford to hold both copies.

§copier_slack_mb: u64

Free megabytes the copier leaves untouched, on top of the disk reserve.

The copier stops here rather than filling to the brink, so a node that is mid-migration still has room to accept a chunk it is paid for.

§copier_throttle_mib_per_sec: u64

Copy rate ceiling, in mebibytes per second.

The quiet responsible audit lane is where audit timeouts actually cost trust, and an unthrottled copier competing with it for I/O is the fastest way to turn a storage migration into an audit incident.

§wave_hours: u64

Hours between one migration wave opening and the next.

A close group is split into waves so that only CONCURRENT_MIGRATIONS_PER_GROUP of it give chunks up at a time. This is how long a wave gets to finish copying, retiring and refetching before the next one may start. Only nodes that have to give something up wait for their wave; a node with room migrates immediately.

§tick_secs: u64

Seconds between copier ticks.

§batch_chunks: usize

Chunks copied per tick before yielding.

§lock_dir: Option<PathBuf>

Where the volume lock lives, overriding the filesystem this node’s root sits on.

None in production, which keys the lock by device id so every node on one disk serialises against the others. Tests set it so a test’s migration contends only with its own, rather than with every other test sharing the machine’s filesystem.

Never serialised: it exists to scope a test, not to configure a node.

Implementations§

Source§

impl MigrationConfig

Source

pub fn effective_retire_delay_hours(&self) -> u64

The retire delay, never shorter than the retention contract allows.

Source

pub fn copier_slack_bytes(&self) -> u64

Copier slack in bytes.

Trait Implementations§

Source§

impl Clone for MigrationConfig

Source§

fn clone(&self) -> MigrationConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MigrationConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MigrationConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for MigrationConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for MigrationConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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<'de, T> BorrowedRpcObject<'de> for T
where T: RpcBorrow<'de> + RpcSend,

Source§

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

Source§

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

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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
Source§

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

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + 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
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<'de, T> RpcBorrow<'de> for T
where T: Deserialize<'de> + Debug + Send + Sync + Unpin,

Source§

impl<T> RpcObject for T
where T: RpcSend + RpcRecv,

Source§

impl<T> RpcRecv for T
where T: DeserializeOwned + Debug + Send + Sync + Unpin + 'static,

Source§

impl<T> RpcSend for T
where T: Serialize + Clone + Debug + Send + Sync + Unpin,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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