Enum Commit

Source
pub enum Commit {
    V0(CommitV0),
}
Expand description

Commit Object

Variants§

Implementations§

Source§

impl Commit

Source

pub fn new( author_privkey: &PrivKey, author_pubkey: &PubKey, overlay: OverlayId, branch: BranchId, quorum: QuorumType, deps: Vec<ObjectRef>, ndeps: Vec<ObjectRef>, acks: Vec<ObjectRef>, nacks: Vec<ObjectRef>, files: Vec<ObjectRef>, nfiles: Vec<ObjectRef>, metadata: Vec<u8>, body: ObjectRef, ) -> Result<Commit, NgError>

New commit

Source

pub fn new_with_body_acks_deps_and_save( author_privkey: &PrivKey, author_pubkey: &PubKey, branch: BranchId, quorum: QuorumType, deps: Vec<ObjectRef>, acks: Vec<ObjectRef>, body: CommitBody, store: &Store, ) -> Result<Commit, NgError>

New commit with a body. everything is saved

Source

pub fn new_with_body_and_save( author_privkey: &PrivKey, author_pubkey: &PubKey, branch: BranchId, quorum: QuorumType, deps: Vec<ObjectRef>, ndeps: Vec<ObjectRef>, acks: Vec<ObjectRef>, nacks: Vec<ObjectRef>, files: Vec<ObjectRef>, nfiles: Vec<ObjectRef>, metadata: Vec<u8>, body: CommitBody, block_size: usize, store: &Store, ) -> Result<Commit, NgError>

New commit with a body. everything is saved

Source

pub fn reference(&self) -> Option<ObjectRef>

Source

pub fn save( &mut self, block_size: usize, store: &Store, ) -> Result<ObjectRef, StorageError>

Source

pub fn blocks(&self) -> &Vec<BlockId>

Source

pub fn load( commit_ref: ObjectRef, store: &Store, with_body: bool, ) -> Result<Commit, CommitLoadError>

Load commit from store

Source

pub fn load_body(&self, store: &Store) -> Result<&CommitBody, CommitLoadError>

Load commit body from store

Source

pub fn header_id(&self) -> &Option<ObjectId>

Get ID of header Object

Source

pub fn sig(&self) -> &Sig

Get commit signature

Source

pub fn author(&self) -> &Digest

Get author (a UserId)

Source

pub fn timestamp(&self) -> Timestamp

Source

pub fn final_consistency(&self) -> bool

Source

pub fn get_type(&self) -> Option<CommitType>

Source

pub fn get_signature_reference(&self) -> Option<ObjectRef>

Source

pub fn as_info(&self, repo: &Repo) -> CommitInfo

Source

pub fn branch(&self) -> &BranchId

Get branch ID this commit is about

Source

pub fn header(&self) -> &Option<CommitHeader>

Get commit header

Source

pub fn body_ref(&self) -> &ObjectRef

Source

pub fn content_v0(&self) -> &CommitContentV0

Get commit content V0

Source

pub fn quorum_type(&self) -> &QuorumType

Get quorum_type

Source

pub fn content(&self) -> &CommitContent

Get commit content

Source

pub fn body(&self) -> Option<&CommitBody>

Source

pub fn owners_signature_required( &self, store: &Store, ) -> Result<bool, CommitLoadError>

Source

pub fn is_root_commit_of_branch(&self) -> bool

This commit is the first one in the branch (doesn’t have any ACKs nor Nacks)

Source

pub fn acks(&self) -> Vec<ObjectRef>

Get acks (that have both an ID in the header and a key in the header_keys)

Source

pub fn acks_ids(&self) -> Vec<ObjectId>

Get acks (that have an ID in the header, without checking if there is a key for them in the header_keys) if there is no header, returns an empty vec

Source

pub fn deps_ids(&self) -> Vec<ObjectId>

Get deps (that have an ID in the header, without checking if there is a key for them in the header_keys) if there is no header, returns an empty vec

Source

pub fn files(&self) -> Vec<ObjectRef>

Get files

Source

pub fn deps(&self) -> Vec<ObjectRef>

Get deps (that have both an ID in the header and a key in the header_keys)

Source

pub fn direct_causal_past(&self) -> Vec<ObjectRef>

Get all commits that are in the direct causal past of the commit (acks and nacks) only returns objectRefs that have both an ID from header and a KEY from header_keys (they all have a key)

Source

pub fn direct_causal_past_ids(&self) -> HashSet<ObjectId>

Source

pub fn verify_sig(&self, repo: &Repo) -> Result<(), CommitVerifyError>

Verify commit signature

Source

pub fn verify_perm(&self, repo: &Repo) -> Result<(), NgError>

Verify commit permissions

Source

pub fn verify_perm_creation( &self, user: Option<&Digest>, ) -> Result<&Digest, NgError>

Source

pub fn verify_full_object_refs_of_branch_at_commit( &self, store: &Store, ) -> Result<Vec<ObjectId>, CommitLoadError>

Verify if the commit’s body and its direct_causal_past, and recursively all their refs are available in the store returns a list of all the ObjectIds that have been visited (only commits in the DAG) or a list of missing blocks

Source

pub fn verify(&self, repo: &Repo) -> Result<(), NgError>

Verify signature, permissions, and full causal past

Trait Implementations§

Source§

impl Clone for Commit

Source§

fn clone(&self) -> Commit

Returns a copy 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 Commit

Source§

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

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

impl<'de> Deserialize<'de> for Commit

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 Display for Commit

Source§

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

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

impl IObject for Commit

Source§

fn id(&self) -> Option<ObjectId>

Get ID of including Object, only available if the Commit was loaded from store or saved

Source§

fn key(&self) -> Option<SymKey>

Get key of including Object only available if the Commit was loaded from store or saved

Source§

fn block_ids(&self) -> Vec<BlockId>

Source§

impl PartialEq for Commit

Source§

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

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 Commit

Source§

impl StructuralPartialEq for Commit

Auto Trait Implementations§

§

impl !Freeze for Commit

§

impl RefUnwindSafe for Commit

§

impl Send for Commit

§

impl Sync for Commit

§

impl Unpin for Commit

§

impl UnwindSafe for Commit

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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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