pub struct ClusterController { /* private fields */ }Expand description
Facade composing the cluster-control primitives.
Implementations§
Source§impl ClusterController
impl ClusterController
Sourcepub fn new(
instance_id: NodeId,
kv: Arc<dyn ClusterKv>,
snapshot: Option<Arc<AssignmentSnapshotStore>>,
members_rx: Receiver<Vec<NodeInfo>>,
) -> Self
pub fn new( instance_id: NodeId, kv: Arc<dyn ClusterKv>, snapshot: Option<Arc<AssignmentSnapshotStore>>, members_rx: Receiver<Vec<NodeInfo>>, ) -> Self
Wrap the given primitives.
Sourcepub fn cluster_min_watermark(&self) -> Option<i64>
pub fn cluster_min_watermark(&self) -> Option<i64>
Latest cluster-wide minimum watermark seen by this instance.
None until the leader has published a Commit with a
populated min_watermark_ms.
Sourcepub fn publish_cluster_min_watermark(&self, wm: i64)
pub fn publish_cluster_min_watermark(&self, wm: i64)
Leader-side monotonic publish. The leader computes the
cluster-wide minimum watermark in await_prepare_quorum
(its own local watermark folded with every follower’s ack)
and must mirror it into the controller atomic so its own
operators see the same value that followers pick up via
observe_barrier on the matching Commit. Never lowers the
published value — event-time progress is monotonic.
Sourcepub fn instance_id(&self) -> NodeId
pub fn instance_id(&self) -> NodeId
This instance’s ID.
Sourcepub fn current_leader(&self) -> Option<NodeId>
pub fn current_leader(&self) -> Option<NodeId>
Current leader (lowest id among Active peers plus self).
Sourcepub fn live_instances(&self) -> Vec<NodeId>
pub fn live_instances(&self) -> Vec<NodeId>
Live instance IDs: Active peers plus self.
Sourcepub fn members_watch(&self) -> Receiver<Vec<NodeInfo>>
pub fn members_watch(&self) -> Receiver<Vec<NodeInfo>>
Cloneable membership watch. Background tasks subscribe to
this to react to join/leave events (changed().await) without
polling Self::live_instances on a timer.
Sourcepub async fn announce_barrier(
&self,
ann: &BarrierAnnouncement,
) -> Result<(), String>
pub async fn announce_barrier( &self, ann: &BarrierAnnouncement, ) -> Result<(), String>
Sourcepub async fn observe_barrier(
&self,
) -> Result<Option<BarrierAnnouncement>, String>
pub async fn observe_barrier( &self, ) -> Result<Option<BarrierAnnouncement>, String>
Follower-side observe; Ok(None) if no leader is visible.
As a side effect, a Commit announcement with a populated
min_watermark_ms updates the shared cluster-min-watermark
atomic so operators on this instance see the cluster-wide
minimum without a separate polling path.
§Errors
Propagates BarrierCoordinator::observe errors.
Sourcepub async fn ack_barrier(&self, ack: &BarrierAck) -> Result<(), String>
pub async fn ack_barrier(&self, ack: &BarrierAck) -> Result<(), String>
Sourcepub async fn wait_for_quorum(
&self,
epoch: u64,
expected: &[NodeId],
deadline: Duration,
) -> QuorumOutcome
pub async fn wait_for_quorum( &self, epoch: u64, expected: &[NodeId], deadline: Duration, ) -> QuorumOutcome
Leader-side: poll until quorum or deadline.
Sourcepub fn snapshot_store(&self) -> Option<&AssignmentSnapshotStore>
pub fn snapshot_store(&self) -> Option<&AssignmentSnapshotStore>
Assignment snapshot store, if configured.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ClusterController
impl !RefUnwindSafe for ClusterController
impl Send for ClusterController
impl Sync for ClusterController
impl Unpin for ClusterController
impl UnsafeUnpin for ClusterController
impl !UnwindSafe for ClusterController
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 more