docs/generated/contracts.mdgenerated from code
Reference · 2 min read
api-resources
Contracts: api-resources.
Read as
Source: crates/lvcs-api/src/resources.rs.
1/// `resources` (discussion:owner/303), on the host's connection: this daemon's2/// samples of the last `RESOURCE_SAMPLES_MAX` steps of3/// `RESOURCE_STEP_SECS`, oldest first, kept in memory only. A `watch` of4/// `resources` on the host's connection pushes each new sample.5#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]6pub struct ResourcesParams {}78/// `resources` result.9#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]10pub struct ResourcesResult {11 /// The step between samples, in seconds.12 pub step_secs: u64,13 #[serde(default)]14 pub samples: Vec<ResourceSample>,15}1617/// One step's use.18#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]19pub struct ResourceSample {20 /// When it was taken, in Unix milliseconds by the daemon's clock.21 pub at_ms: i64,22 /// CPU time the daemon itself used in the step, in milliseconds.23 pub cpu_ms: u64,24 /// CPU time its finished sandboxes used in the step, in milliseconds.25 pub sandbox_cpu_ms: u64,26 /// The daemon's resident memory, in bytes, where the platform says.27 #[serde(default, skip_serializing_if = "Option::is_none")]28 pub rss_bytes: Option<u64>,29 /// Each hosted project's `.lvcs/` storage, by root and kind.30 #[serde(default)]31 pub storage: Vec<StorageUse>,32}3334/// One project's bytes under `.lvcs/` of one kind: a document kind's35/// directory under `.lvcs/docs/`, or `journal` for its journal files.36#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]37pub struct StorageUse {38 pub root: String,39 pub kind: String,40 pub bytes: u64,41}4243/// Server push, JSON-RPC notification method `resources` (`watch` on the44/// host's connection): a new sample.45#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]46pub struct ResourcesPush {47 pub sub: u64,48 pub sample: ResourceSample,49}