Trait paxakos::node::Node [−][src]
pub trait Node: Sized {
type Invocation: Invocation;
type Communicator: Communicator<Node = NodeOf<Self::Invocation>, RoundNum = RoundNumOf<Self::Invocation>, CoordNum = CoordNumOf<Self::Invocation>, LogEntry = LogEntryOf<Self::Invocation>, Error = CommunicationErrorOf<Self::Invocation>, Yea = YeaOf<Self::Invocation>, Nay = NayOf<Self::Invocation>, Abstain = AbstainOf<Self::Invocation>>;
type Shutdown: Shutdown<Invocation = Self::Invocation>;
Show 13 methods
fn id(&self) -> NodeIdOf<Self>;
fn status(&self) -> NodeStatus;
fn participation(&self) -> Participation<RoundNumOf<Self>>;
fn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<Self>>;
fn handle(&self) -> NodeHandle<Self::Invocation>;
fn prepare_snapshot(
&self
) -> LocalBoxFuture<'static, Result<SnapshotFor<Self>, PrepareSnapshotError>>;
fn affirm_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), AffirmSnapshotError>>;
fn install_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), InstallSnapshotError>>;
fn read_stale(
&self
) -> LocalBoxFuture<'_, Result<Arc<StateOf<Self>>, Disoriented>>;
fn append<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'_, AppendResultFor<Self, A, R>>
where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>;
fn append_static<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'static, StaticAppendResultFor<Self, A, R>>
where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
R::StaticError: From<ShutDownOr<R::Error>>;
fn shut_down(self) -> Self::Shutdown;
fn next_event(&mut self) -> NextEvent<'_, Self>ⓘ { ... }
}
Expand description
Node that participates in a cluster.
Associated Types
type Invocation: Invocation
type Invocation: Invocation
Parametrization of the paxakos algorithm.
type Communicator: Communicator<Node = NodeOf<Self::Invocation>, RoundNum = RoundNumOf<Self::Invocation>, CoordNum = CoordNumOf<Self::Invocation>, LogEntry = LogEntryOf<Self::Invocation>, Error = CommunicationErrorOf<Self::Invocation>, Yea = YeaOf<Self::Invocation>, Nay = NayOf<Self::Invocation>, Abstain = AbstainOf<Self::Invocation>>
type Communicator: Communicator<Node = NodeOf<Self::Invocation>, RoundNum = RoundNumOf<Self::Invocation>, CoordNum = CoordNumOf<Self::Invocation>, LogEntry = LogEntryOf<Self::Invocation>, Error = CommunicationErrorOf<Self::Invocation>, Yea = YeaOf<Self::Invocation>, Nay = NayOf<Self::Invocation>, Abstain = AbstainOf<Self::Invocation>>
Type of communicator this node uses.
type Shutdown: Shutdown<Invocation = Self::Invocation>
type Shutdown: Shutdown<Invocation = Self::Invocation>
Type that will perform graceful shutdown if requsted.
Required methods
fn status(&self) -> NodeStatus
fn status(&self) -> NodeStatus
Node’s current status.
fn participation(&self) -> Participation<RoundNumOf<Self>>
fn participation(&self) -> Participation<RoundNumOf<Self>>
Node’s current mode of participation.
fn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<Self>>
fn poll_events(&mut self, cx: &mut Context<'_>) -> Poll<EventFor<Self>>
Polls the node’s event stream.
It is important to poll the node’s event stream because it implicitly drives the actions that keep the node up to date.
fn handle(&self) -> NodeHandle<Self::Invocation>
fn handle(&self) -> NodeHandle<Self::Invocation>
Returns a handle for this node.
A node handle can be freely sent between threads.
fn prepare_snapshot(
&self
) -> LocalBoxFuture<'static, Result<SnapshotFor<Self>, PrepareSnapshotError>>
fn prepare_snapshot(
&self
) -> LocalBoxFuture<'static, Result<SnapshotFor<Self>, PrepareSnapshotError>>
Requests that snapshot of the node’s current state be taken.
fn affirm_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), AffirmSnapshotError>>
fn affirm_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), AffirmSnapshotError>>
Affirms that the given snapshot was written to persistent storage.
Currently does nothing.
fn install_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), InstallSnapshotError>>
fn install_snapshot(
&self,
snapshot: SnapshotFor<Self>
) -> LocalBoxFuture<'static, Result<(), InstallSnapshotError>>
Requests that given snapshot be installed.
fn read_stale(
&self
) -> LocalBoxFuture<'_, Result<Arc<StateOf<Self>>, Disoriented>>
fn read_stale(
&self
) -> LocalBoxFuture<'_, Result<Arc<StateOf<Self>>, Disoriented>>
Reads the node’s current state.
As the name implies the state may be stale, i.e. other node’s may have advanced the shared state without this node being aware.
fn append<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'_, AppendResultFor<Self, A, R>> where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
fn append<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'_, AppendResultFor<Self, A, R>> where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
Appends applicable
to the shared log.
fn append_static<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'static, StaticAppendResultFor<Self, A, R>> where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
R::StaticError: From<ShutDownOr<R::Error>>,
fn append_static<A, P, R>(
&self,
applicable: A,
args: P
) -> LocalBoxFuture<'static, StaticAppendResultFor<Self, A, R>> where
A: ApplicableTo<StateOf<Self>> + 'static,
P: Into<AppendArgs<Self::Invocation, R>>,
R: RetryPolicy<Invocation = Self::Invocation>,
R::StaticError: From<ShutDownOr<R::Error>>,
Appends applicable
to the shared log.