pub struct GritStore { /* private fields */ }Expand description
Main storage interface backed by sled
Implementations§
Source§impl GritStore
impl GritStore
Sourcepub fn open(path: &Path) -> Result<Self, GriteError>
pub fn open(path: &Path) -> Result<Self, GriteError>
Open or create a store at the given path
Sourcepub fn open_locked(path: &Path) -> Result<LockedStore, GriteError>
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.
Sourcepub fn open_locked_blocking(
path: &Path,
timeout: Duration,
) -> Result<LockedStore, GriteError>
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.
Sourcepub fn insert_event(&self, event: &Event) -> Result<(), GriteError>
pub fn insert_event(&self, event: &Event) -> Result<(), GriteError>
Insert an event and update projections
Sourcepub fn get_event(&self, event_id: &EventId) -> Result<Option<Event>, GriteError>
pub fn get_event(&self, event_id: &EventId) -> Result<Option<Event>, GriteError>
Get an event by ID
Sourcepub fn get_issue(
&self,
issue_id: &IssueId,
) -> Result<Option<IssueProjection>, GriteError>
pub fn get_issue( &self, issue_id: &IssueId, ) -> Result<Option<IssueProjection>, GriteError>
Get an issue projection by ID
Sourcepub fn list_issues(
&self,
filter: &IssueFilter,
) -> Result<Vec<IssueSummary>, GriteError>
pub fn list_issues( &self, filter: &IssueFilter, ) -> Result<Vec<IssueSummary>, GriteError>
List issues with optional filtering
Sourcepub fn get_issue_events(
&self,
issue_id: &IssueId,
) -> Result<Vec<Event>, GriteError>
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)
Sourcepub fn get_all_events(&self) -> Result<Vec<Event>, GriteError>
pub fn get_all_events(&self) -> Result<Vec<Event>, GriteError>
Get all events in the store
Sourcepub fn rebuild(&self) -> Result<RebuildStats, GriteError>
pub fn rebuild(&self) -> Result<RebuildStats, GriteError>
Rebuild all projections from events
Sourcepub fn rebuild_from_events(
&self,
events: &[Event],
) -> Result<RebuildStats, GriteError>
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.
Sourcepub fn get_dependencies(
&self,
issue_id: &IssueId,
) -> Result<Vec<(IssueId, DependencyType)>, GriteError>
pub fn get_dependencies( &self, issue_id: &IssueId, ) -> Result<Vec<(IssueId, DependencyType)>, GriteError>
Get all outgoing dependencies for an issue
Sourcepub fn get_dependents(
&self,
issue_id: &IssueId,
) -> Result<Vec<(IssueId, DependencyType)>, GriteError>
pub fn get_dependents( &self, issue_id: &IssueId, ) -> Result<Vec<(IssueId, DependencyType)>, GriteError>
Get all incoming dependencies (what depends on this issue)
Sourcepub fn would_create_cycle(
&self,
source: &IssueId,
target: &IssueId,
dep_type: &DependencyType,
) -> Result<bool, GriteError>
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).
Sourcepub fn topological_order(
&self,
filter: &IssueFilter,
) -> Result<Vec<IssueSummary>, GriteError>
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.
Sourcepub fn get_file_context(
&self,
path: &str,
) -> Result<Option<FileContext>, GriteError>
pub fn get_file_context( &self, path: &str, ) -> Result<Option<FileContext>, GriteError>
Get file context for a specific path
Sourcepub fn query_symbols(
&self,
query: &str,
) -> Result<Vec<(String, String)>, GriteError>
pub fn query_symbols( &self, query: &str, ) -> Result<Vec<(String, String)>, GriteError>
Query symbols by name prefix
Sourcepub fn list_context_files(&self) -> Result<Vec<String>, GriteError>
pub fn list_context_files(&self) -> Result<Vec<String>, GriteError>
List all indexed file paths
Sourcepub fn get_project_context(
&self,
key: &str,
) -> Result<Option<ProjectContextEntry>, GriteError>
pub fn get_project_context( &self, key: &str, ) -> Result<Option<ProjectContextEntry>, GriteError>
Get a project context entry by key
Sourcepub fn list_project_context(
&self,
) -> Result<Vec<(String, ProjectContextEntry)>, GriteError>
pub fn list_project_context( &self, ) -> Result<Vec<(String, ProjectContextEntry)>, GriteError>
List all project context entries
Sourcepub fn flush(&self) -> Result<(), GriteError>
pub fn flush(&self) -> Result<(), GriteError>
Flush pending writes to disk