pub trait PeerStore:
'static
+ Send
+ Sync
+ Debug {
// Required methods
fn insert(
&self,
agent_list: Vec<Arc<AgentInfoSigned>>,
) -> BoxFut<'_, K2Result<()>>;
fn get(
&self,
agent: AgentId,
) -> BoxFut<'_, K2Result<Option<Arc<AgentInfoSigned>>>>;
fn get_all(&self) -> BoxFut<'_, K2Result<Vec<Arc<AgentInfoSigned>>>>;
fn get_by_overlapping_storage_arc(
&self,
arc: DhtArc,
) -> BoxFut<'_, K2Result<Vec<Arc<AgentInfoSigned>>>>;
fn get_near_location(
&self,
loc: u32,
limit: usize,
) -> BoxFut<'_, K2Result<Vec<Arc<AgentInfoSigned>>>>;
}Expand description
Represents the ability to store and query agents.
Required Methods§
Sourcefn insert(
&self,
agent_list: Vec<Arc<AgentInfoSigned>>,
) -> BoxFut<'_, K2Result<()>>
fn insert( &self, agent_list: Vec<Arc<AgentInfoSigned>>, ) -> BoxFut<'_, K2Result<()>>
Insert agents into the store.
Sourcefn get(
&self,
agent: AgentId,
) -> BoxFut<'_, K2Result<Option<Arc<AgentInfoSigned>>>>
fn get( &self, agent: AgentId, ) -> BoxFut<'_, K2Result<Option<Arc<AgentInfoSigned>>>>
Get an agent from the store.
Sourcefn get_all(&self) -> BoxFut<'_, K2Result<Vec<Arc<AgentInfoSigned>>>>
fn get_all(&self) -> BoxFut<'_, K2Result<Vec<Arc<AgentInfoSigned>>>>
Get all agents from the store.
Sourcefn get_by_overlapping_storage_arc(
&self,
arc: DhtArc,
) -> BoxFut<'_, K2Result<Vec<Arc<AgentInfoSigned>>>>
fn get_by_overlapping_storage_arc( &self, arc: DhtArc, ) -> BoxFut<'_, K2Result<Vec<Arc<AgentInfoSigned>>>>
Get the complete list of agents we know about that claim storage_arcs that overlap the provided storage arc. This function, provided with the storage arc of a currently active local agent, will return a list of agents with whom to gossip (and also the local agent). If there are multiple local agents in this space, you’ll need to call this function multiple times and union the results.
Sourcefn get_near_location(
&self,
loc: u32,
limit: usize,
) -> BoxFut<'_, K2Result<Vec<Arc<AgentInfoSigned>>>>
fn get_near_location( &self, loc: u32, limit: usize, ) -> BoxFut<'_, K2Result<Vec<Arc<AgentInfoSigned>>>>
Get a list of agents sorted by nearness to a target basis location. Offline (tombstoned) agents, and agents with zero arcs are not included in the returned list.