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

Entry

Struct Entry 

Source
pub struct Entry {
    pub sig: SigInfo,
    /* private fields */
}

Fields§

§sig: SigInfo

Authentication information for this entry

Implementations§

Source§

impl Entry

Source

pub fn builder(root: impl Into<ID>) -> EntryBuilder

Creates a new EntryBuilder for an entry associated with a specific tree root. This is a convenience method and preferred over calling EntryBuilder::new() directly.

§Arguments
  • root - The ID of the root Entry of the tree this entry will belong to.
Source

pub fn root_builder() -> EntryBuilder

Creates a new EntryBuilder for a top-level (root) entry for a new tree. This is a convenience method and preferred over calling EntryBuilder::new_top_level() directly.

Root entries have an empty string as their root ID and include a special ROOT subtree marker. This method is typically used when creating a new tree.

Source

pub fn id(&self) -> ID

Get the content-addressable ID of the entry.

The ID is calculated on demand by hashing the serialized JSON representation of the entry. Because entries are immutable once created and their contents are deterministically serialized, this ensures that identical entries will always have the same ID.

Source

pub fn root(&self) -> ID

Get the ID of the root Entry of the tree this entry belongs to.

Source

pub fn is_root(&self) -> bool

Check if this entry is a root entry (contains the ROOT marker and has no parents).

Root entries are the top-level entries in the database and are distinguished by:

  1. Containing a subtree with the ROOT marker
  2. Having no parent entries (they are true tree roots)

This ensures that root entries are actual starting points of trees in the DAG.

Source

pub fn in_subtree(&self, subtree_name: impl AsRef<str>) -> bool

Check if this entry contains data for a specific named subtree.

Source

pub fn in_tree(&self, tree_id: impl AsRef<str>) -> bool

Check if this entry belongs to a specific tree, identified by its root ID.

Source

pub fn subtrees(&self) -> Vec<String>

Get the names of all subtrees this entry contains data for. The names are returned in alphabetical order.

Source

pub fn metadata(&self) -> Option<&RawData>

Get the metadata associated with this entry’s tree node.

Metadata is optional information attached to an entry that is not part of the main data model and is not merged between entries.

Source

pub fn data(&self, subtree_name: impl AsRef<str>) -> Result<&RawData>

Get the RawData for a specific named subtree within this entry.

Returns an error if the subtree is not found or if the subtree exists but has no data (None).

Source

pub fn parents(&self) -> Result<Vec<ID>>

Get the IDs of the parent entries in the main tree history. The parent IDs are returned in alphabetical order.

Source

pub fn subtree_parents(&self, subtree_name: impl AsRef<str>) -> Result<Vec<ID>>

Get the IDs of the parent entries specific to a named subtree’s history. The parent IDs are returned in alphabetical order.

Source

pub fn height(&self) -> u64

Get the height of this entry in the main tree DAG.

Source

pub fn subtree_height(&self, subtree_name: impl AsRef<str>) -> Result<u64>

Get the height of this entry in a specific subtree’s DAG.

If the subtree has an explicit height (Some(h)), that value is returned. If the subtree height is None, it inherits from the main tree height.

This allows subtrees to either track independent heights (for subtrees with their own height strategy) or share the tree’s height (default).

Source

pub fn canonical_for_signing(&self) -> Self

Create a canonical representation of this entry for signing purposes.

This creates a copy of the entry with the signature field removed from auth, which is necessary for signature generation and verification. The returned entry has deterministic field ordering for consistent signatures.

Source

pub fn canonical_bytes(&self) -> Result<Vec<u8>>

Create canonical bytes for signing or ID generation.

This method serializes the entry to JSON with deterministic field ordering. For signing purposes, call canonical_for_signing() first.

Source

pub fn signing_bytes(&self) -> Result<Vec<u8>>

Create canonical bytes for signing (convenience method).

This combines canonical_for_signing() and canonical_bytes() for convenience.

Source

pub fn validate(&self) -> Result<()>

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 Eq for Entry

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 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
§

impl<T> CompatExt for T

§

fn compat(self) -> Compat<T>

Applies the [Compat] adapter by value. Read more
§

fn compat_ref(&self) -> Compat<&T>

Applies the [Compat] adapter by shared reference. Read more
§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the [Compat] adapter by mutable reference. Read more
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

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