pub struct ClaimBrief {
pub key: String,
pub session: String,
pub issue: Option<String>,
pub intent: Option<String>,
pub paths: usize,
pub mode: ClaimMode,
pub acquired_lamport: u64,
}Expand description
One live claim, told briefly: whose it is, what it is for and how many paths it holds,
with its intent cut to SUMMARY_TEXT characters — enough to know whom to ask.
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, ClaimBrief};
let summary = summarize(&state, &[]);
let newest: &ClaimBrief = summary.runtimes[0].newest_claim.as_ref().unwrap();
assert_eq!((newest.issue.as_deref(), newest.paths), (Some("#1"), 1));Fields§
§key: String<stream>/<claim>.
session: StringThe holding session’s key.
issue: Option<String>The issue it is for.
intent: Option<String>What it is for, cut to SUMMARY_TEXT characters.
paths: usizeHow many paths it claims.
mode: ClaimModeExclusive or advisory.
acquired_lamport: u64The Lamport stamp of the acquisition.
Trait Implementations§
Source§impl Clone for ClaimBrief
impl Clone for ClaimBrief
Source§fn clone(&self) -> ClaimBrief
fn clone(&self) -> ClaimBrief
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 ClaimBrief
impl Debug for ClaimBrief
Source§impl<'de> Deserialize<'de> for ClaimBrief
impl<'de> Deserialize<'de> for ClaimBrief
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 ClaimBrief
Source§impl JsonSchema for ClaimBrief
impl JsonSchema for ClaimBrief
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 ClaimBrief
impl PartialEq for ClaimBrief
Source§fn eq(&self, other: &ClaimBrief) -> bool
fn eq(&self, other: &ClaimBrief) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ClaimBrief
impl Serialize for ClaimBrief
impl StructuralPartialEq for ClaimBrief
Auto Trait Implementations§
impl Freeze for ClaimBrief
impl RefUnwindSafe for ClaimBrief
impl Send for ClaimBrief
impl Sync for ClaimBrief
impl Unpin for ClaimBrief
impl UnsafeUnpin for ClaimBrief
impl UnwindSafe for ClaimBrief
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.