pub struct LooseCommit { /* private fields */ }Expand description
The smallest unit of metadata in a Sedimentree.
It includes metadata about the payload blob, plus pointers to any (causal) parents.
The sedimentree_id field cryptographically binds the commit to a specific
document, preventing replay attacks across documents.
The head field is a user-supplied opaque identifier for this commit.
It is not computed by Sedimentree — the caller provides it at construction
time (e.g., from an Automerge ChangeHash). This is the identity used for
DAG traversal, fragment boundaries, and sync.
§Wire Format Limits
The parent count is encoded as a u8, limiting commits to 255 parents.
Implementations§
Source§impl LooseCommit
impl LooseCommit
Sourcepub fn new(
sedimentree_id: SedimentreeId,
head: CommitId,
parents: BTreeSet<CommitId>,
blob_meta: BlobMeta,
) -> Result<Self, InvalidLooseCommit>
pub fn new( sedimentree_id: SedimentreeId, head: CommitId, parents: BTreeSet<CommitId>, blob_meta: BlobMeta, ) -> Result<Self, InvalidLooseCommit>
Constructor for a LooseCommit.
§Errors
Returns InvalidLooseCommit if there are more than MAX_PARENTS parents.
Sourcepub const fn sedimentree_id(&self) -> SedimentreeId
pub const fn sedimentree_id(&self) -> SedimentreeId
The SedimentreeId this commit belongs to.
Trait Implementations§
Source§impl Clone for LooseCommit
impl Clone for LooseCommit
Source§impl Debug for LooseCommit
impl Debug for LooseCommit
Source§impl DecodeFields for LooseCommit
impl DecodeFields for LooseCommit
Source§const MIN_SIGNED_SIZE: usize = CODEC_MIN_SIZE
const MIN_SIGNED_SIZE: usize = CODEC_MIN_SIZE
Minimum valid size of the full signed message
(schema + issuer + fields + signature), for early rejection.
Source§fn try_decode_fields(buf: &[u8]) -> Result<(Self, usize), DecodeError>
fn try_decode_fields(buf: &[u8]) -> Result<(Self, usize), DecodeError>
Decode type-specific fields from the buffer. Read more
Source§impl EncodeFields for LooseCommit
impl EncodeFields for LooseCommit
Source§fn encode_fields(&self, buf: &mut Vec<u8>)
fn encode_fields(&self, buf: &mut Vec<u8>)
Encode type-specific fields to the buffer. Read more
Source§fn fields_size(&self) -> usize
fn fields_size(&self) -> usize
Size of the encoded fields (for buffer pre-allocation).
Source§fn signed_size(&self) -> usize
fn signed_size(&self) -> usize
Total size of the signed message. Read more
impl Eq for LooseCommit
Source§impl HasBlobMeta for LooseCommit
impl HasBlobMeta for LooseCommit
Source§impl Hash for LooseCommit
impl Hash for LooseCommit
Source§impl Ord for LooseCommit
impl Ord for LooseCommit
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for LooseCommit
impl PartialEq for LooseCommit
Source§impl PartialOrd for LooseCommit
impl PartialOrd for LooseCommit
Source§impl Schema for LooseCommit
impl Schema for LooseCommit
Source§const PREFIX: [u8; 2] = schema::SEDIMENTREE_PREFIX
const PREFIX: [u8; 2] = schema::SEDIMENTREE_PREFIX
2-byte protocol prefix (e.g.,
SEDIMENTREE_PREFIX or SUBDUCTION_PREFIX).impl StructuralPartialEq for LooseCommit
Auto Trait Implementations§
impl Freeze for LooseCommit
impl RefUnwindSafe for LooseCommit
impl Send for LooseCommit
impl Sync for LooseCommit
impl Unpin for LooseCommit
impl UnsafeUnpin for LooseCommit
impl UnwindSafe for LooseCommit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more