pub struct HandoverBody {
pub id: String,
pub task: Option<String>,
pub issue: Option<String>,
pub milestone: Option<String>,
pub branch: Option<String>,
pub head: Option<String>,
pub created_at: Option<String>,
pub name: Option<String>,
pub body: String,
}Expand description
A handover as the mesh carries it: the record’s facts and its body, bounded.
What travels is the writing, plus the few facts that let a receiver file it — the task, the issue, the branch, the commit. No path of the author’s disk is among them, because the checkout that reads this is somewhere else and a path from another machine is at best noise. Identity is the digest of the body, so a handover published twice by a retry or by two runtimes is one handover everywhere.
use majordomus_cli::mesh::journal::HandoverBody;
let body = "# Objective\nship the mesh\n".to_string();
let handover = HandoverBody {
id: HandoverBody::digest_of(&body),
task: Some("t-1".into()),
issue: Some("#184".into()),
milestone: None,
branch: Some("feature/mesh-cooperation".into()),
head: None,
created_at: None,
name: None,
body,
};
assert_eq!(handover.id, HandoverBody::digest_of(&handover.body));
let wire = serde_json::to_value(&handover).unwrap();
assert!(wire.get("milestone").is_none(), "what it does not say is omitted");Fields§
§id: StringThe content digest (32 hex): the same handover published twice is one handover.
task: Option<String>The task the handover closes or continues.
issue: Option<String>The issue it belongs to.
milestone: Option<String>The milestone it belongs to.
branch: Option<String>The branch it was written on.
head: Option<String>The commit it was written at.
created_at: Option<String>When it was written, RFC 3339, as its author’s clock said.
name: Option<String>The record’s file name at its origin, informational.
body: StringThe Markdown body (# Objective, # Current State, # Next Action, …).
Implementations§
Source§impl HandoverBody
impl HandoverBody
Sourcepub fn digest_of(body: &str) -> String
pub fn digest_of(body: &str) -> String
The content digest a handover body is identified by. Identifying a handover by what it says rather than by who published it is what makes publication idempotent across the mesh: a retry, a relay and a second publisher all produce the same id, and the fold keeps one handover with one list of consumers.
use majordomus_cli::mesh::journal::HandoverBody;
let body = "# Objective\nship\n";
assert_eq!(HandoverBody::digest_of(body).len(), 32);
assert_eq!(HandoverBody::digest_of(body), HandoverBody::digest_of(body));
assert_ne!(HandoverBody::digest_of(body), HandoverBody::digest_of("# Objective\nwait\n"));Trait Implementations§
Source§impl Clone for HandoverBody
impl Clone for HandoverBody
Source§fn clone(&self) -> HandoverBody
fn clone(&self) -> HandoverBody
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HandoverBody
impl Debug for HandoverBody
Source§impl<'de> Deserialize<'de> for HandoverBody
impl<'de> Deserialize<'de> for HandoverBody
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>,
impl Eq for HandoverBody
Source§impl JsonSchema for HandoverBody
impl JsonSchema for HandoverBody
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for HandoverBody
impl PartialEq for HandoverBody
Source§fn eq(&self, other: &HandoverBody) -> bool
fn eq(&self, other: &HandoverBody) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for HandoverBody
impl Serialize for HandoverBody
impl StructuralPartialEq for HandoverBody
Auto Trait Implementations§
impl Freeze for HandoverBody
impl RefUnwindSafe for HandoverBody
impl Send for HandoverBody
impl Sync for HandoverBody
impl Unpin for HandoverBody
impl UnsafeUnpin for HandoverBody
impl UnwindSafe for HandoverBody
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
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
key and return true if they are equal.