api-resources
Source: crates/lvcs-api/src/resources.rs.
/// `resources` (decision 303), on the host's connection: this daemon's
/// samples of the last `RESOURCE_SAMPLES_MAX` steps of
/// `RESOURCE_STEP_SECS`, oldest first, kept in memory only. A `watch` of
/// `resources` on the host's connection pushes each new sample.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, JsonSchema)]
pub struct ResourcesParams {}
/// `resources` result.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ResourcesResult {
/// The step between samples, in seconds.
pub step_secs: u64,
#[serde(default)]
pub samples: Vec<ResourceSample>,
}
/// One step's use.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ResourceSample {
/// When it was taken, in Unix milliseconds by the daemon's clock.
pub at_ms: i64,
/// CPU time the daemon itself used in the step, in milliseconds.
pub cpu_ms: u64,
/// CPU time its finished sandboxes used in the step, in milliseconds.
pub sandbox_cpu_ms: u64,
/// The daemon's resident memory, in bytes, where the platform says.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub rss_bytes: Option<u64>,
/// The sandbox slots in use, of `slots` (`RUN_CONCURRENCY`).
#[serde(default)]
pub slots_busy: u32,
#[serde(default)]
pub slots: u32,
/// Each hosted project's `.lvcs/` storage, by root and kind.
#[serde(default)]
pub storage: Vec<StorageUse>,
}
/// One project's bytes under `.lvcs/` of one kind: a document kind's
/// directory under `.lvcs/docs/`, or `journal` for its journal files.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct StorageUse {
pub root: String,
pub kind: String,
pub bytes: u64,
}
/// Server push, JSON-RPC notification method `resources` (`watch` on the
/// host's connection): a new sample.
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct ResourcesPush {
pub sub: u64,
pub sample: ResourceSample,
}