Skip to main content

MigrationTable

Struct MigrationTable 

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

Per-scope migration tracker. Insert order doesn’t matter; lookups are O(prefix-set-size), expected ≤ tens of entries even in the largest cluster.

Implementations§

Source§

impl MigrationTable

Source

pub fn new() -> Self

Empty table — the v1.21 default (no migrations in flight).

Source

pub fn start( &self, prefix: Vec<u8>, from: String, to: String, ) -> Result<(), MigrationError>

Start a migration for prefix. Returns Err if the prefix is already in either map. The caller (server cement) is expected to hold a higher-level lock per MOVE-SCOPE invocation so concurrent operator commands don’t race.

Source

pub fn commit(&self, prefix: &[u8]) -> Option<MigrationState>

Commit an in-flight migration: move the entry from MIGRATING to MIGRATED. Returns the state that was committed, or None when there’s no in-flight migration for prefix (idempotent).

Source

pub fn abort(&self, prefix: &[u8]) -> Option<MigrationState>

Abort an in-flight migration without committing. Drops the entry from MIGRATING; the MIGRATED map is untouched (an aborted migration never moved data). Returns the state that was aborted, or None when there was nothing to abort.

Source

pub fn lookup_migrating(&self, prefix: &[u8]) -> Option<MigrationState>

Look up the in-flight migration for prefix. Returns the state by value (cheap clone — two short Strings) so the caller doesn’t hold the mutex while encoding the -QUIESCED reply.

Source

pub fn lookup_migrated(&self, prefix: &[u8]) -> Option<MigrationState>

Same shape as Self::lookup_migrating, but for committed migrations (post-MOVE-SCOPE-INGEST).

Source

pub fn match_migrating(&self, key: &[u8]) -> Option<MigrationState>

Longest-prefix-match lookup for in-flight migrations. Used by scope_integration::route_write to decide whether to encode -QUIESCED before falling through to the static OwnershipTable::route.

Source

pub fn match_migrated(&self, key: &[u8]) -> Option<MigrationState>

As Self::match_migrating, for the MIGRATED map.

Trait Implementations§

Source§

impl Debug for MigrationTable

Source§

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

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

impl Default for MigrationTable

Source§

fn default() -> MigrationTable

Returns the “default value” for a type. 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<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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