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
impl MergeQueue
Sourcepub const QUEUE_FILE: &'static str = ".ralph/merge-queue.jsonl"
pub const QUEUE_FILE: &'static str = ".ralph/merge-queue.jsonl"
The relative path to the merge queue file within the workspace.
Sourcepub fn new(workspace_root: impl AsRef<Path>) -> Self
pub fn new(workspace_root: impl AsRef<Path>) -> Self
Creates a new merge queue instance for the given workspace.
Sourcepub fn enqueue(
&self,
loop_id: &str,
prompt: &str,
) -> Result<(), MergeQueueError>
pub fn enqueue( &self, loop_id: &str, prompt: &str, ) -> Result<(), MergeQueueError>
Enqueues a completed loop for merging.
§Arguments
loop_id- The loop identifierprompt- The prompt that was executed
Sourcepub fn mark_merging(
&self,
loop_id: &str,
pid: u32,
) -> Result<(), MergeQueueError>
pub fn mark_merging( &self, loop_id: &str, pid: u32, ) -> Result<(), MergeQueueError>
Marks a loop as being merged.
§Arguments
loop_id- The loop identifierpid- PID of the merge-ralph process
Sourcepub fn mark_merged(
&self,
loop_id: &str,
commit: &str,
) -> Result<(), MergeQueueError>
pub fn mark_merged( &self, loop_id: &str, commit: &str, ) -> Result<(), MergeQueueError>
Marks a loop as successfully merged.
§Arguments
loop_id- The loop identifiercommit- The merge commit SHA
Sourcepub fn mark_needs_review(
&self,
loop_id: &str,
reason: &str,
) -> Result<(), MergeQueueError>
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 identifierreason- Reason for the failure
Sourcepub fn discard(
&self,
loop_id: &str,
reason: Option<&str>,
) -> Result<(), MergeQueueError>
pub fn discard( &self, loop_id: &str, reason: Option<&str>, ) -> Result<(), MergeQueueError>
Marks a loop as discarded.
§Arguments
loop_id- The loop identifierreason- Optional reason for discarding
Sourcepub fn next_pending(&self) -> Result<Option<MergeEntry>, MergeQueueError>
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.
Sourcepub fn get_entry(
&self,
loop_id: &str,
) -> Result<Option<MergeEntry>, MergeQueueError>
pub fn get_entry( &self, loop_id: &str, ) -> Result<Option<MergeEntry>, MergeQueueError>
Gets the entry for a specific loop.
Sourcepub fn list(&self) -> Result<Vec<MergeEntry>, MergeQueueError>
pub fn list(&self) -> Result<Vec<MergeEntry>, MergeQueueError>
Lists all entries in the merge queue.
Returns entries in chronological order (oldest first).
Sourcepub fn list_by_state(
&self,
state: MergeState,
) -> Result<Vec<MergeEntry>, MergeQueueError>
pub fn list_by_state( &self, state: MergeState, ) -> Result<Vec<MergeEntry>, MergeQueueError>
Lists entries filtered by state.
Auto Trait Implementations§
impl Freeze for MergeQueue
impl RefUnwindSafe for MergeQueue
impl Send for MergeQueue
impl Sync for MergeQueue
impl Unpin for MergeQueue
impl UnsafeUnpin for MergeQueue
impl UnwindSafe for MergeQueue
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
Mutably borrows from an owned value. Read more