Trait kitsune_p2p::KitsuneHost
source · pub trait KitsuneHost: 'static + Send + Sync + Debug {
Show 15 methods
// Required methods
fn block(&self, input: Block) -> KitsuneHostResult<'_, ()>;
fn unblock(&self, input: Block) -> KitsuneHostResult<'_, ()>;
fn is_blocked(
&self,
input: BlockTargetId,
timestamp: Timestamp
) -> KitsuneHostResult<'_, bool>;
fn get_agent_info_signed(
&self,
input: GetAgentInfoSignedEvt
) -> KitsuneHostResult<'_, Option<AgentInfoSigned>>;
fn remove_agent_info_signed(
&self,
input: GetAgentInfoSignedEvt
) -> KitsuneHostResult<'_, bool>;
fn peer_extrapolated_coverage(
&self,
space: Arc<KitsuneSpace>,
dht_arc_set: DhtArcSet
) -> KitsuneHostResult<'_, Vec<f64>>;
fn query_region_set(
&self,
space: Arc<KitsuneSpace>,
dht_arc_set: Arc<DhtArcSet>
) -> KitsuneHostResult<'_, RegionSetLtcs>;
fn query_size_limited_regions(
&self,
space: Arc<KitsuneSpace>,
size_limit: u32,
regions: Vec<Region>
) -> KitsuneHostResult<'_, Vec<Region>>;
fn query_op_hashes_by_region(
&self,
space: Arc<KitsuneSpace>,
region: RegionCoords
) -> KitsuneHostResult<'_, Vec<OpHashSized>>;
fn record_metrics(
&self,
space: Arc<KitsuneSpace>,
records: Vec<MetricRecord>
) -> KitsuneHostResult<'_, ()>;
fn get_topology(
&self,
space: Arc<KitsuneSpace>
) -> KitsuneHostResult<'_, Topology>;
fn op_hash(&self, op_data: KOpData) -> KitsuneHostResult<'_, KOpHash>;
// Provided methods
fn check_op_data(
&self,
space: Arc<KitsuneSpace>,
op_hash_list: Vec<KOpHash>,
_context: Option<FetchContext>
) -> KitsuneHostResult<'_, Vec<bool>> { ... }
fn lair_tag(&self) -> Option<Arc<str>> { ... }
fn lair_client(&self) -> Option<LairClient> { ... }
}
Expand description
The interface to be implemented by the host, which handles various requests for data
Required Methods§
sourcefn block(&self, input: Block) -> KitsuneHostResult<'_, ()>
fn block(&self, input: Block) -> KitsuneHostResult<'_, ()>
We are requesting a block.
sourcefn unblock(&self, input: Block) -> KitsuneHostResult<'_, ()>
fn unblock(&self, input: Block) -> KitsuneHostResult<'_, ()>
We are requesting an unblock.
sourcefn is_blocked(
&self,
input: BlockTargetId,
timestamp: Timestamp
) -> KitsuneHostResult<'_, bool>
fn is_blocked( &self, input: BlockTargetId, timestamp: Timestamp ) -> KitsuneHostResult<'_, bool>
We want to know if a target is blocked.
sourcefn get_agent_info_signed(
&self,
input: GetAgentInfoSignedEvt
) -> KitsuneHostResult<'_, Option<AgentInfoSigned>>
fn get_agent_info_signed( &self, input: GetAgentInfoSignedEvt ) -> KitsuneHostResult<'_, Option<AgentInfoSigned>>
We need to get previously stored agent info.
sourcefn remove_agent_info_signed(
&self,
input: GetAgentInfoSignedEvt
) -> KitsuneHostResult<'_, bool>
fn remove_agent_info_signed( &self, input: GetAgentInfoSignedEvt ) -> KitsuneHostResult<'_, bool>
Remove an agent info from storage
sourcefn peer_extrapolated_coverage(
&self,
space: Arc<KitsuneSpace>,
dht_arc_set: DhtArcSet
) -> KitsuneHostResult<'_, Vec<f64>>
fn peer_extrapolated_coverage( &self, space: Arc<KitsuneSpace>, dht_arc_set: DhtArcSet ) -> KitsuneHostResult<'_, Vec<f64>>
Extrapolated Peer Coverage.
sourcefn query_region_set(
&self,
space: Arc<KitsuneSpace>,
dht_arc_set: Arc<DhtArcSet>
) -> KitsuneHostResult<'_, RegionSetLtcs>
fn query_region_set( &self, space: Arc<KitsuneSpace>, dht_arc_set: Arc<DhtArcSet> ) -> KitsuneHostResult<'_, RegionSetLtcs>
Query aggregate dht op data to form an LTCS set of region data.
sourcefn query_size_limited_regions(
&self,
space: Arc<KitsuneSpace>,
size_limit: u32,
regions: Vec<Region>
) -> KitsuneHostResult<'_, Vec<Region>>
fn query_size_limited_regions( &self, space: Arc<KitsuneSpace>, size_limit: u32, regions: Vec<Region> ) -> KitsuneHostResult<'_, Vec<Region>>
Given an input list of regions, return a list of equal or greater length
such that each region’s size is less than the size_limit
, by recursively
subdividing regions which are over the size limit.
sourcefn query_op_hashes_by_region(
&self,
space: Arc<KitsuneSpace>,
region: RegionCoords
) -> KitsuneHostResult<'_, Vec<OpHashSized>>
fn query_op_hashes_by_region( &self, space: Arc<KitsuneSpace>, region: RegionCoords ) -> KitsuneHostResult<'_, Vec<OpHashSized>>
Get all op hashes within a region
sourcefn record_metrics(
&self,
space: Arc<KitsuneSpace>,
records: Vec<MetricRecord>
) -> KitsuneHostResult<'_, ()>
fn record_metrics( &self, space: Arc<KitsuneSpace>, records: Vec<MetricRecord> ) -> KitsuneHostResult<'_, ()>
Record a set of metric records.
sourcefn get_topology(
&self,
space: Arc<KitsuneSpace>
) -> KitsuneHostResult<'_, Topology>
fn get_topology( &self, space: Arc<KitsuneSpace> ) -> KitsuneHostResult<'_, Topology>
Get the quantum Topology associated with this Space.
sourcefn op_hash(&self, op_data: KOpData) -> KitsuneHostResult<'_, KOpHash>
fn op_hash(&self, op_data: KOpData) -> KitsuneHostResult<'_, KOpHash>
Hashing function to get an op_hash from op_data.
Provided Methods§
sourcefn check_op_data(
&self,
space: Arc<KitsuneSpace>,
op_hash_list: Vec<KOpHash>,
_context: Option<FetchContext>
) -> KitsuneHostResult<'_, Vec<bool>>
fn check_op_data( &self, space: Arc<KitsuneSpace>, op_hash_list: Vec<KOpHash>, _context: Option<FetchContext> ) -> KitsuneHostResult<'_, Vec<bool>>
Check which hashes we have data for.
sourcefn lair_tag(&self) -> Option<Arc<str>>
fn lair_tag(&self) -> Option<Arc<str>>
Get the lair “tag” identifying the id seed to use for crypto signing. (this is currently only used in tx5/WebRTC if that feature is enabled.)
sourcefn lair_client(&self) -> Option<LairClient>
fn lair_client(&self) -> Option<LairClient>
Get the lair client to use as the backend keystore. (this is currently only used in tx5/WebRTC if that feature is enabled.)