Skip to main content

SelectiveCommit

Struct SelectiveCommit 

Source
pub struct SelectiveCommit {
    pub source_pool: SqlitePool,
    pub target_pool: SqlitePool,
    pub store: Arc<BranchStore>,
    pub workspace_id: Uuid,
}
Expand description

Applies cherry-picked entity changes from a source branch into a target branch.

§Example

let committer = SelectiveCommit::new(source_pool, target_pool, store);
let result = committer.commit(&cherry).await?;

Fields§

§source_pool: SqlitePool

The pool connected to the source branch database.

§target_pool: SqlitePool

The pool connected to the target branch database.

§store: Arc<BranchStore>

Shared branch registry for commit log recording.

§workspace_id: Uuid

Workspace identifier used to scope branch registry lookups.

Implementations§

Source§

impl SelectiveCommit

Source

pub fn new( source_pool: SqlitePool, target_pool: SqlitePool, store: Arc<BranchStore>, workspace_id: Uuid, ) -> Self

Creates a new selective commit executor with pre-opened pools.

Source

pub async fn from_store( store: Arc<BranchStore>, source_id: Uuid, target_id: Uuid, workspace_id: Uuid, ) -> BranchResult<Self>

Opens a SelectiveCommit from branch metadata (opens pools internally).

Source

pub async fn commit(&self, cherry: &CherryPick) -> BranchResult<CommitResult>

Applies a cherry-pick to the target branch within a single transaction.

Steps:

  1. Validate the selection via CommitValidator
  2. Open a write transaction on target
  3. Fetch and upsert selected entities (field-filtered if requested)
  4. Record a commit log entry
  5. Return CommitResult
Source

pub async fn commit_all( &self, source_branch_id: Uuid, target_branch_id: Uuid, ) -> BranchResult<CommitResult>

Promotes all divergent entities from source_branch_id into target_branch_id.

This is a full merge-commit that uses all entity types.

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more