Trait kitsune_p2p::event::KitsuneP2pEventHandler [−][src]
pub trait KitsuneP2pEventHandler: GhostHandler<KitsuneP2pEvent> {
fn handle_put_agent_info_signed(
&mut self,
input: PutAgentInfoSignedEvt
) -> KitsuneP2pEventHandlerResult<()>;
fn handle_get_agent_info_signed(
&mut self,
input: GetAgentInfoSignedEvt
) -> KitsuneP2pEventHandlerResult<Option<AgentInfoSigned>>;
fn handle_query_agents(
&mut self,
input: QueryAgentsEvt
) -> KitsuneP2pEventHandlerResult<Vec<AgentInfoSigned>>;
fn handle_query_peer_density(
&mut self,
space: Arc<KitsuneSpace>,
dht_arc: DhtArc
) -> KitsuneP2pEventHandlerResult<PeerDensity>;
fn handle_put_metric_datum(
&mut self,
datum: MetricDatum
) -> KitsuneP2pEventHandlerResult<()>;
fn handle_query_metrics(
&mut self,
query: MetricQuery
) -> KitsuneP2pEventHandlerResult<MetricQueryAnswer>;
fn handle_call(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
from_agent: Arc<KitsuneAgent>,
payload: Vec<u8>
) -> KitsuneP2pEventHandlerResult<Vec<u8>>;
fn handle_notify(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
from_agent: Arc<KitsuneAgent>,
payload: Vec<u8>
) -> KitsuneP2pEventHandlerResult<()>;
fn handle_gossip(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
ops: Vec<(Arc<KitsuneOpHash>, Vec<u8>)>
) -> KitsuneP2pEventHandlerResult<()>;
fn handle_query_op_hashes(
&mut self,
input: QueryOpHashesEvt
) -> KitsuneP2pEventHandlerResult<Option<(Vec<Arc<KitsuneOpHash>>, TimeWindow)>>;
fn handle_fetch_op_data(
&mut self,
input: FetchOpDataEvt
) -> KitsuneP2pEventHandlerResult<Vec<(Arc<KitsuneOpHash>, Vec<u8>)>>;
fn handle_sign_network_data(
&mut self,
input: SignNetworkDataEvt
) -> KitsuneP2pEventHandlerResult<KitsuneSignature>;
}
Expand description
The KitsuneP2pEvent stream allows handling events generated from the KitsuneP2p actor.
Required methods
fn handle_put_agent_info_signed(
&mut self,
input: PutAgentInfoSignedEvt
) -> KitsuneP2pEventHandlerResult<()>
fn handle_put_agent_info_signed(
&mut self,
input: PutAgentInfoSignedEvt
) -> KitsuneP2pEventHandlerResult<()>
We need to store signed agent info.
fn handle_get_agent_info_signed(
&mut self,
input: GetAgentInfoSignedEvt
) -> KitsuneP2pEventHandlerResult<Option<AgentInfoSigned>>
fn handle_get_agent_info_signed(
&mut self,
input: GetAgentInfoSignedEvt
) -> KitsuneP2pEventHandlerResult<Option<AgentInfoSigned>>
We need to get previously stored agent info.
fn handle_query_agents(
&mut self,
input: QueryAgentsEvt
) -> KitsuneP2pEventHandlerResult<Vec<AgentInfoSigned>>
fn handle_query_agents(
&mut self,
input: QueryAgentsEvt
) -> KitsuneP2pEventHandlerResult<Vec<AgentInfoSigned>>
We need to get previously stored agent info.
fn handle_query_peer_density(
&mut self,
space: Arc<KitsuneSpace>,
dht_arc: DhtArc
) -> KitsuneP2pEventHandlerResult<PeerDensity>
fn handle_query_peer_density(
&mut self,
space: Arc<KitsuneSpace>,
dht_arc: DhtArc
) -> KitsuneP2pEventHandlerResult<PeerDensity>
Query the peer density of a space for a given [DhtArc
].
fn handle_put_metric_datum(
&mut self,
datum: MetricDatum
) -> KitsuneP2pEventHandlerResult<()>
fn handle_put_metric_datum(
&mut self,
datum: MetricDatum
) -> KitsuneP2pEventHandlerResult<()>
Record a metric datum about an agent.
fn handle_query_metrics(
&mut self,
query: MetricQuery
) -> KitsuneP2pEventHandlerResult<MetricQueryAnswer>
fn handle_query_metrics(
&mut self,
query: MetricQuery
) -> KitsuneP2pEventHandlerResult<MetricQueryAnswer>
Ask for metric data.
fn handle_call(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
from_agent: Arc<KitsuneAgent>,
payload: Vec<u8>
) -> KitsuneP2pEventHandlerResult<Vec<u8>>
fn handle_call(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
from_agent: Arc<KitsuneAgent>,
payload: Vec<u8>
) -> KitsuneP2pEventHandlerResult<Vec<u8>>
We are receiving a request from a remote node.
fn handle_notify(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
from_agent: Arc<KitsuneAgent>,
payload: Vec<u8>
) -> KitsuneP2pEventHandlerResult<()>
fn handle_notify(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
from_agent: Arc<KitsuneAgent>,
payload: Vec<u8>
) -> KitsuneP2pEventHandlerResult<()>
We are receiving a notification from a remote node.
fn handle_gossip(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
ops: Vec<(Arc<KitsuneOpHash>, Vec<u8>)>
) -> KitsuneP2pEventHandlerResult<()>
fn handle_gossip(
&mut self,
space: Arc<KitsuneSpace>,
to_agent: Arc<KitsuneAgent>,
ops: Vec<(Arc<KitsuneOpHash>, Vec<u8>)>
) -> KitsuneP2pEventHandlerResult<()>
We are receiving a dht op we may need to hold distributed via gossip.
fn handle_query_op_hashes(
&mut self,
input: QueryOpHashesEvt
) -> KitsuneP2pEventHandlerResult<Option<(Vec<Arc<KitsuneOpHash>>, TimeWindow)>>
fn handle_query_op_hashes(
&mut self,
input: QueryOpHashesEvt
) -> KitsuneP2pEventHandlerResult<Option<(Vec<Arc<KitsuneOpHash>>, TimeWindow)>>
Gather a list of op-hashes from our implementor that meet criteria. Get the oldest and newest times for ops within a time window and max number of ops.
fn handle_fetch_op_data(
&mut self,
input: FetchOpDataEvt
) -> KitsuneP2pEventHandlerResult<Vec<(Arc<KitsuneOpHash>, Vec<u8>)>>
fn handle_fetch_op_data(
&mut self,
input: FetchOpDataEvt
) -> KitsuneP2pEventHandlerResult<Vec<(Arc<KitsuneOpHash>, Vec<u8>)>>
Gather all op-hash data for a list of op-hashes from our implementor.
fn handle_sign_network_data(
&mut self,
input: SignNetworkDataEvt
) -> KitsuneP2pEventHandlerResult<KitsuneSignature>
fn handle_sign_network_data(
&mut self,
input: SignNetworkDataEvt
) -> KitsuneP2pEventHandlerResult<KitsuneSignature>
Request that our implementor sign some data on behalf of an agent.