pub trait TxSpaceHandler: TxBaseHandler {
// Required method
fn is_any_agent_at_url_blocked(&self, peer_url: &Url) -> K2Result<bool>;
// Provided methods
fn recv_space_notify(
&self,
peer: Url,
space_id: SpaceId,
data: Bytes,
) -> K2Result<()> { ... }
fn set_unresponsive(
&self,
peer: Url,
when: Timestamp,
) -> BoxFut<'_, K2Result<()>> { ... }
fn has_local_agents(&self) -> BoxFut<'_, K2Result<bool>> { ... }
}Expand description
Handler for space-related events.
Required Methods§
Provided Methods§
Sourcefn recv_space_notify(
&self,
peer: Url,
space_id: SpaceId,
data: Bytes,
) -> K2Result<()>
fn recv_space_notify( &self, peer: Url, space_id: SpaceId, data: Bytes, ) -> K2Result<()>
The sync handler for receiving notifications sent by a remote peer in reference to a particular space. If this callback returns an error, then the connection which sent the message will be closed.
Sourcefn set_unresponsive(
&self,
peer: Url,
when: Timestamp,
) -> BoxFut<'_, K2Result<()>>
fn set_unresponsive( &self, peer: Url, when: Timestamp, ) -> BoxFut<'_, K2Result<()>>
Mark a peer as unresponsive in the space’s peer meta store
Sourcefn has_local_agents(&self) -> BoxFut<'_, K2Result<bool>>
fn has_local_agents(&self) -> BoxFut<'_, K2Result<bool>>
Check if this space has any local agents joined.
This is used to prevent sending messages before a local agent has joined, which would result in an empty preflight being sent to peers, causing them to block all messages from us.
The default implementation returns true (assumes agents exist).