Development Documentation (main branch) - For stable release docs, see docs.rs/eidetica

ENTRY_VERSION

Constant ENTRY_VERSION 

Source
pub const ENTRY_VERSION: u8 = 0;
Expand description

The fundamental unit of data in Eidetica, representing a finalized, immutable Database Entry.

An Entry represents a snapshot of data within a Database and potentially one or more named Stores. It is content-addressable, meaning its ID is a cryptographic hash of its contents. Entries form a Merkle-DAG (Directed Acyclic Graph) structure through parent references.

§Authentication

Each entry contains authentication information with:

  • sig: Base64-encoded cryptographic signature (optional, allows unsigned entry creation)
  • key: Authentication key reference path, either:
    • A direct key ID defined in this tree’s _settings.auth
    • A delegation path as an ordered list of {"key": "delegated_tree_1", "tips": ["A", "B"]} where the last element must contain only a "key" field

§Immutability

Entry instances are designed to be immutable once created. To create or modify entries, use the EntryBuilder struct, which provides a mutable API for constructing entries. Once an entry is built, its content cannot be changed, and its ID is deterministic based on its content.

§Example


// Create a new root entry (standalone entry that starts a new DAG)
let entry = Entry::root_builder()
    .set_subtree_data("users", r#"{"user1":"data"}"#)
    .build()
    .expect("Entry should build successfully");

// Access entry data
let id = entry.id(); // Calculate content-addressable ID
let user_data = entry.data("users").unwrap();

§Builders

To create an Entry, use the associated EntryBuilder. The preferred way to get an EntryBuilder is via the static methods Entry::builder() for regular entries or Entry::root_builder() for new top-level tree roots.

// For a regular entry:
let builder = Entry::builder(root_id);

// For a new top-level tree root:
let root_builder = Entry::root_builder();

The current entry format version. v0 indicates this is an unstable protocol subject to breaking changes.