Trait kitsune_p2p::actor::KitsuneP2pHandler [−][src]
pub trait KitsuneP2pHandler: GhostHandler<KitsuneP2p> {
fn handle_list_transport_bindings(
&mut self
) -> KitsuneP2pHandlerResult<Vec<Url2>>;
fn handle_join(
&mut self,
space: Arc<KitsuneSpace>,
agent: Arc<KitsuneAgent>
) -> KitsuneP2pHandlerResult<()>;
fn handle_leave(
&mut self,
space: Arc<KitsuneSpace>,
agent: Arc<KitsuneAgent>
) -> KitsuneP2pHandlerResult<()>;
fn handle_rpc_single(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
payload: Vec<u8>,
timeout_ms: Option<u64>
) -> KitsuneP2pHandlerResult<Vec<u8>>;
fn handle_rpc_multi(
&mut self,
input: RpcMulti
) -> KitsuneP2pHandlerResult<Vec<RpcMultiResponse>>;
fn handle_broadcast(
&mut self,
space: Arc<KitsuneSpace>,
basis: Arc<KitsuneBasis>,
timeout: KitsuneTimeout,
payload: Vec<u8>
) -> KitsuneP2pHandlerResult<()>;
fn handle_targeted_broadcast(
&mut self,
space: Arc<KitsuneSpace>,
agents: Vec<Arc<KitsuneAgent>>,
timeout: KitsuneTimeout,
payload: Vec<u8>,
drop_at_limit: bool
) -> KitsuneP2pHandlerResult<()>;
fn handle_new_integrated_data(
&mut self,
space: Arc<KitsuneSpace>
) -> KitsuneP2pHandlerResult<()>;
fn handle_authority_for_hash(
&mut self,
space: Arc<KitsuneSpace>,
basis: Arc<KitsuneBasis>
) -> KitsuneP2pHandlerResult<bool>;
}
Expand description
The KitsuneP2pSender allows async remote-control of the KitsuneP2p actor.
Required methods
fn handle_list_transport_bindings(
&mut self
) -> KitsuneP2pHandlerResult<Vec<Url2>>
fn handle_list_transport_bindings(
&mut self
) -> KitsuneP2pHandlerResult<Vec<Url2>>
Get the calculated transport bindings.
fn handle_join(
&mut self,
space: Arc<KitsuneSpace>,
agent: Arc<KitsuneAgent>
) -> KitsuneP2pHandlerResult<()>
fn handle_join(
&mut self,
space: Arc<KitsuneSpace>,
agent: Arc<KitsuneAgent>
) -> KitsuneP2pHandlerResult<()>
Announce a space/agent pair on this network.
fn handle_leave(
&mut self,
space: Arc<KitsuneSpace>,
agent: Arc<KitsuneAgent>
) -> KitsuneP2pHandlerResult<()>
fn handle_leave(
&mut self,
space: Arc<KitsuneSpace>,
agent: Arc<KitsuneAgent>
) -> KitsuneP2pHandlerResult<()>
Withdraw this space/agent pair from this network.
fn handle_rpc_single(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
payload: Vec<u8>,
timeout_ms: Option<u64>
) -> KitsuneP2pHandlerResult<Vec<u8>>
fn handle_rpc_single(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
payload: Vec<u8>,
timeout_ms: Option<u64>
) -> KitsuneP2pHandlerResult<Vec<u8>>
Make a request of a single remote agent, expecting a response. The remote side will receive a “Call” event.
fn handle_rpc_multi(
&mut self,
input: RpcMulti
) -> KitsuneP2pHandlerResult<Vec<RpcMultiResponse>>
fn handle_rpc_multi(
&mut self,
input: RpcMulti
) -> KitsuneP2pHandlerResult<Vec<RpcMultiResponse>>
Make a request to multiple destination agents - awaiting/aggregating the responses. The remote sides will see these messages as “Call” events.
fn handle_broadcast(
&mut self,
space: Arc<KitsuneSpace>,
basis: Arc<KitsuneBasis>,
timeout: KitsuneTimeout,
payload: Vec<u8>
) -> KitsuneP2pHandlerResult<()>
fn handle_broadcast(
&mut self,
space: Arc<KitsuneSpace>,
basis: Arc<KitsuneBasis>,
timeout: KitsuneTimeout,
payload: Vec<u8>
) -> KitsuneP2pHandlerResult<()>
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.
fn handle_targeted_broadcast(
&mut self,
space: Arc<KitsuneSpace>,
agents: Vec<Arc<KitsuneAgent>>,
timeout: KitsuneTimeout,
payload: Vec<u8>,
drop_at_limit: bool
) -> KitsuneP2pHandlerResult<()>
fn handle_targeted_broadcast(
&mut self,
space: Arc<KitsuneSpace>,
agents: Vec<Arc<KitsuneAgent>>,
timeout: KitsuneTimeout,
payload: Vec<u8>,
drop_at_limit: bool
) -> KitsuneP2pHandlerResult<()>
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.
fn handle_new_integrated_data(
&mut self,
space: Arc<KitsuneSpace>
) -> KitsuneP2pHandlerResult<()>
fn handle_new_integrated_data(
&mut self,
space: Arc<KitsuneSpace>
) -> KitsuneP2pHandlerResult<()>
New data has been integrated and is ready for gossiping.
Check if an agent is an authority for a hash.