Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 26 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/consensus/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use std::sync::Arc;

use k256::SecretKey;
use pluto_core::{deadline::DeadlinerHandle, types::Duty};
use pluto_core::{deadline::DeadlinerHandle, gater::DutyGaterFn, types::Duty};
use tokio::sync::mpsc;
use tokio_util::sync::CancellationToken;

Expand Down Expand Up @@ -42,7 +42,7 @@ pub struct Config {
/// Expired-duty receiver paired with `deadliner`.
pub expired_rx: mpsc::Receiver<Duty>,
/// Duty admission gate.
pub duty_gater: qbft::DutyGater,
pub duty_gater: DutyGaterFn,
/// External message broadcaster.
pub broadcaster: qbft::Broadcaster,
/// Consensus debugger.
Expand Down
8 changes: 3 additions & 5 deletions crates/consensus/src/qbft/component.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use crate::{
use pluto_core::{
corepb::v1::{consensus as pbconsensus, core as pbcore, priority as pbpriority},
deadline::{AddOutcome, DeadlinerHandle},
gater::DutyGaterFn,
qbft,
types::{Duty, DutyType},
};
Expand All @@ -41,9 +42,6 @@ pub type Broadcaster = Arc<
+ 'static,
>;

/// Duty admission gate.
pub type DutyGater = Arc<dyn Fn(&Duty) -> bool + Send + Sync + 'static>;

/// Sink for completed sniffer instances.
pub type SnifferSink = Arc<dyn Fn(pbconsensus::SniffedConsensusInstance) + Send + Sync + 'static>;

Expand Down Expand Up @@ -79,7 +77,7 @@ pub struct Config {
/// Expired-duty receiver paired with `deadliner`.
pub expired_rx: mpsc::Receiver<Duty>,
/// Duty admission gate.
pub duty_gater: DutyGater,
pub duty_gater: DutyGaterFn,
/// External message broadcaster.
pub broadcaster: Broadcaster,
/// Completed sniffer sink.
Expand Down Expand Up @@ -266,7 +264,7 @@ pub struct Consensus {
privkey: SecretKey,
deadliner: DeadlinerHandle,
expired_rx: Mutex<Option<mpsc::Receiver<Duty>>>,
duty_gater: DutyGater,
duty_gater: DutyGaterFn,
broadcaster: Broadcaster,
sniffer: SnifferSink,
timer_func: RoundTimerFunc,
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/src/qbft/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pub(crate) mod definition;
pub(crate) mod runner;

pub use component::{
BroadcastResult, Broadcaster, Config, Consensus, DutyGater, Error, Peer, Result, SnifferSink,
BroadcastResult, Broadcaster, Config, Consensus, Error, Peer, Result, SnifferSink,
SubscriberResult,
};
pub use runner::{Error as RunnerError, Result as RunnerResult};
Expand Down
Loading
Loading