Skip to main content

MigrationStore

Trait MigrationStore 

Source
pub trait MigrationStore {
    // Required methods
    async fn begin_migration(
        &self,
        partition: &PartitionId,
        to: Placement,
    ) -> Result<Epoch, MigrationError>;
    async fn enter_cutover(
        &self,
        partition: &PartitionId,
    ) -> Result<Epoch, MigrationError>;
    async fn complete_migration(
        &self,
        partition: &PartitionId,
    ) -> Result<Epoch, MigrationError>;
    async fn abort_migration(
        &self,
        partition: &PartitionId,
    ) -> Result<Epoch, MigrationError>;
    async fn state(
        &self,
        partition: &PartitionId,
    ) -> Option<(PartitionState, Epoch)>;
}
Expand description

The backend that holds and transitions the fleet’s placement state, the seam the proxy instances poll for reads and the controller drives for migration.

Implemented in-process by PlacementTable (and Arc<PlacementTable>); a distributed watched store (etcd/Consul/Redis/OS index) implements the same contract in M7 without changing the control protocol above it.

Required Methods§

Source

async fn begin_migration( &self, partition: &PartitionId, to: Placement, ) -> Result<Epoch, MigrationError>

Begins migrating partition toward to (ActiveDraining).

§Errors

MigrationError if the partition is unknown or already migrating, or MigrationError::Backend if a distributed backend is unreachable.

Source

async fn enter_cutover( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>

Moves an in-flight migration into the cutover window (DrainingCutover); writes are now rejected fleet-wide.

§Errors

MigrationError if the partition is not draining (or a backend failure).

Source

async fn complete_migration( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>

Completes the migration, the pointer flip (CutoverActive(to)).

§Errors

MigrationError if the partition is not in cutover (or a backend failure).

Source

async fn abort_migration( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>

Aborts an in-flight migration, returning it to its origin.

§Errors

MigrationError if the partition is not migrating (or a backend failure).

Source

async fn state( &self, partition: &PartitionId, ) -> Option<(PartitionState, Epoch)>

The partition’s current migration state and stamped epoch, or None.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MigrationStore for PlacementTable

Source§

async fn begin_migration( &self, partition: &PartitionId, to: Placement, ) -> Result<Epoch, MigrationError>

Source§

async fn enter_cutover( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>

Source§

async fn complete_migration( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>

Source§

async fn abort_migration( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>

Source§

async fn state( &self, partition: &PartitionId, ) -> Option<(PartitionState, Epoch)>

Source§

impl<T: MigrationStore + Sync + ?Sized> MigrationStore for Arc<T>

Source§

async fn begin_migration( &self, partition: &PartitionId, to: Placement, ) -> Result<Epoch, MigrationError>

Source§

async fn enter_cutover( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>

Source§

async fn complete_migration( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>

Source§

async fn abort_migration( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>

Source§

async fn state( &self, partition: &PartitionId, ) -> Option<(PartitionState, Epoch)>

Implementors§