pub struct NetworkController {
conf: Arc<Config>,
node: PublicKey,
parties: HashMap<PublicKey, Role>,
tx: UnboundedSender<Command>,
next_slot: Sender<Slot>,
lower_bound: Slot,
task: JoinHandle<()>,
metrics: Arc<dyn Metrics>,
}Fields§
§conf: Arc<Config>§node: PublicKey§parties: HashMap<PublicKey, Role>§tx: UnboundedSender<Command>§next_slot: Sender<Slot>§lower_bound: Slot§task: JoinHandle<()>§metrics: Arc<dyn Metrics>Implementations§
Source§impl NetworkController
impl NetworkController
pub fn config(&self) -> &Config
Sourcepub fn unicast(
&mut self,
s: Slot,
to: PublicKey,
msg: Vec<u8>,
) -> Result<(), NetworkError>
pub fn unicast( &mut self, s: Slot, to: PublicKey, msg: Vec<u8>, ) -> Result<(), NetworkError>
Send a message to a party, identified by the given public key.
Sourcepub fn broadcast(&mut self, s: Slot, msg: Vec<u8>) -> Result<(), NetworkError>
pub fn broadcast(&mut self, s: Slot, msg: Vec<u8>) -> Result<(), NetworkError>
Send a message to all parties.
Sourcepub fn multicast<P>(
&mut self,
s: Slot,
to: P,
msg: Vec<u8>,
) -> Result<(), NetworkError>where
P: IntoIterator<Item = PublicKey>,
pub fn multicast<P>(
&mut self,
s: Slot,
to: P,
msg: Vec<u8>,
) -> Result<(), NetworkError>where
P: IntoIterator<Item = PublicKey>,
Send a message to several parties, identified by their public keys.
Sourcepub fn send(&mut self, cmd: SendCommand) -> Result<(), NetworkError>
pub fn send(&mut self, cmd: SendCommand) -> Result<(), NetworkError>
General send operation, supporting custom retry policies.
Sourcepub fn add_peers<P>(&mut self, r: Role, peers: P) -> Result<(), NetworkError>
pub fn add_peers<P>(&mut self, r: Role, peers: P) -> Result<(), NetworkError>
Add the given peers to the network.
Sourcepub fn remove_peers<P>(&mut self, peers: P) -> Result<(), NetworkError>where
P: IntoIterator<Item = PublicKey>,
pub fn remove_peers<P>(&mut self, peers: P) -> Result<(), NetworkError>where
P: IntoIterator<Item = PublicKey>,
Remove the given peers from the network.
Sourcepub fn assign_peers<P>(&mut self, r: Role, peers: P) -> Result<(), NetworkError>where
P: IntoIterator<Item = PublicKey>,
pub fn assign_peers<P>(&mut self, r: Role, peers: P) -> Result<(), NetworkError>where
P: IntoIterator<Item = PublicKey>,
Assign the given role to the given peers.
pub fn gc(&mut self, s: Slot) -> Result<(), NetworkError>
Sourcepub fn shutdown(
&mut self,
) -> Result<impl Future<Output = ()> + use<>, NetworkError>
pub fn shutdown( &mut self, ) -> Result<impl Future<Output = ()> + use<>, NetworkError>
Trigger network shutdown.
The returned future will resolve once the server task finished.
Sourcefn length_check(&self, msg: &[u8]) -> Result<(), NetworkError>
fn length_check(&self, msg: &[u8]) -> Result<(), NetworkError>
Check the number of message bytes does not exceed the configured maximum.
Sourcefn lt_lower_bound(&self, s: Slot) -> bool
fn lt_lower_bound(&self, s: Slot) -> bool
Check if the given slot is less than our lower bound.
Trait Implementations§
Source§impl Debug for NetworkController
impl Debug for NetworkController
Auto Trait Implementations§
impl Freeze for NetworkController
impl !RefUnwindSafe for NetworkController
impl Send for NetworkController
impl Sync for NetworkController
impl Unpin for NetworkController
impl UnsafeUnpin for NetworkController
impl !UnwindSafe for NetworkController
Blanket Implementations§
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
Mutably borrows from an owned value. Read more