Skip to main content

MergeQueue

Struct MergeQueue 

Source
pub struct MergeQueue { /* private fields */ }
Expand description

Merge queue for tracking parallel loop merges.

The queue maintains an append-only JSONL log of merge events. State is derived by replaying events for each loop.

Implementations§

Source§

impl MergeQueue

Source

pub const QUEUE_FILE: &'static str = ".ralph/merge-queue.jsonl"

The relative path to the merge queue file within the workspace.

Source

pub fn new(workspace_root: impl AsRef<Path>) -> Self

Creates a new merge queue instance for the given workspace.

Source

pub fn enqueue( &self, loop_id: &str, prompt: &str, ) -> Result<(), MergeQueueError>

Enqueues a completed loop for merging.

§Arguments
  • loop_id - The loop identifier
  • prompt - The prompt that was executed
Source

pub fn mark_merging( &self, loop_id: &str, pid: u32, ) -> Result<(), MergeQueueError>

Marks a loop as being merged.

§Arguments
  • loop_id - The loop identifier
  • pid - PID of the merge-ralph process
Source

pub fn mark_merged( &self, loop_id: &str, commit: &str, ) -> Result<(), MergeQueueError>

Marks a loop as successfully merged.

§Arguments
  • loop_id - The loop identifier
  • commit - The merge commit SHA
Source

pub fn mark_needs_review( &self, loop_id: &str, reason: &str, ) -> Result<(), MergeQueueError>

Marks a loop as needing manual review.

§Arguments
  • loop_id - The loop identifier
  • reason - Reason for the failure
Source

pub fn discard( &self, loop_id: &str, reason: Option<&str>, ) -> Result<(), MergeQueueError>

Marks a loop as discarded.

§Arguments
  • loop_id - The loop identifier
  • reason - Optional reason for discarding
Source

pub fn next_pending(&self) -> Result<Option<MergeEntry>, MergeQueueError>

Gets the next pending loop ready for merge (FIFO order).

Returns the oldest loop in Queued state.

Source

pub fn get_entry( &self, loop_id: &str, ) -> Result<Option<MergeEntry>, MergeQueueError>

Gets the entry for a specific loop.

Source

pub fn list(&self) -> Result<Vec<MergeEntry>, MergeQueueError>

Lists all entries in the merge queue.

Returns entries in chronological order (oldest first).

Source

pub fn list_by_state( &self, state: MergeState, ) -> Result<Vec<MergeEntry>, MergeQueueError>

Lists entries filtered by state.

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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