holochain_types/network.rs
1//! Types for interacting with Holochain's network layer.
2
3use holo_hash::DnaHash;
4use serde_derive::{Deserialize, Serialize};
5
6/// Request network metrics from Kitsune2.
7#[derive(Debug, Clone, Default, Serialize, Deserialize)]
8pub struct Kitsune2NetworkMetricsRequest {
9 /// Request metrics for a specific DNA.
10 ///
11 /// If this is blank, then metrics for all DNAs will be returned.
12 pub dna_hash: Option<DnaHash>,
13
14 /// Include DHT summary in the response.
15 pub include_dht_summary: bool,
16}
17
18/// Network metrics from Kitsune2.
19#[derive(Debug, Clone, Serialize, Deserialize)]
20pub struct Kitsune2NetworkMetrics {
21 /// A summary of the fetch queue.
22 ///
23 /// The fetch queue is used to retrieve op data based on op ids that have been discovered
24 /// through publish or gossip.
25 pub fetch_state_summary: kitsune2_api::FetchStateSummary,
26 /// A summary of the gossip state.
27 ///
28 /// This includes both live gossip rounds and metrics about peers that we've gossiped with.
29 /// Optionally, it can include a summary of the DHT state as Kitsune2 sees it.
30 pub gossip_state_summary: kitsune2_api::GossipStateSummary,
31
32 /// A summary of the state of each local agent.
33 pub local_agents: Vec<LocalAgentSummary>,
34}
35
36/// Summary of a local agent's network state.
37#[derive(Debug, Clone, Serialize, Deserialize)]
38pub struct LocalAgentSummary {
39 /// The agent's public key.
40 pub agent: holo_hash::AgentPubKey,
41
42 /// The current storage arc that the agent is declaring.
43 ///
44 /// This is the arc that the agent is claiming that it is an authority for.
45 pub storage_arc: kitsune2_api::DhtArc,
46
47 /// The target arc that the agent is trying to achieve as a storage arc.
48 ///
49 /// This is not declared to other peers on the network. It is used during gossip to try to sync
50 /// ops in the target arc. Once the DHT state appears to be in sync with the target arc, the
51 /// storage arc can be updated towards the target arc.
52 pub target_arc: kitsune2_api::DhtArc,
53}