Skip to main content

ControlPlane

Struct ControlPlane 

Source
pub struct ControlPlane<S> { /* private fields */ }
Expand description

Drives a partition through its migration phases against a MigrationStore, enforcing the drain barrier between cutover and completion (docs/06 §5).

Implementations§

Source§

impl<S: MigrationStore> ControlPlane<S>

Source

pub fn new(store: S) -> Self

Builds a controller over store with the default drain barrier and the system clock.

Source

pub fn with_barrier(self, barrier: Duration) -> Self

Sets the drain barrier (builder style).

Source

pub fn with_clock(self, clock: Arc<dyn Clock>) -> Self

Swaps the clock the barrier reads (tests inject a ManualClock).

Source

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

Begins migrating partition toward to. Writes keep flowing to the origin during the ensuing drain phase.

§Errors

ControlError::Transition if the partition is unknown or migrating.

Source

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

Enters the cutover window and starts the drain barrier clock. Writes are now rejected fleet-wide (every instance polls this fresh).

§Errors

ControlError::Transition if the partition is not draining.

Source

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

Completes the migration once the drain barrier has elapsed since cutover, the pointer flip. Refused (without mutating the store) while in-flight pre-cutover writes might still be committing.

§Errors

ControlError::BarrierPending if the barrier has not elapsed; ControlError::Transition if the partition is not in cutover.

Source

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

Aborts an in-flight migration, returning the partition to its origin and clearing any pending barrier.

§Errors

ControlError::Transition if the partition is not migrating.

Source

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

The partition’s current migration state and epoch, or None. For operator/observability read-out (docs/06 §5).

Trait Implementations§

Source§

impl<S: Debug> Debug for ControlPlane<S>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> !Freeze for ControlPlane<S>

§

impl<S> !RefUnwindSafe for ControlPlane<S>

§

impl<S> !UnwindSafe for ControlPlane<S>

§

impl<S> Send for ControlPlane<S>
where S: Send,

§

impl<S> Sync for ControlPlane<S>
where S: Sync,

§

impl<S> Unpin for ControlPlane<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for ControlPlane<S>
where S: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.