pub struct RuntimeSummary {
pub runtime: String,
pub liveness: StreamLiveness,
pub last_beat_ms: Option<u64>,
pub sessions: SessionCounts,
pub claims: ClaimCounts,
pub newest_claim: Option<ClaimBrief>,
}Expand description
One runtime, counted: its liveness and beat, its sessions and claims by standing, and its newest live claim. The summary lists these, the living runtimes first.
use std::sync::Arc;
use majordomus_cli::mesh::identity::NodeIdentity;
use majordomus_cli::mesh::journal::{ClaimMode, EventBody, Journal, SessionInfo, StreamLiveness};
use majordomus_cli::mesh::state::fold;
let j = Journal::open(Arc::new(NodeIdentity::ephemeral().unwrap()), "0000000000000001",
"repo".into(), None).unwrap();
j.append_own(EventBody::SessionOpened { info: SessionInfo::named("s1", "claude-code") })
.unwrap();
for (claim, path) in [("c1", "apps/a"), ("c2", "apps/b")] {
j.append_own(EventBody::ClaimAcquired { claim: claim.into(), session: "s1".into(),
scope: vec![path.into()], intent: Some("work".into()), mode: ClaimMode::Exclusive,
issue: Some("#1".into()) }).unwrap();
}
j.append_own(EventBody::ClaimReleased { claim: "c1".into() }).unwrap();
let state = fold(&j.events(), &|_| StreamLiveness::Own);
use majordomus_cli::mesh::page::{summarize, RuntimeSummary};
let summary = summarize(&state, &[]);
let runtime: &RuntimeSummary = &summary.runtimes[0];
assert_eq!((runtime.sessions.active, runtime.claims.held, runtime.claims.released), (1, 1, 1));Fields§
§runtime: String<node>-<runtime>.
liveness: StreamLivenessOwn, live or expired.
last_beat_ms: Option<u64>Milliseconds since its beat last rose, on this runtime’s clock.
sessions: SessionCountsIts sessions by standing.
claims: ClaimCountsIts claims by standing.
newest_claim: Option<ClaimBrief>Its newest live claim.
Trait Implementations§
Source§impl Clone for RuntimeSummary
impl Clone for RuntimeSummary
Source§fn clone(&self) -> RuntimeSummary
fn clone(&self) -> RuntimeSummary
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RuntimeSummary
impl Debug for RuntimeSummary
Source§impl<'de> Deserialize<'de> for RuntimeSummary
impl<'de> Deserialize<'de> for RuntimeSummary
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for RuntimeSummary
Source§impl JsonSchema for RuntimeSummary
impl JsonSchema for RuntimeSummary
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Returns a string that uniquely identifies the schema produced by this type. Read more
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Generates a JSON Schema for this type. Read more
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
Whether JSON Schemas generated for this type should be included directly in parent schemas,
rather than being re-used where possible using the
$ref keyword. Read moreSource§impl PartialEq for RuntimeSummary
impl PartialEq for RuntimeSummary
Source§fn eq(&self, other: &RuntimeSummary) -> bool
fn eq(&self, other: &RuntimeSummary) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for RuntimeSummary
impl Serialize for RuntimeSummary
impl StructuralPartialEq for RuntimeSummary
Auto Trait Implementations§
impl Freeze for RuntimeSummary
impl RefUnwindSafe for RuntimeSummary
impl Send for RuntimeSummary
impl Sync for RuntimeSummary
impl Unpin for RuntimeSummary
impl UnsafeUnpin for RuntimeSummary
impl UnwindSafe for RuntimeSummary
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.