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
impl MergeSession
Sourcepub fn start(
merge_id: impl Into<MergeSessionId>,
op_log: &OpLog,
src_head: Option<&OpId>,
dst_head: Option<&OpId>,
) -> Result<Self>
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.
Sourcepub fn remaining_conflicts(&self) -> Vec<&ConflictRecord>
pub fn remaining_conflicts(&self) -> Vec<&ConflictRecord>
Pending conflicts (those without a non-defer resolution).
Sourcepub fn resolve(
&mut self,
resolutions: Vec<(ConflictId, Resolution)>,
) -> Vec<ResolveVerdict>
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.
Sourcepub fn validate_resolution(
&self,
conflict_id: &ConflictId,
resolution: &Resolution,
) -> Result<(), ResolutionRejection>
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.
Sourcepub fn commit(self) -> Result<Vec<(ConflictId, Resolution)>, CommitError>
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.