Trait holochain::prelude::kitsune_p2p::actor::KitsuneP2pHandler
source · pub trait KitsuneP2pHandler: GhostHandler<KitsuneP2p> {
// Required methods
fn handle_list_transport_bindings(
&mut self
) -> Result<MustBoxFuture<'static, Result<Vec<Url2, Global>, KitsuneP2pError>>, KitsuneP2pError>;
fn handle_join(
&mut self,
space: Arc<KitsuneSpace, Global>,
agent: Arc<KitsuneAgent, Global>,
maybe_agent_info: Option<AgentInfoSigned>,
initial_arc: Option<DhtArc>
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>;
fn handle_leave(
&mut self,
space: Arc<KitsuneSpace, Global>,
agent: Arc<KitsuneAgent, Global>
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>;
fn handle_rpc_single(
&mut self,
space: Arc<KitsuneSpace, Global>,
to_agent: Arc<KitsuneAgent, Global>,
payload: Vec<u8, Global>,
timeout_ms: Option<u64>
) -> Result<MustBoxFuture<'static, Result<Vec<u8, Global>, KitsuneP2pError>>, KitsuneP2pError>;
fn handle_rpc_multi(
&mut self,
input: RpcMulti
) -> Result<MustBoxFuture<'static, Result<Vec<RpcMultiResponse, Global>, KitsuneP2pError>>, KitsuneP2pError>;
fn handle_broadcast(
&mut self,
space: Arc<KitsuneSpace, Global>,
basis: Arc<KitsuneBasis, Global>,
timeout: KitsuneTimeout,
data: BroadcastData
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>;
fn handle_targeted_broadcast(
&mut self,
space: Arc<KitsuneSpace, Global>,
agents: Vec<Arc<KitsuneAgent, Global>, Global>,
timeout: KitsuneTimeout,
payload: Vec<u8, Global>,
drop_at_limit: bool
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>;
fn handle_new_integrated_data(
&mut self,
space: Arc<KitsuneSpace, Global>
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>;
fn handle_authority_for_hash(
&mut self,
space: Arc<KitsuneSpace, Global>,
basis: Arc<KitsuneBasis, Global>
) -> Result<MustBoxFuture<'static, Result<bool, KitsuneP2pError>>, KitsuneP2pError>;
fn handle_dump_network_metrics(
&mut self,
space: Option<Arc<KitsuneSpace, Global>>
) -> Result<MustBoxFuture<'static, Result<Value, KitsuneP2pError>>, KitsuneP2pError>;
fn handle_dump_network_stats(
&mut self
) -> Result<MustBoxFuture<'static, Result<Value, KitsuneP2pError>>, KitsuneP2pError>;
fn handle_get_diagnostics(
&mut self,
space: Arc<KitsuneSpace, Global>
) -> Result<MustBoxFuture<'static, Result<KitsuneDiagnostics, KitsuneP2pError>>, KitsuneP2pError>;
}
Expand description
The KitsuneP2pSender allows async remote-control of the KitsuneP2p actor.
Required Methods§
sourcefn handle_list_transport_bindings(
&mut self
) -> Result<MustBoxFuture<'static, Result<Vec<Url2, Global>, KitsuneP2pError>>, KitsuneP2pError>
fn handle_list_transport_bindings( &mut self ) -> Result<MustBoxFuture<'static, Result<Vec<Url2, Global>, KitsuneP2pError>>, KitsuneP2pError>
Get the calculated transport bindings.
sourcefn handle_join(
&mut self,
space: Arc<KitsuneSpace, Global>,
agent: Arc<KitsuneAgent, Global>,
maybe_agent_info: Option<AgentInfoSigned>,
initial_arc: Option<DhtArc>
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
fn handle_join( &mut self, space: Arc<KitsuneSpace, Global>, agent: Arc<KitsuneAgent, Global>, maybe_agent_info: Option<AgentInfoSigned>, initial_arc: Option<DhtArc> ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
Announce a space/agent pair on this network.
sourcefn handle_leave(
&mut self,
space: Arc<KitsuneSpace, Global>,
agent: Arc<KitsuneAgent, Global>
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
fn handle_leave( &mut self, space: Arc<KitsuneSpace, Global>, agent: Arc<KitsuneAgent, Global> ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
Withdraw this space/agent pair from this network.
sourcefn handle_rpc_single(
&mut self,
space: Arc<KitsuneSpace, Global>,
to_agent: Arc<KitsuneAgent, Global>,
payload: Vec<u8, Global>,
timeout_ms: Option<u64>
) -> Result<MustBoxFuture<'static, Result<Vec<u8, Global>, KitsuneP2pError>>, KitsuneP2pError>
fn handle_rpc_single( &mut self, space: Arc<KitsuneSpace, Global>, to_agent: Arc<KitsuneAgent, Global>, payload: Vec<u8, Global>, timeout_ms: Option<u64> ) -> Result<MustBoxFuture<'static, Result<Vec<u8, Global>, KitsuneP2pError>>, KitsuneP2pError>
Make a request of a single remote agent, expecting a response. The remote side will receive a “Call” event.
sourcefn handle_rpc_multi(
&mut self,
input: RpcMulti
) -> Result<MustBoxFuture<'static, Result<Vec<RpcMultiResponse, Global>, KitsuneP2pError>>, KitsuneP2pError>
fn handle_rpc_multi( &mut self, input: RpcMulti ) -> Result<MustBoxFuture<'static, Result<Vec<RpcMultiResponse, Global>, KitsuneP2pError>>, KitsuneP2pError>
Make a request to multiple destination agents - awaiting/aggregating the responses. The remote sides will see these messages as “Call” events. NOTE: We’ve currently disabled the “multi” part of this. It will still pick appropriate peers by basis, but will only make requests one at a time, returning the first success.
sourcefn handle_broadcast(
&mut self,
space: Arc<KitsuneSpace, Global>,
basis: Arc<KitsuneBasis, Global>,
timeout: KitsuneTimeout,
data: BroadcastData
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
fn handle_broadcast( &mut self, space: Arc<KitsuneSpace, Global>, basis: Arc<KitsuneBasis, Global>, timeout: KitsuneTimeout, data: BroadcastData ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
Publish data to a “neighborhood” of remote nodes surrounding the “basis” hash. This is a multi-step fire-and-forget algorithm. An Ok(()) result only means that we were able to establish at least one connection with a node in the target neighborhood. The remote sides will see these messages as “Notify” events.
sourcefn handle_targeted_broadcast(
&mut self,
space: Arc<KitsuneSpace, Global>,
agents: Vec<Arc<KitsuneAgent, Global>, Global>,
timeout: KitsuneTimeout,
payload: Vec<u8, Global>,
drop_at_limit: bool
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
fn handle_targeted_broadcast( &mut self, space: Arc<KitsuneSpace, Global>, agents: Vec<Arc<KitsuneAgent, Global>, Global>, timeout: KitsuneTimeout, payload: Vec<u8, Global>, drop_at_limit: bool ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
Broadcast data to a specific set of agents without expecting a response. An Ok(()) result only means that we were able to establish at least one connection with a node in the agent set.
sourcefn handle_new_integrated_data(
&mut self,
space: Arc<KitsuneSpace, Global>
) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
fn handle_new_integrated_data( &mut self, space: Arc<KitsuneSpace, Global> ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>
New data has been integrated and is ready for gossiping.
Check if an agent is an authority for a hash.
sourcefn handle_dump_network_metrics(
&mut self,
space: Option<Arc<KitsuneSpace, Global>>
) -> Result<MustBoxFuture<'static, Result<Value, KitsuneP2pError>>, KitsuneP2pError>
fn handle_dump_network_metrics( &mut self, space: Option<Arc<KitsuneSpace, Global>> ) -> Result<MustBoxFuture<'static, Result<Value, KitsuneP2pError>>, KitsuneP2pError>
dump network metrics
sourcefn handle_dump_network_stats(
&mut self
) -> Result<MustBoxFuture<'static, Result<Value, KitsuneP2pError>>, KitsuneP2pError>
fn handle_dump_network_stats( &mut self ) -> Result<MustBoxFuture<'static, Result<Value, KitsuneP2pError>>, KitsuneP2pError>
dump network stats
sourcefn handle_get_diagnostics(
&mut self,
space: Arc<KitsuneSpace, Global>
) -> Result<MustBoxFuture<'static, Result<KitsuneDiagnostics, KitsuneP2pError>>, KitsuneP2pError>
fn handle_get_diagnostics( &mut self, space: Arc<KitsuneSpace, Global> ) -> Result<MustBoxFuture<'static, Result<KitsuneDiagnostics, KitsuneP2pError>>, KitsuneP2pError>
Get data for diagnostics