Skip to main content

MergeSession

Struct MergeSession 

Source
pub struct MergeSession {
    pub merge_id: MergeSessionId,
    pub src_head: Option<OpId>,
    pub dst_head: Option<OpId>,
    pub lca: Option<OpId>,
    pub auto_resolved: Vec<MergeOutcome>,
    /* private fields */
}
Expand description

Stateful merge in flight. Hold one per active merge between start and commit. Sessions are not thread-safe; the HTTP wrapper is expected to wrap them in a Mutex keyed by MergeSessionId.

Fields§

§merge_id: MergeSessionId§src_head: Option<OpId>§dst_head: Option<OpId>§lca: Option<OpId>§auto_resolved: Vec<MergeOutcome>

Outcomes the engine resolved unilaterally — Both (both sides agreed) and one-sided (Src / Dst). The agent sees these for audit but doesn’t need to act on them.

Implementations§

Source§

impl MergeSession

Source

pub fn start( merge_id: impl Into<MergeSessionId>, op_log: &OpLog, src_head: Option<&OpId>, dst_head: Option<&OpId>, ) -> Result<Self>

Start a merge session. Runs the engine in crate::merge and partitions the outcomes into auto-resolved and conflicts-needing-attention.

Source

pub fn remaining_conflicts(&self) -> Vec<&ConflictRecord>

Pending conflicts (those without a non-defer resolution).

Source

pub fn resolve( &mut self, resolutions: Vec<(ConflictId, Resolution)>, ) -> Vec<ResolveVerdict>

Submit resolutions in batch. Returns one verdict per input. Accepted resolutions are recorded; rejected ones leave the previous resolution (if any) in place so partial submissions don’t clobber earlier good work.

Source

pub fn validate_resolution( &self, conflict_id: &ConflictId, resolution: &Resolution, ) -> Result<(), ResolutionRejection>

Validate a single resolution against the session’s pending conflicts. Pure (no side effects); the caller decides whether to accept.

Source

pub fn commit(self) -> Result<Vec<(ConflictId, Resolution)>, CommitError>

Finalize the merge. On success returns the resolved resolutions in conflict_id order. The caller is responsible for synthesizing the final Operation::Merge op against the store and persisting it; this function returns the engine’s view of “what to land,” not the persisted op id.

Trait Implementations§

Source§

impl Debug for MergeSession

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for MergeSession

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for MergeSession

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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, 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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,