Skip to main content

Entry

Struct Entry 

Source
pub struct Entry {
    pub hash: Hash,
    pub payload: GraphOp,
    pub next: Vec<Hash>,
    pub refs: Vec<Hash>,
    pub clock: LamportClock,
    pub author: String,
    pub signature: Option<Vec<u8>>,
}
Expand description

A single entry in the Merkle-DAG operation log.

Each entry is content-addressed: hash = BLAKE3(msgpack(signable_content)). The hash covers the payload, causal links, and clock — NOT the hash itself.

Fields§

§hash: Hash

BLAKE3 hash of the signable content (payload + next + refs + clock + author)

§payload: GraphOp

The graph mutation (or genesis ontology definition)

§next: Vec<Hash>

Causal predecessors — hashes of the DAG heads at time of write

§refs: Vec<Hash>

Reserved. Currently unused (always empty). Part of the hash computation for wire format stability. May be used for skip-list traversal in future versions.

§clock: LamportClock

Lamport clock at time of creation

§author: String

Author instance identifier

§signature: Option<Vec<u8>>

D-027: ed25519 signature over the hash bytes (64 bytes). None for unsigned (pre-v0.3) entries.

Implementations§

Source§

impl Entry

Source

pub fn new( payload: GraphOp, next: Vec<Hash>, refs: Vec<Hash>, clock: LamportClock, author: impl Into<String>, ) -> Self

Create a new unsigned entry with computed BLAKE3 hash.

Source

pub fn is_signed(&self) -> bool

Check whether this entry has a signature.

Source

pub fn verify_hash(&self) -> bool

Verify that the stored hash matches the content.

Source

pub fn to_bytes(&self) -> Vec<u8>

Serialize the entry to MessagePack bytes.

Uses expect() because msgpack serialization of #[derive(Serialize)] structs with known types cannot fail in practice. Converting to Result would add API complexity for a failure mode that doesn’t exist.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Self, Error>

Deserialize an entry from MessagePack bytes.

Source

pub fn hash_hex(&self) -> String

Return the hash as a hex string (for display/debugging).

Trait Implementations§

Source§

impl Clone for Entry

Source§

fn clone(&self) -> Entry

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Entry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Entry

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Entry

Source§

fn eq(&self, other: &Entry) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for Entry

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Entry

Auto Trait Implementations§

§

impl Freeze for Entry

§

impl RefUnwindSafe for Entry

§

impl Send for Entry

§

impl Sync for Entry

§

impl Unpin for Entry

§

impl UnsafeUnpin for Entry

§

impl UnwindSafe for Entry

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,