pub struct Migration {
pub id: MigrationId,
pub slot: u16,
pub source: NodeId,
pub target: NodeId,
pub state: MigrationState,
pub started_at: Option<Instant>,
pub keys_migrated: u64,
pub keys_total: Option<u64>,
}Expand description
A single slot migration operation.
Fields§
§id: MigrationIdUnique migration identifier.
slot: u16The slot being migrated.
source: NodeIdNode currently owning the slot.
target: NodeIdNode receiving the slot.
state: MigrationStateCurrent migration state.
started_at: Option<Instant>When migration started.
keys_migrated: u64Number of keys migrated so far.
keys_total: Option<u64>Total keys to migrate (if known).
Implementations§
Source§impl Migration
impl Migration
Sourcepub fn new_importing(slot: u16, source: NodeId, target: NodeId) -> Self
pub fn new_importing(slot: u16, source: NodeId, target: NodeId) -> Self
Create a new migration in the importing state (target perspective).
Sourcepub fn new_migrating(slot: u16, source: NodeId, target: NodeId) -> Self
pub fn new_migrating(slot: u16, source: NodeId, target: NodeId) -> Self
Create a new migration in the migrating state (source perspective).
Sourcepub fn involves(&self, node: &NodeId) -> bool
pub fn involves(&self, node: &NodeId) -> bool
Check if this migration involves a specific node.
Sourcepub fn start_streaming(&mut self, total_keys: u64)
pub fn start_streaming(&mut self, total_keys: u64)
Transition to streaming state.
Sourcepub fn record_migrated(&mut self, count: u64)
pub fn record_migrated(&mut self, count: u64)
Record migrated keys.
Sourcepub fn start_finalizing(&mut self)
pub fn start_finalizing(&mut self)
Transition to finalizing state.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Migration
impl<'de> Deserialize<'de> for Migration
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Migration
impl RefUnwindSafe for Migration
impl Send for Migration
impl Sync for Migration
impl Unpin for Migration
impl UnsafeUnpin for Migration
impl UnwindSafe for Migration
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more