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
impl MigrationTable
Sourcepub fn start(
&self,
prefix: Vec<u8>,
from: String,
to: String,
) -> Result<(), MigrationError>
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.
Sourcepub fn commit(&self, prefix: &[u8]) -> Option<MigrationState>
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).
Sourcepub fn abort(&self, prefix: &[u8]) -> Option<MigrationState>
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.
Sourcepub fn lookup_migrating(&self, prefix: &[u8]) -> Option<MigrationState>
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.
Sourcepub fn lookup_migrated(&self, prefix: &[u8]) -> Option<MigrationState>
pub fn lookup_migrated(&self, prefix: &[u8]) -> Option<MigrationState>
Same shape as Self::lookup_migrating, but for committed
migrations (post-MOVE-SCOPE-INGEST).
Sourcepub fn match_migrating(&self, key: &[u8]) -> Option<MigrationState>
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.
Sourcepub fn match_migrated(&self, key: &[u8]) -> Option<MigrationState>
pub fn match_migrated(&self, key: &[u8]) -> Option<MigrationState>
As Self::match_migrating, for the MIGRATED map.