pub struct Written {
pub key: String,
pub event: String,
pub lamport: u64,
pub durability: Durability,
}Expand description
What an operation wrote, as its answer to the caller. Every mesh operation is an event appended to this runtime’s journal, and the caller is handed the three facts it cannot work out for itself: the mesh-wide key of the thing it created, the event that says so, and the Lamport stamp that places it against everyone else’s events.
The key is what a later operation is addressed by — a claim is released by the key its acquisition returned, never by the local name it was given — and the stamp is what a caller waiting for a peer to catch up compares against.
use majordomus_cli::mesh::cooperation::Written;
use majordomus_cli::mesh::journal::{ClaimMode, Durability, SessionInfo};
let session = SessionInfo::named("s1", "cli");
let written: Written = cooperation
.claim(&session, vec!["docs".into()], None, ClaimMode::Advisory, None)
.unwrap();
assert!(written.lamport > 0, "placed against every other runtime's events");
assert_eq!(written.durability, Durability::Memory, "this journal has no file");
// and the key it returned is how the claim is addressed from here on
cooperation.release(&written.key).unwrap();Fields§
§key: String<stream>/<local id> of what was created or changed.
event: String<stream>/<seq> of the event that says so.
lamport: u64The event’s Lamport stamp.
durability: DurabilityWhether the event reached this machine’s disk: synced, memory (a journal with no
file, by configuration), or not_durable — held and replicated to peers, not on disk
here, and not acknowledged as durable. unknown from an executable that predates it.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Written
impl<'de> Deserialize<'de> for Written
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>,
Source§impl JsonSchema for Written
impl JsonSchema for Written
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 more