pub struct MigrationTracker { /* private fields */ }Expand description
Concurrent registry of active Migrations.
§Conflict prevention
A shard can be involved in at most one migration at a time. Calling
begin_migration for a shard that already has an
active migration returns an Err.
Migrations in terminal states (MigrationStatus::Complete or
MigrationStatus::Failed) no longer block new migrations for the same
shard.
Implementations§
Source§impl MigrationTracker
impl MigrationTracker
Sourcepub fn begin_migration(
&self,
shard_id: ShardId,
from_node: NodeId,
to_node: NodeId,
) -> Result<Uuid, String>
pub fn begin_migration( &self, shard_id: ShardId, from_node: NodeId, to_node: NodeId, ) -> Result<Uuid, String>
Begin a new migration for shard_id from from_node to to_node.
§Errors
Returns Err if the shard is already involved in a non-terminal
migration.
Sourcepub fn update_progress(
&self,
id: Uuid,
bytes_migrated: u64,
total_bytes: u64,
) -> bool
pub fn update_progress( &self, id: Uuid, bytes_migrated: u64, total_bytes: u64, ) -> bool
Update the byte-level progress of migration id.
Returns true if the migration existed and its status was updated to
MigrationStatus::InProgress. Returns false if the migration was
not found.
Sourcepub fn complete_migration(&self, id: Uuid) -> bool
pub fn complete_migration(&self, id: Uuid) -> bool
Mark migration id as MigrationStatus::Complete and release the
shard lock.
Returns true if the migration existed.
Sourcepub fn fail_migration(&self, id: Uuid, reason: String) -> bool
pub fn fail_migration(&self, id: Uuid, reason: String) -> bool
Mark migration id as MigrationStatus::Failed and release the
shard lock.
Returns true if the migration existed.
Sourcepub fn get_migration(&self, id: Uuid) -> Option<Migration>
pub fn get_migration(&self, id: Uuid) -> Option<Migration>
Return a snapshot of the Migration with the given id, or None.
Sourcepub fn active_migrations(&self) -> Vec<Migration>
pub fn active_migrations(&self) -> Vec<Migration>
Return snapshots of all migrations that are not in a terminal state.
Sourcepub fn is_shard_migrating(&self, shard_id: &ShardId) -> bool
pub fn is_shard_migrating(&self, shard_id: &ShardId) -> bool
Return true if shard_id currently has a non-terminal migration.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for MigrationTracker
impl Freeze for MigrationTracker
impl Send for MigrationTracker
impl Sync for MigrationTracker
impl Unpin for MigrationTracker
impl UnsafeUnpin for MigrationTracker
impl UnwindSafe for MigrationTracker
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.