pub trait KitsuneP2pEventHandler: GhostHandler<KitsuneP2pEvent> {
    // Required methods
    fn handle_put_agent_info_signed(
        &mut self,
        input: PutAgentInfoSignedEvt
    ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>;
    fn handle_query_agents(
        &mut self,
        input: QueryAgentsEvt
    ) -> Result<MustBoxFuture<'static, Result<Vec<AgentInfoSigned, Global>, KitsuneP2pError>>, KitsuneP2pError>;
    fn handle_query_peer_density(
        &mut self,
        space: Arc<KitsuneSpace, Global>,
        dht_arc: DhtArc
    ) -> Result<MustBoxFuture<'static, Result<PeerView, KitsuneP2pError>>, KitsuneP2pError>;
    fn handle_call(
        &mut self,
        space: Arc<KitsuneSpace, Global>,
        to_agent: Arc<KitsuneAgent, Global>,
        payload: Vec<u8, Global>
    ) -> Result<MustBoxFuture<'static, Result<Vec<u8, Global>, KitsuneP2pError>>, KitsuneP2pError>;
    fn handle_notify(
        &mut self,
        space: Arc<KitsuneSpace, Global>,
        to_agent: Arc<KitsuneAgent, Global>,
        payload: Vec<u8, Global>
    ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>;
    fn handle_receive_ops(
        &mut self,
        space: Arc<KitsuneSpace, Global>,
        ops: Vec<Arc<KitsuneOpData, Global>, Global>,
        context: Option<FetchContext>
    ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>;
    fn handle_query_op_hashes(
        &mut self,
        input: QueryOpHashesEvt
    ) -> Result<MustBoxFuture<'static, Result<Option<(Vec<Arc<KitsuneOpHash, Global>, Global>, RangeInclusive<Timestamp>)>, KitsuneP2pError>>, KitsuneP2pError>;
    fn handle_fetch_op_data(
        &mut self,
        input: FetchOpDataEvt
    ) -> Result<MustBoxFuture<'static, Result<Vec<(Arc<KitsuneOpHash, Global>, Arc<KitsuneOpData, Global>), Global>, KitsuneP2pError>>, KitsuneP2pError>;
    fn handle_sign_network_data(
        &mut self,
        input: SignNetworkDataEvt
    ) -> Result<MustBoxFuture<'static, Result<KitsuneSignature, KitsuneP2pError>>, KitsuneP2pError>;
}
Expand description

The KitsuneP2pEvent stream allows handling events generated from the KitsuneP2p actor.

Required Methods§

source

fn handle_put_agent_info_signed( &mut self, input: PutAgentInfoSignedEvt ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>

We need to store signed agent info.

source

fn handle_query_agents( &mut self, input: QueryAgentsEvt ) -> Result<MustBoxFuture<'static, Result<Vec<AgentInfoSigned, Global>, KitsuneP2pError>>, KitsuneP2pError>

We need to get previously stored agent info.

source

fn handle_query_peer_density( &mut self, space: Arc<KitsuneSpace, Global>, dht_arc: DhtArc ) -> Result<MustBoxFuture<'static, Result<PeerView, KitsuneP2pError>>, KitsuneP2pError>

Query the peer density of a space for a given [DhtArc].

source

fn handle_call( &mut self, space: Arc<KitsuneSpace, Global>, to_agent: Arc<KitsuneAgent, Global>, payload: Vec<u8, Global> ) -> Result<MustBoxFuture<'static, Result<Vec<u8, Global>, KitsuneP2pError>>, KitsuneP2pError>

We are receiving a request from a remote node.

source

fn handle_notify( &mut self, space: Arc<KitsuneSpace, Global>, to_agent: Arc<KitsuneAgent, Global>, payload: Vec<u8, Global> ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>

We are receiving a notification from a remote node.

source

fn handle_receive_ops( &mut self, space: Arc<KitsuneSpace, Global>, ops: Vec<Arc<KitsuneOpData, Global>, Global>, context: Option<FetchContext> ) -> Result<MustBoxFuture<'static, Result<(), KitsuneP2pError>>, KitsuneP2pError>

We have received ops to be integrated, either through gossip or publish.

source

fn handle_query_op_hashes( &mut self, input: QueryOpHashesEvt ) -> Result<MustBoxFuture<'static, Result<Option<(Vec<Arc<KitsuneOpHash, Global>, Global>, RangeInclusive<Timestamp>)>, KitsuneP2pError>>, KitsuneP2pError>

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.

source

fn handle_fetch_op_data( &mut self, input: FetchOpDataEvt ) -> Result<MustBoxFuture<'static, Result<Vec<(Arc<KitsuneOpHash, Global>, Arc<KitsuneOpData, Global>), Global>, KitsuneP2pError>>, KitsuneP2pError>

Gather all op-hash data for a list of op-hashes from our implementor.

source

fn handle_sign_network_data( &mut self, input: SignNetworkDataEvt ) -> Result<MustBoxFuture<'static, Result<KitsuneSignature, KitsuneP2pError>>, KitsuneP2pError>

Request that our implementor sign some data on behalf of an agent.

Implementors§