pub struct GossipClient { /* private fields */ }Expand description
Async HTTP-based gossip client for broadcasting challenges to peers.
Implementations§
Source§impl GossipClient
impl GossipClient
Sourcepub fn new(peer_urls: Vec<String>, timeout_secs: u64) -> GossipClient
pub fn new(peer_urls: Vec<String>, timeout_secs: u64) -> GossipClient
Create a new gossip client with the given peer URLs and timeout.
§Arguments
peer_urls- List of peer URLs for challenge distributiontimeout_secs- Request timeout in seconds
Sourcepub fn with_identity(
peer_urls: Vec<String>,
timeout_secs: u64,
identity: Arc<NodeIdentity>,
) -> GossipClient
pub fn with_identity( peer_urls: Vec<String>, timeout_secs: u64, identity: Arc<NodeIdentity>, ) -> GossipClient
Create a new gossip client with authentication enabled.
§Arguments
peer_urls- List of peer URLs for challenge distributiontimeout_secs- Request timeout in secondsidentity- Node identity for signing requests
Sourcepub async fn broadcast_challenge(
&self,
challenge_id: &str,
challenge_json: &Value,
) -> Result<usize, Box<dyn Error>>
pub async fn broadcast_challenge( &self, challenge_id: &str, challenge_json: &Value, ) -> Result<usize, Box<dyn Error>>
Sourcepub async fn register_peer(
&self,
peer_url: &str,
our_url: &str,
node_id: &str,
) -> Result<(), Box<dyn Error>>
pub async fn register_peer( &self, peer_url: &str, our_url: &str, node_id: &str, ) -> Result<(), Box<dyn Error>>
Register this node with a peer.
§Arguments
peer_url- Peer URL to register withour_url- Our node’s URLnode_id- Our node’s identifier
Sourcepub async fn health_check(&self, peer_url: &str) -> bool
pub async fn health_check(&self, peer_url: &str) -> bool
Check health status of a peer, returning false if unreachable.
§Arguments
peer_url- URL of the peer to check
Sourcepub async fn update_peers(&self, new_peers: Vec<String>)
pub async fn update_peers(&self, new_peers: Vec<String>)
Sourcepub async fn broadcast_lattice(
&self,
node_id: &str,
snapshot: &Value,
) -> Result<usize, Box<dyn Error>>
pub async fn broadcast_lattice( &self, node_id: &str, snapshot: &Value, ) -> Result<usize, Box<dyn Error>>
pub async fn broadcast_block( &self, proof: &Value, ) -> Result<usize, Box<dyn Error>>
Auto Trait Implementations§
impl !RefUnwindSafe for GossipClient
impl !UnwindSafe for GossipClient
impl Freeze for GossipClient
impl Send for GossipClient
impl Sync for GossipClient
impl Unpin for GossipClient
impl UnsafeUnpin for GossipClient
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