pub enum Commit {
V0(CommitV0),
}
Expand description
Commit Object
Variants§
Implementations§
Source§impl Commit
impl Commit
Sourcepub 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>
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
Sourcepub 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>
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
Sourcepub 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>
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
pub fn reference(&self) -> Option<ObjectRef>
pub fn save( &mut self, block_size: usize, store: &Store, ) -> Result<ObjectRef, StorageError>
pub fn blocks(&self) -> &Vec<BlockId> ⓘ
Sourcepub fn load(
commit_ref: ObjectRef,
store: &Store,
with_body: bool,
) -> Result<Commit, CommitLoadError>
pub fn load( commit_ref: ObjectRef, store: &Store, with_body: bool, ) -> Result<Commit, CommitLoadError>
Load commit from store
Sourcepub fn load_body(&self, store: &Store) -> Result<&CommitBody, CommitLoadError>
pub fn load_body(&self, store: &Store) -> Result<&CommitBody, CommitLoadError>
Load commit body from store
Get author (a UserId)
pub fn timestamp(&self) -> Timestamp
pub fn final_consistency(&self) -> bool
pub fn get_type(&self) -> Option<CommitType>
pub fn get_signature_reference(&self) -> Option<ObjectRef>
pub fn as_info(&self, repo: &Repo) -> CommitInfo
Sourcepub fn header(&self) -> &Option<CommitHeader>
pub fn header(&self) -> &Option<CommitHeader>
Get commit header
pub fn body_ref(&self) -> &ObjectRef
Sourcepub fn content_v0(&self) -> &CommitContentV0
pub fn content_v0(&self) -> &CommitContentV0
Get commit content V0
Sourcepub fn quorum_type(&self) -> &QuorumType
pub fn quorum_type(&self) -> &QuorumType
Get quorum_type
Sourcepub fn content(&self) -> &CommitContent
pub fn content(&self) -> &CommitContent
Get commit content
pub fn body(&self) -> Option<&CommitBody>
pub fn owners_signature_required( &self, store: &Store, ) -> Result<bool, CommitLoadError>
Sourcepub fn is_root_commit_of_branch(&self) -> bool
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)
Sourcepub fn acks(&self) -> Vec<ObjectRef> ⓘ
pub fn acks(&self) -> Vec<ObjectRef> ⓘ
Get acks (that have both an ID in the header and a key in the header_keys)
Sourcepub fn acks_ids(&self) -> Vec<ObjectId> ⓘ
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
Sourcepub fn deps_ids(&self) -> Vec<ObjectId> ⓘ
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
Sourcepub fn deps(&self) -> Vec<ObjectRef> ⓘ
pub fn deps(&self) -> Vec<ObjectRef> ⓘ
Get deps (that have both an ID in the header and a key in the header_keys)
Sourcepub fn direct_causal_past(&self) -> Vec<ObjectRef> ⓘ
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)
pub fn direct_causal_past_ids(&self) -> HashSet<ObjectId>
Sourcepub fn verify_sig(&self, repo: &Repo) -> Result<(), CommitVerifyError>
pub fn verify_sig(&self, repo: &Repo) -> Result<(), CommitVerifyError>
Verify commit signature
pub fn verify_perm_creation( &self, user: Option<&Digest>, ) -> Result<&Digest, NgError>
Sourcepub fn verify_full_object_refs_of_branch_at_commit(
&self,
store: &Store,
) -> Result<Vec<ObjectId>, CommitLoadError>
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