pub struct Envelope {
pub seq: u64,
pub at: Instant,
pub actor: String,
pub body: Value,
}Expand description
The records a log is made of, defined in beck_host::record because a browser tab holds a log
too and an envelope has to mean the same thing in both (docs/17
§17.2). What is here is the engine: the substrates, and the contract above.
A durably logged occurrence. The fields are §3.7’s, and actor is a stable identity — never
the live Session capability or a token (F5).
Fields§
§seq: u64§at: Instant§actor: String§body: ValueThe event itself.
A Value, not a JSON tree. It was the latter through Phase 2, and the cost was paid on
every append and every read: build a serde_json::Value, serialise it to text, parse the
text, walk the tree back into a Value — four traversals and two allocations per event, at
the one point §3.7 makes serial. [beck_core::repr] is the encoding now; the JSON repr
stays for things a person reads.
Implementations§
Source§impl Envelope
impl Envelope
Sourcepub fn to_value(&self, event: Value) -> Value
pub fn to_value(&self, event: Value) -> Value
The envelope as the Envelope[Event] record a fold sees.
Sourcepub fn event(&self) -> Result<Value, Error>
pub fn event(&self) -> Result<Value, Error>
The event. Kept as a method because every caller had one and the type changed underneath them; there is nothing to decode any more.