Skip to main content

GritStore

Struct GritStore 

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

Main storage interface backed by sled

Implementations§

Source§

impl GritStore

Source

pub fn open(path: &Path) -> Result<Self, GriteError>

Open or create a store at the given path

Source

pub fn open_locked(path: &Path) -> Result<LockedStore, GriteError>

Open store with exclusive filesystem lock (non-blocking).

Lock file is created at <path>.lock (e.g., .git/grite/actors/<id>/sled.lock). Returns GriteError::DbBusy if another process holds the lock.

Source

pub fn open_locked_blocking( path: &Path, timeout: Duration, ) -> Result<LockedStore, GriteError>

Open store with exclusive filesystem lock (blocking with timeout).

Retries with exponential backoff until the lock is acquired or timeout is reached. Returns GriteError::DbBusy if timeout expires before acquiring the lock.

Source

pub fn insert_event(&self, event: &Event) -> Result<(), GriteError>

Insert an event and update projections

Source

pub fn get_event(&self, event_id: &EventId) -> Result<Option<Event>, GriteError>

Get an event by ID

Source

pub fn get_issue( &self, issue_id: &IssueId, ) -> Result<Option<IssueProjection>, GriteError>

Get an issue projection by ID

Source

pub fn list_issues( &self, filter: &IssueFilter, ) -> Result<Vec<IssueSummary>, GriteError>

List issues with optional filtering

Source

pub fn get_issue_events( &self, issue_id: &IssueId, ) -> Result<Vec<Event>, GriteError>

Get all events for an issue, sorted by (ts, actor, event_id)

Source

pub fn get_all_events(&self) -> Result<Vec<Event>, GriteError>

Get all events in the store

Source

pub fn rebuild(&self) -> Result<RebuildStats, GriteError>

Rebuild all projections from events

Source

pub fn rebuild_from_events( &self, events: &[Event], ) -> Result<RebuildStats, GriteError>

Rebuild all projections from provided events (for snapshot-based rebuild)

This is useful when rebuilding from a snapshot + WAL combination, where events come from external sources rather than the local store.

Source

pub fn stats(&self, path: &Path) -> Result<DbStats, GriteError>

Get database statistics

Source

pub fn get_dependencies( &self, issue_id: &IssueId, ) -> Result<Vec<(IssueId, DependencyType)>, GriteError>

Get all outgoing dependencies for an issue

Source

pub fn get_dependents( &self, issue_id: &IssueId, ) -> Result<Vec<(IssueId, DependencyType)>, GriteError>

Get all incoming dependencies (what depends on this issue)

Source

pub fn would_create_cycle( &self, source: &IssueId, target: &IssueId, dep_type: &DependencyType, ) -> Result<bool, GriteError>

Check if adding a dependency would create a cycle. Only checks for Blocks/DependsOn (acyclic types).

Source

pub fn topological_order( &self, filter: &IssueFilter, ) -> Result<Vec<IssueSummary>, GriteError>

Get issues in topological order based on dependency relationships. Issues with no dependencies come first.

Source

pub fn get_file_context( &self, path: &str, ) -> Result<Option<FileContext>, GriteError>

Get file context for a specific path

Source

pub fn query_symbols( &self, query: &str, ) -> Result<Vec<(String, String)>, GriteError>

Query symbols by name prefix

Source

pub fn list_context_files(&self) -> Result<Vec<String>, GriteError>

List all indexed file paths

Source

pub fn get_project_context( &self, key: &str, ) -> Result<Option<ProjectContextEntry>, GriteError>

Get a project context entry by key

Source

pub fn list_project_context( &self, ) -> Result<Vec<(String, ProjectContextEntry)>, GriteError>

List all project context entries

Source

pub fn flush(&self) -> Result<(), GriteError>

Flush pending writes to disk

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V