Struct jj_lib::transaction::Transaction
source · pub struct Transaction { /* private fields */ }Expand description
An in-memory representation of a repo and any changes being made to it.
Within the scope of a transaction, changes to the repository are made
in-memory to mut_repo and published to the repo backend when
Transaction::commit is called. When a transaction is committed, it
becomes atomically visible as an Operation in the op log that represents the
transaction itself, and as a View that represents the state of the repo
after the transaction. This is similar to how a Commit represents a change
to the contents of the repository and a Tree represents the repository’s
contents after the change. See the documentation for op_store::Operation
and op_store::View for more information.
Implementations§
source§impl Transaction
impl Transaction
pub fn new(mut_repo: MutableRepo, user_settings: &UserSettings) -> Transaction
pub fn base_repo(&self) -> &Arc<ReadonlyRepo>
pub fn set_tag(&mut self, key: String, value: String)
pub fn repo(&self) -> &MutableRepo
pub fn mut_repo(&mut self) -> &mut MutableRepo
pub fn merge_operation( &mut self, other_op: Operation, ) -> Result<(), RepoLoaderError>
pub fn set_is_snapshot(&mut self, is_snapshot: bool)
sourcepub fn commit(self, description: impl Into<String>) -> Arc<ReadonlyRepo>
pub fn commit(self, description: impl Into<String>) -> Arc<ReadonlyRepo>
Writes the transaction to the operation store and publishes it.
sourcepub fn write(self, description: impl Into<String>) -> UnpublishedOperation
pub fn write(self, description: impl Into<String>) -> UnpublishedOperation
Writes the transaction to the operation store, but does not publish it. That means that a repo can be loaded at the operation, but the operation will not be seen when loading the repo at head.
Auto Trait Implementations§
impl !Freeze for Transaction
impl !RefUnwindSafe for Transaction
impl !Send for Transaction
impl !Sync for Transaction
impl Unpin for Transaction
impl !UnwindSafe for Transaction
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> 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