[−][src]Struct gossip::GossipService
The gossip service
Implementations
impl<T> GossipService<T> where
T: UpdateHandler + 'static + Send,
[src]
T: UpdateHandler + 'static + Send,
pub fn new(
address: SocketAddr,
peer_sampling_config: PeerSamplingConfig,
gossip_config: GossipConfig
) -> GossipService<T>
[src]
address: SocketAddr,
peer_sampling_config: PeerSamplingConfig,
gossip_config: GossipConfig
) -> GossipService<T>
Creates a new gossiping service
Arguments
address
- Socket address of the nodepeer_sampling_config
- Configuration for peer sampling, see PeerSamplingConfiggossip_config
- Configuration for gossiping, see GossipConfig
pub fn new_with_defaults(address: SocketAddr) -> Self
[src]
pub fn address(&self) -> &SocketAddr
[src]
Returns the node address
pub fn peers(&self) -> Vec<Peer>
[src]
Returns a list of the node's peer
pub fn start(
&mut self,
peer_sampling_init: Box<dyn FnOnce() -> Option<Vec<Peer>>>,
update_handler: Box<T>
) -> Result<(), Box<dyn Error>>
[src]
&mut self,
peer_sampling_init: Box<dyn FnOnce() -> Option<Vec<Peer>>>,
update_handler: Box<T>
) -> Result<(), Box<dyn Error>>
Starts the gossip protocol and related threads
Arguments
peer_sampling_init
- Closure for retrieving the address of the first peer to contactupdate_handler
- Application callback for receiving new updates
pub fn submit(&self, bytes: Vec<u8>) -> Result<(), Box<dyn Error>>
[src]
pub fn is_active(&self, bytes: Vec<u8>) -> bool
[src]
pub fn is_expired(&self, bytes: Vec<u8>) -> bool
[src]
pub fn shutdown(&mut self) -> Result<(), Box<dyn Error>>
[src]
Terminates the gossip protocol and related threads
Auto Trait Implementations
impl<T> !RefUnwindSafe for GossipService<T>
[src]
impl<T> Send for GossipService<T> where
T: Send,
[src]
T: Send,
impl<T> Sync for GossipService<T> where
T: Send,
[src]
T: Send,
impl<T> Unpin for GossipService<T>
[src]
impl<T> !UnwindSafe for GossipService<T>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,