Node

Struct Node 

Source
pub struct Node {
    pub left: Option<Cid>,
    pub entries: Vec<Entry>,
}
Expand description

MST node data schema

Fields§

§left: Option<Cid>

link to sub-tree Node on a lower level and with all keys sorting before keys at this node

§entries: Vec<Entry>

ordered list of TreeEntry objects

atproto MSTs have a fanout of 4, so there can be max 4 entries.

Implementations§

Source§

impl Node

Source

pub fn could_be(bytes: impl AsRef<[u8]>) -> bool

test if a block could possibly be a node

we can’t eagerly decode records except where we’re sure they cannot be an mst node (and even then we can only attempt) because you can’t know with certainty what a block is supposed to be without actually walking the tree.

so if a block could be a node, any record converter must postpone processing. if it turns out it happens to be a very node-looking record, well, sorry, it just has to only be processed later when that’s known.

Source

pub fn is_empty(&self) -> bool

Check if a node has any entries

An empty repository with no records is represented as a single MST node with an empty array of entries. This is the only situation in which a tree may contain an empty leaf node which does not either contain keys (“entries”) or point to a sub-tree containing entries.

TODO: to me this is slightly unclear with respect to l (ask someone). …is that what “The top of the tree must not be a an empty node which only points to a sub-tree.” is referring to?

Trait Implementations§

Source§

impl Debug for Node

Source§

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

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

impl<'de> Deserialize<'de> for Node

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 Node

Source§

fn eq(&self, other: &Node) -> 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 StructuralPartialEq for Node

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnwindSafe for Node

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