hashiverse-server-lib 1.0.6

Hashiverse server library — production node implementation (HTTPS + ACME, Kademlia routing, DDoS protection, on-disk persistence) for your open-source decentralized X/Twitter replacement.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::environment::environment::Environment;

/// Build the `environment` subtree: counts and sizes of persisted state.
///
/// Counts come from the underlying store (cheap — fjall keyspace length, no
/// scan). `post_bundle_total_bytes` comes from the running counter the quota
/// system already maintains, so this is also O(1).
pub fn environment_stats_subtree(environment: &Environment) -> serde_json::Value {
    let post_bundle_count = environment.post_bundle_count().unwrap_or(0);
    let post_bundle_feedback_count = environment.post_bundle_feedback_count().unwrap_or(0);
    let post_bundle_total_bytes = environment.post_bundle_total_bytes();

    serde_json::json!({
        "post_bundle_count": post_bundle_count,
        "post_bundle_feedback_count": post_bundle_feedback_count,
        "post_bundle_total_bytes": post_bundle_total_bytes,
    })
}