Skip to main content

FileIssueStore

Struct FileIssueStore 

Source
pub struct FileIssueStore { /* private fields */ }
Expand description
Stable since 0.77.0
File-backed issue store.

One instance is shared (via Arc) between the TUI indicator, the agent issue tool, and the oxicode issue CLI subcommand. All mutations go through FileIssueStore::create / FileIssueStore::update which serialize per-file content-hash CAS (cross-process / external edits).

Implementations§

Source§

impl FileIssueStore

Source

pub fn open(issues_dir: PathBuf) -> Result<FileIssueStore, Error>

Open (or create lazily) the issue store rooted at issues_dir.

Source

pub fn open_from_cwd(start: &Path) -> Result<FileIssueStore, Error>

Open using project-root discovery from start (cwd).

Source

pub fn issues_dir(&self) -> PathBuf

The issues directory.

Source

pub fn open_count(&self) -> usize

Number of open issues, for the status-bar indicator. Refreshes the cache if the directory mtime changed. Cheap (O(1) when fresh).

Source

pub fn latest_open_title(&self) -> Option<String>

Title of the most recently updated open issue, for the status-bar indicator. Cached alongside open_count, so this is also O(1) on a warm cache. Returns None if there are no open issues.

Source

pub fn summary(&self) -> IssueSummary

Aggregate summary for the footer indicator / panels. Pulled from the in-memory cache, so it’s cheap (O(1) on a warm cache).

Source

pub fn top_free_priority(&self) -> Option<Priority>

Highest priority among open, unassigned issues — the most actionable thing a free agent could pick up right now (#10). Distinct from a plain “top priority” (overall open max): this excludes issues someone is already working on. Returns None when no open issue is free. Cached alongside Self::open_count; O(1) on a warm cache.

Source

pub fn has_any(&self) -> bool

True iff the issues directory has any issues at all (suppresses the indicator when the project has never used the feature).

Source

pub fn invalidate(&self)

Invalidate the cache (force next read to rescan).

Source

pub fn list(&self, filter: &IssueFilter) -> Result<Vec<Issue>, Error>

List all issues, optionally filtered. Sorted by updated_at desc.

Source

pub fn read(&self, id: u32) -> Result<(Issue, String), Error>

Read a single issue by id. Returns the issue and its current content hash (for optimistic-concurrency writes).

Source

pub fn next_id(&self) -> Result<u32, Error>

Allocate the next issue id by scanning existing filenames.

Cross-process allocation races are possible (two sessions create the next id simultaneously) but bounded: the loser’s create write hits an existing file and we bump to the next free id. No lock needed for correctness, only for avoiding rare retries.

Source

pub fn create( &self, title: String, body: String, priority: Priority, labels: Vec<String>, caller_session: Option<&str>, ) -> Result<Issue, Error>

Create a new issue. caller_session is linked into sessions.

Source

pub async fn update<F>( &self, id: u32, expected_hash: Option<String>, mutator: F, ) -> Result<Issue, IssueError>
where F: FnOnce(Issue) -> Result<Issue, IssueError> + Send + 'static,

Update an issue with optimistic concurrency.

expected_hash should be the hash returned by FileIssueStore::read. If the on-disk content changed since, returns IssueError::Conflict. mutator receives the loaded issue and returns the new state.

All writes go through file_mutation_queue for in-process serialization, exactly like the edit tool.

Source

pub async fn close( &self, id: u32, caller: &str, expected_hash: Option<String>, ) -> Result<Issue, IssueError>

Convenience: close an issue (assignee only).

Source

pub async fn reopen( &self, id: u32, expected_hash: Option<String>, ) -> Result<Issue, IssueError>

Reopen a closed issue. No ownership required (reopening doesn’t assign the issue to anyone; it goes back to the unassigned pool).

Errors with NotFound if the id doesn’t exist, or with no special error if the issue is already open — that case is a no-op.

Source

pub async fn start( &self, id: u32, caller: &str, expected_hash: Option<String>, ) -> Result<Issue, IssueError>

Try to claim an issue for caller (the start action).

If already assigned to a live session, returns IssueError::Assigned. If assigned to a dead session (process exited), reclaims and assigns to the caller. If free, assigns to the caller.

Source

pub async fn release( &self, id: u32, caller: &str, expected_hash: Option<String>, ) -> Result<Issue, IssueError>

Release an assignment (the release action). Caller must be the owner.

Link a session to an issue (append-only; idempotent).

Source

pub async fn apply_patch( &self, id: u32, patch: IssuePatch, caller: Option<String>, expected_hash: Option<String>, ) -> Result<Issue, IssueError>

Apply a precise IssuePatch under strict CAS, preserving the existing ownership policy.

If caller is Some, a different non-empty assignee blocks the update with IssueError::NotAssigned — identical to the legacy update tool action. Setting status = Open also clears closed_at, fixing the latent reopen bug (#4: previously update { status: open } left a stale closed_at on a reopened issue). Prefer the dedicated FileIssueStore::reopen for clarity.

No-op patches (nothing meaningful changed) are detected inside FileIssueStore::update and skip the write entirely.

Trait Implementations§

Source§

impl Clone for FileIssueStore

Source§

fn clone(&self) -> FileIssueStore

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileIssueStore

Source§

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

Formats the value using the given formatter. 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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: Sized + 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: Sized + 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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