pub struct GitBackend { /* private fields */ }Expand description
Git-backed storage backend.
Directory layout:
{root}/
metadata.yaml — store name, features, ID config, etc.
objects/
FR/000/FR-001.yaml — individual requirement files (sharded)
BUG/000/BUG-001.yaml
relations/ — (future: append-only relation log)
registry/ — (future: node/user registries)Implementations§
Source§impl GitBackend
impl GitBackend
Sourcepub fn new(root: &Path) -> Result<Self>
pub fn new(root: &Path) -> Result<Self>
Create a new git backend rooted at the given directory. Creates the directory structure if it doesn’t exist.
Sourcepub fn with_dispenser(self, dispenser: DispenserHandle) -> Self
pub fn with_dispenser(self, dispenser: DispenserHandle) -> Self
Set the dispenser for ID generation (distributed mode).
Sourcepub fn with_auto_commit(self, enabled: bool) -> Self
pub fn with_auto_commit(self, enabled: bool) -> Self
Disable auto-commit (useful for batch operations or testing).
Sourcepub fn with_oplog(self, enabled: bool) -> Self
pub fn with_oplog(self, enabled: bool) -> Self
Enable or disable the operation log.
Trait Implementations§
Source§impl DatabaseBackend for GitBackend
impl DatabaseBackend for GitBackend
Source§fn backend_type(&self) -> BackendType
fn backend_type(&self) -> BackendType
Returns the backend type
Source§fn load(&self) -> Result<RequirementsStore>
fn load(&self) -> Result<RequirementsStore>
Loads the entire requirements store from the database
Source§fn save(&self, store: &RequirementsStore) -> Result<()>
fn save(&self, store: &RequirementsStore) -> Result<()>
Saves the entire requirements store to the database
Source§fn get_requirement_by_spec_id(
&self,
spec_id: &str,
) -> Result<Option<Requirement>>
fn get_requirement_by_spec_id( &self, spec_id: &str, ) -> Result<Option<Requirement>>
Gets a requirement by its spec_id (e.g., “FR-001”)
Source§fn get_requirement(&self, id: &Uuid) -> Result<Option<Requirement>>
fn get_requirement(&self, id: &Uuid) -> Result<Option<Requirement>>
Gets a requirement by its UUID
Source§fn update_requirement(&self, requirement: &Requirement) -> Result<()>
fn update_requirement(&self, requirement: &Requirement) -> Result<()>
Updates an existing requirement
Source§fn add_requirement(&self, requirement: Requirement) -> Result<Requirement>
fn add_requirement(&self, requirement: Requirement) -> Result<Requirement>
Adds a new requirement
Returns the requirement with assigned spec_id
Note: This uses the simple SPEC-XXX format for ID generation.
For more complex ID generation (with feature/type prefixes), use update_atomically
Source§fn update_atomically<F>(&self, update_fn: F) -> Result<RequirementsStore>
fn update_atomically<F>(&self, update_fn: F) -> Result<RequirementsStore>
Performs an atomic update operation
Default implementation loads, applies changes, and saves
Source§fn list_requirements(&self, include_archived: bool) -> Result<Vec<Requirement>>
fn list_requirements(&self, include_archived: bool) -> Result<Vec<Requirement>>
Lists all requirements (non-archived by default)
Source§fn update_requirement_versioned(
&self,
requirement: &Requirement,
) -> Result<UpdateResult>
fn update_requirement_versioned( &self, requirement: &Requirement, ) -> Result<UpdateResult>
Updates a requirement with optimistic locking Read more
Source§fn get_description(&self) -> Result<String>
fn get_description(&self) -> Result<String>
Gets the database description
Source§fn create_baseline(
&self,
name: String,
description: Option<String>,
created_by: String,
) -> Result<Baseline>
fn create_baseline( &self, name: String, description: Option<String>, created_by: String, ) -> Result<Baseline>
Creates a new baseline from current requirements
For YAML backend, this also creates a git tag
Source§fn compare_with_baseline(
&self,
baseline_id: &Uuid,
) -> Result<Option<BaselineComparison>>
fn compare_with_baseline( &self, baseline_id: &Uuid, ) -> Result<Option<BaselineComparison>>
Compares current state against a baseline
Source§fn compare_baselines(
&self,
source_id: &Uuid,
target_id: &Uuid,
) -> Result<Option<BaselineComparison>>
fn compare_baselines( &self, source_id: &Uuid, target_id: &Uuid, ) -> Result<Option<BaselineComparison>>
Compares two baselines
Source§fn get_store_version(&self) -> Result<i64>
fn get_store_version(&self) -> Result<i64>
Gets the current store version (for detecting external modifications) Read more
Source§fn create_if_not_exists(&self) -> Result<()>
fn create_if_not_exists(&self) -> Result<()>
Creates the database with default/empty data if it doesn’t exist
Source§fn queue_list(
&self,
_user_id: &str,
_include_completed: bool,
) -> Result<Vec<QueueEntry>>
fn queue_list( &self, _user_id: &str, _include_completed: bool, ) -> Result<Vec<QueueEntry>>
Lists queue entries for a user
If include_completed is false, excludes entries whose requirement is Completed
Source§fn queue_remove(&self, _user_id: &str, _requirement_id: &Uuid) -> Result<()>
fn queue_remove(&self, _user_id: &str, _requirement_id: &Uuid) -> Result<()>
Removes an entry from a user’s queue
Source§fn queue_reorder(&self, _user_id: &str, _items: &[(Uuid, i64)]) -> Result<()>
fn queue_reorder(&self, _user_id: &str, _items: &[(Uuid, i64)]) -> Result<()>
Reorders queue entries by updating positions
Auto Trait Implementations§
impl Freeze for GitBackend
impl !RefUnwindSafe for GitBackend
impl Send for GitBackend
impl Sync for GitBackend
impl Unpin for GitBackend
impl UnsafeUnpin for GitBackend
impl !UnwindSafe for GitBackend
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