pub struct Commit {
pub cid: Option<Cid>,
pub parents: Vec<Cid>,
pub root: Cid,
pub message: String,
pub author: Author,
pub timestamp: u64,
pub metadata: HashMap<String, String>,
}Expand description
IPLD schema for a commit in the version control system
Fields§
§cid: Option<Cid>CID of the commit (computed from serialized commit, not included in serialization)
parents: Vec<Cid>CIDs of parent commits (empty for initial commit)
root: CidCID of the root block this commit points to (e.g., model weights)
message: StringCommit message describing the changes
Author of the commit
timestamp: u64Unix timestamp when commit was created
metadata: HashMap<String, String>Optional metadata (e.g., training config, hyperparameters)
Implementations§
Source§impl Commit
impl Commit
Sourcepub fn new(
parents: Vec<Cid>,
root: Cid,
message: String,
author: Author,
metadata: HashMap<String, String>,
) -> Self
pub fn new( parents: Vec<Cid>, root: Cid, message: String, author: Author, metadata: HashMap<String, String>, ) -> Self
Create a new commit
Sourcepub fn from_block(block: &Block) -> Result<Self>
pub fn from_block(block: &Block) -> Result<Self>
Create a commit from a block
Sourcepub fn is_initial(&self) -> bool
pub fn is_initial(&self) -> bool
Check if this is an initial commit (no parents)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Commit
impl<'de> Deserialize<'de> for Commit
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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