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§
Sourceasync fn begin_migration(
&self,
partition: &PartitionId,
to: Placement,
) -> Result<Epoch, MigrationError>
async fn begin_migration( &self, partition: &PartitionId, to: Placement, ) -> Result<Epoch, MigrationError>
Begins migrating partition toward to (Active → Draining).
§Errors
MigrationError if the partition is unknown or already migrating, or
MigrationError::Backend if a distributed backend is unreachable.
Sourceasync fn enter_cutover(
&self,
partition: &PartitionId,
) -> Result<Epoch, MigrationError>
async fn enter_cutover( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>
Moves an in-flight migration into the cutover window (Draining →
Cutover); writes are now rejected fleet-wide.
§Errors
MigrationError if the partition is not draining (or a backend failure).
Sourceasync fn complete_migration(
&self,
partition: &PartitionId,
) -> Result<Epoch, MigrationError>
async fn complete_migration( &self, partition: &PartitionId, ) -> Result<Epoch, MigrationError>
Completes the migration, the pointer flip (Cutover → Active(to)).
§Errors
MigrationError if the partition is not in cutover (or a backend failure).
Sourceasync fn abort_migration(
&self,
partition: &PartitionId,
) -> Result<Epoch, MigrationError>
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).
Sourceasync fn state(
&self,
partition: &PartitionId,
) -> Option<(PartitionState, Epoch)>
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".