pub struct GritStore { /* private fields */ }Expand description
Main storage interface backed by sled
Implementations§
Source§impl GritStore
impl GritStore
Sourcepub fn open_locked(path: &Path) -> Result<LockedStore, GritError>
pub fn open_locked(path: &Path) -> Result<LockedStore, GritError>
Open store with exclusive filesystem lock (non-blocking).
Lock file is created at <path>.lock (e.g., .git/grit/actors/<id>/sled.lock).
Returns GritError::DbBusy if another process holds the lock.
Sourcepub fn open_locked_blocking(
path: &Path,
timeout: Duration,
) -> Result<LockedStore, GritError>
pub fn open_locked_blocking( path: &Path, timeout: Duration, ) -> Result<LockedStore, GritError>
Open store with exclusive filesystem lock (blocking with timeout).
Retries with exponential backoff until the lock is acquired or timeout is reached.
Returns GritError::DbBusy if timeout expires before acquiring the lock.
Sourcepub fn insert_event(&self, event: &Event) -> Result<(), GritError>
pub fn insert_event(&self, event: &Event) -> Result<(), GritError>
Insert an event and update projections
Sourcepub fn get_event(&self, event_id: &EventId) -> Result<Option<Event>, GritError>
pub fn get_event(&self, event_id: &EventId) -> Result<Option<Event>, GritError>
Get an event by ID
Sourcepub fn get_issue(
&self,
issue_id: &IssueId,
) -> Result<Option<IssueProjection>, GritError>
pub fn get_issue( &self, issue_id: &IssueId, ) -> Result<Option<IssueProjection>, GritError>
Get an issue projection by ID
Sourcepub fn list_issues(
&self,
filter: &IssueFilter,
) -> Result<Vec<IssueSummary>, GritError>
pub fn list_issues( &self, filter: &IssueFilter, ) -> Result<Vec<IssueSummary>, GritError>
List issues with optional filtering
Sourcepub fn get_issue_events(
&self,
issue_id: &IssueId,
) -> Result<Vec<Event>, GritError>
pub fn get_issue_events( &self, issue_id: &IssueId, ) -> Result<Vec<Event>, GritError>
Get all events for an issue, sorted by (ts, actor, event_id)
Sourcepub fn rebuild(&self) -> Result<RebuildStats, GritError>
pub fn rebuild(&self) -> Result<RebuildStats, GritError>
Rebuild all projections from events
Sourcepub fn rebuild_from_events(
&self,
events: &[Event],
) -> Result<RebuildStats, GritError>
pub fn rebuild_from_events( &self, events: &[Event], ) -> Result<RebuildStats, GritError>
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)>, GritError>
pub fn get_dependencies( &self, issue_id: &IssueId, ) -> Result<Vec<(IssueId, DependencyType)>, GritError>
Get all outgoing dependencies for an issue
Sourcepub fn get_dependents(
&self,
issue_id: &IssueId,
) -> Result<Vec<(IssueId, DependencyType)>, GritError>
pub fn get_dependents( &self, issue_id: &IssueId, ) -> Result<Vec<(IssueId, DependencyType)>, GritError>
Get all incoming dependencies (what depends on this issue)
Sourcepub fn would_create_cycle(
&self,
source: &IssueId,
target: &IssueId,
dep_type: &DependencyType,
) -> Result<bool, GritError>
pub fn would_create_cycle( &self, source: &IssueId, target: &IssueId, dep_type: &DependencyType, ) -> Result<bool, GritError>
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>, GritError>
pub fn topological_order( &self, filter: &IssueFilter, ) -> Result<Vec<IssueSummary>, GritError>
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>, GritError>
pub fn get_file_context( &self, path: &str, ) -> Result<Option<FileContext>, GritError>
Get file context for a specific path
Sourcepub fn query_symbols(
&self,
query: &str,
) -> Result<Vec<(String, String)>, GritError>
pub fn query_symbols( &self, query: &str, ) -> Result<Vec<(String, String)>, GritError>
Query symbols by name prefix
Sourcepub fn get_project_context(
&self,
key: &str,
) -> Result<Option<ProjectContextEntry>, GritError>
pub fn get_project_context( &self, key: &str, ) -> Result<Option<ProjectContextEntry>, GritError>
Get a project context entry by key
Sourcepub fn list_project_context(
&self,
) -> Result<Vec<(String, ProjectContextEntry)>, GritError>
pub fn list_project_context( &self, ) -> Result<Vec<(String, ProjectContextEntry)>, GritError>
List all project context entries