pub struct Operation {
pub view_id: ViewId,
pub parents: Vec<OperationId>,
pub metadata: OperationMetadata,
pub commit_predecessors: Option<BTreeMap<CommitId, Vec<CommitId>>>,
}
Expand description
Represents an operation (transaction) on the repo view, just like how a Commit object represents an operation on the tree.
Operations and views are not meant to be exchanged between repos or users; they represent local state and history.
The operation history will almost always be linear. It will only have forks when parallel operations occurred. The parent is determined when the transaction starts. When the transaction commits, a lock will be taken and it will be checked that the current head of the operation graph is unchanged. If the current head has changed, there has been concurrent operation.
Fields§
§view_id: ViewId
§parents: Vec<OperationId>
§metadata: OperationMetadata
§commit_predecessors: Option<BTreeMap<CommitId, Vec<CommitId>>>
Mapping from new commit to its predecessors, or None
if predecessors
weren’t recorded when the operation was written.
commit_id: []
if the commit was newly created.commit_id: [predecessor_id, ..]
if the commit was rewritten.
This mapping preserves all transitive predecessors if a commit was
rewritten multiple times within the same transaction. For example, if
X
was rewritten as Y
, then rebased as Z
, these modifications are
recorded as {Y: [X], Z: [Y]}
.
Existing commits (including commits imported from Git) aren’t tracked even if they became visible at this operation.
Implementations§
Trait Implementations§
Source§impl ContentHash for Operation
impl ContentHash for Operation
impl Eq for Operation
impl StructuralPartialEq for Operation
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnwindSafe for Operation
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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