docs/generated/contracts.mdgenerated from code

Reference · 2 min read

frontier

Contracts: frontier.

Source: crates/lvcs-doc/src/frontier.rs.

ruston main
1/// A frontier id (discussion:owner/586): the `HASH` of a [`Frontier`]'s canonical2/// CBOR. Written in `ID_ENCODING`; its one implementation is3/// [`Frontier::id`].4#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]5pub struct FrontierId(#[serde(with = "crate::cbor::fixed")] pub [u8; 32]);67/// One head of a document's version with the Merkle digest of the span it8/// ends (`Ledger::head_digests`, history row 457): equal pairs are equal9/// histories on every node, which a change id alone is not (a signer's10/// two changes may share one).11#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]12pub struct HeadDigest {13    pub id: ChangeId,14    #[serde(with = "crate::cbor::fixed")]15    pub digest: [u8; 32],16}1718/// One path of a frontier: the file there (its namespace node, which a19/// later rename never changes, so a frontier names exact files) and its20/// document's heads with their digests.21#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]22pub struct FrontierEntry {23    pub file: FileId,24    pub heads: Vec<HeadDigest>,25}2627/// A frontier (discussion:owner/586): each file's entry, by path. Its map28/// is shared, so a clone is a pointer copy (orchestrator/18): channels hold29/// one frontier in many places, and a whole tree each time would make30/// memory grow with history (discussion:owner/632). One reserved key,31/// `.lvcs/tree` (`NAMESPACE_ADDRESS`, which no path can be), holds the32/// heads of the namespace document, so a frontier names the tree's33/// history and its id moves with it (discussion:owner/694); its `file`34/// is [`Frontier::TREE_FILE`]. A frontier built before the namespace had35/// heads holds none.36#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]37#[serde(transparent)]38pub struct Frontier {39    pub docs: std::sync::Arc<BTreeMap<String, FrontierEntry>>,40}4142/// Whether one set of a document's heads descends from another (43/// discussion:owner/120): `Yes` when every change in `from` is in the history of `heads`44/// (equal sets included), `No` when one is not, and `Unknown` when the45/// document lacks a change of either set, so a node short of history46/// decides nothing until sync supplies it.47#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]48pub enum Descent {49    Yes,50    No,51    Unknown,52}