Skip to main content

SqliteBackend

Struct SqliteBackend 

Source
pub struct SqliteBackend { /* private fields */ }

Implementations§

Source§

impl SqliteBackend

Source

pub async fn open(locator: &str) -> KanbanResult<Self>

Source

pub async fn close(&self)

Closes the underlying pool. Callers that may delete the database file afterwards must await this first: Windows refuses to unlink a file with live handles.

Trait Implementations§

Source§

impl CommandStore for SqliteBackend

Source§

fn load_all_batches(&self) -> KanbanResult<(Vec<CommandBatch>, u64)>

Delegate to the mirror’s atomic count+load rather than the non-atomic trait default, so a concurrent append cannot land between the count and the load.

Source§

fn append_batch(&self, batch: &CommandBatch) -> KanbanResult<u64>

Append one batch as a single entry. Returns the new entry count.
Source§

fn batch_count(&self) -> KanbanResult<u64>

Source§

fn load_batches(&self, from: u64, to: u64) -> KanbanResult<Vec<CommandBatch>>

Half-open range [from, to) of batches in chronological order.
Source§

impl DataStore for SqliteBackend

Source§

fn get_prefix(&self, name: &str) -> KanbanResult<Option<Prefix>>

Look a namespace up by name. Matching is case-insensitive, because the identifier resolver lowercases before comparing; a case-sensitive lookup would fork one namespace into two that each allocate from zero.
Source§

fn list_prefixes(&self) -> KanbanResult<Vec<Prefix>>

Source§

fn upsert_prefix(&self, prefix: Prefix) -> KanbanResult<()>

Insert or replace by normalised name. Two spellings of one name are one row.
Source§

fn get_board(&self, id: Uuid) -> KanbanResult<Option<Board>>

Source§

fn list_boards(&self) -> KanbanResult<Vec<Board>>

Source§

fn upsert_board(&self, board: Board) -> KanbanResult<()>

Source§

fn delete_board(&self, id: Uuid) -> KanbanResult<()>

Source§

fn get_column(&self, id: Uuid) -> KanbanResult<Option<Column>>

Source§

fn list_columns_by_board(&self, board_id: Uuid) -> KanbanResult<Vec<Column>>

Source§

fn list_all_columns(&self) -> KanbanResult<Vec<Column>>

Source§

fn upsert_column(&self, column: Column) -> KanbanResult<()>

Source§

fn delete_column(&self, id: Uuid) -> KanbanResult<()>

Source§

fn delete_columns_by_board(&self, board_id: Uuid) -> KanbanResult<()>

Source§

fn get_card(&self, id: Uuid) -> KanbanResult<Option<Card>>

Returns the row regardless of archival status: an archived card is still Some.
Source§

fn list_all_cards(&self) -> KanbanResult<Vec<Card>>

Excludes archived cards, so a card’s absence here is not evidence the card is gone.
Source§

fn list_cards_by_column(&self, column_id: Uuid) -> KanbanResult<Vec<Card>>

Source§

fn list_cards_by_columns(&self, column_ids: &[Uuid]) -> KanbanResult<Vec<Card>>

Return all cards across the given columns in one call. Read more
Source§

fn list_cards_by_sprint(&self, sprint_id: Uuid) -> KanbanResult<Vec<Card>>

Source§

fn list_cards_by_number(&self, card_number: u32) -> KanbanResult<Vec<Card>>

Every live card numbered card_number, in ANY namespace. Read more
Source§

fn list_cards_by_prefix_and_number( &self, prefix: &str, card_number: u32, ) -> KanbanResult<Vec<Card>>

Every live card in namespace prefix numbered card_number. Read more
Source§

fn get_card_by_board_and_number( &self, board_id: Uuid, card_number: u32, ) -> KanbanResult<Option<Card>>

Find the card numbered card_number directly owned by board_id (via Card.board_id, not via column membership). Returns None when no live card matches. Default is an honest linear scan every backend can answer; SQL-backed implementations should override with an indexed single-row query.
Source§

fn get_card_by_sprint_and_number( &self, sprint_id: Uuid, card_number: u32, ) -> KanbanResult<Option<Card>>

Find the card numbered card_number directly owned by sprint_id. Returns None when no live card matches. Default delegates to list_cards_by_sprint; SQL-backed implementations should override with an indexed single-row query.
Source§

fn count_cards_in_column(&self, column_id: Uuid) -> KanbanResult<usize>

Source§

fn count_cards_in_column_excluding( &self, column_id: Uuid, exclude: &[Uuid], ) -> KanbanResult<usize>

Source§

fn list_cards_by_column_filtered( &self, column_id: Uuid, archived: ArchivedFilter, ) -> KanbanResult<Vec<Card>>

Filter-aware column read. The default serves LiveOnly by delegating to list_cards_by_column and fails LOUD for any archived-aware filter — no silent live-only fallback (per the repo “semantic floor” rule). Backends that store archived cards override this to honour ArchivedOnly and Include.
Source§

fn count_cards_in_column_filtered( &self, column_id: Uuid, archived: ArchivedFilter, ) -> KanbanResult<usize>

Filter-aware column count. Mirrors list_cards_by_column_filtered: LiveOnly delegates to count_cards_in_column, archived-aware filters fail loud until a backend overrides.
Source§

fn upsert_card(&self, card: Card) -> KanbanResult<()>

Source§

fn delete_card(&self, id: Uuid) -> KanbanResult<()>

Source§

fn delete_cards_by_columns(&self, column_ids: &[Uuid]) -> KanbanResult<()>

Source§

fn clear_sprint_from_cards( &self, sprint_id: Uuid, timestamp: DateTime<Utc>, ) -> KanbanResult<()>

Source§

fn get_archived_card(&self, card_id: Uuid) -> KanbanResult<Option<ArchivedCard>>

Source§

fn list_archived_cards(&self) -> KanbanResult<Vec<ArchivedCard>>

Source§

fn insert_archived_card(&self, ac: ArchivedCard) -> KanbanResult<()>

Source§

fn delete_archived_card(&self, card_id: Uuid) -> KanbanResult<()>

Source§

fn get_archived_board( &self, board_id: Uuid, ) -> KanbanResult<Option<ArchivedBoard>>

Source§

fn list_archived_boards(&self) -> KanbanResult<Vec<ArchivedBoard>>

Source§

fn insert_archived_board(&self, ab: ArchivedBoard) -> KanbanResult<()>

Source§

fn delete_archived_board(&self, board_id: Uuid) -> KanbanResult<()>

Remove a board from the archived collection only. On a marker-style backend (SQLite) this also removes the shared entity row, so it MUST be a no-op on a live (non-archived) board — matching the in-memory store, which only touches its archived map. RestoreBoard relies on this: it calls delete_archived_board BEFORE re-inserting the board as live (delete-then-upsert), so re-adding it doesn’t collide with the archived row on a shared-row backend.
Source§

fn unarchive_board(&self, board_id: Uuid) -> KanbanResult<()>

Remove a board from the archived collection while KEEPING its shared entity row and subtree (the RESTORE path). The default delegates to delete_archived_board, which is correct for map-style backends (in-memory/JSON) whose delete_archived_board only drops the head from the archived map and never touches the subtree. A shared-row backend (SQLite), whose delete_archived_board deletes the entity row (needed for permanent delete), MUST override this to drop only the archived marker — otherwise RestoreBoard (delete-archived then upsert-head) would CASCADE the still-present subtree away (KAN-863).
Source§

fn list_archived_cards_by_board( &self, board_id: Uuid, ) -> KanbanResult<Vec<ArchivedCard>>

Board-scoped archived cards. Default filters the full list by the board_id field now carried on each ArchivedCard (B1). SQL backends override with a single WHERE board_id = ? query.
Source§

fn clear_sprint_from_archived_cards( &self, sprint_id: Uuid, timestamp: DateTime<Utc>, ) -> KanbanResult<()>

Source§

fn get_sprint(&self, id: Uuid) -> KanbanResult<Option<Sprint>>

Source§

fn list_sprints_by_board(&self, board_id: Uuid) -> KanbanResult<Vec<Sprint>>

Source§

fn list_all_sprints(&self) -> KanbanResult<Vec<Sprint>>

Source§

fn upsert_sprint(&self, sprint: Sprint) -> KanbanResult<()>

Source§

fn delete_sprint(&self, id: Uuid) -> KanbanResult<()>

Source§

fn delete_sprints_by_board(&self, board_id: Uuid) -> KanbanResult<()>

Source§

fn get_graph(&self) -> KanbanResult<DependencyGraph>

Source§

fn set_graph(&self, graph: DependencyGraph) -> KanbanResult<()>

Source§

fn modify_graph(&self, f: GraphMutFn) -> KanbanResult<()>

Atomically read-modify-write the dependency graph. Read more
Source§

impl KanbanBackend for SqliteBackend

Source§

fn with_transaction(&self, f: TransactionFn<'_>) -> KanbanResult<()>

Real BEGIN/COMMIT/ROLLBACK transaction rather than a snapshot-and-restore rollback.

Source§

fn as_data_store(&self) -> &dyn DataStore

Upcast to &dyn DataStore.
Source§

fn flush<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = KanbanResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Persist any cached writes to durable storage.
Source§

fn instance_id(&self) -> Uuid

Stable instance UUID used for own-write detection in file watchers.
Source§

fn local_persistence(&self) -> Option<&dyn LocalPersistence>

Some(…) when this backend can report format version, writer kanban version, writer commit, and last save time (JSON, SQLite). None (the default) for backends with no durable local store (InMemory, Http) or that don’t track it (MockBackend).
Source§

fn reload<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), KanbanError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Discard cached state so the next read re-fetches from storage.
Source§

fn probe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), KanbanError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Forces one cheap I/O so a broken backend fails at construction instead of on first use. The default reads the command log, which every local backend loads lazily; a remote backend overrides this with a network liveness check.
Source§

fn mark_dirty(&self)

Marks the backend dirty without performing a write, so a subsequent flush() (or needs_save_worker()-driven background flush) picks it up. No-op by default for write-through backends that have no dirty flag to set.
Source§

fn needs_flush(&self) -> bool

Returns true when there are writes that have not been flushed yet.
Source§

fn needs_save_worker(&self) -> bool

Returns true for backends (JSON) that require a background flush worker. Always false for write-through backends (SQLite, in-memory).
Source§

fn compatibility_notice(&self) -> Option<CompatibilityNotice>

Some(…) when the last probe() found the remote server older than this binary, or unable to report a comparable version.
Source§

fn health_checker(&self) -> Option<Box<dyn HealthChecker>>

Returns a health checker for this backend, if supported. The default returns None; backends that can self-diagnose (file readable, connection pool alive) override this.
Source§

fn remote_writes(&self) -> Option<&dyn RemoteWrites>

Some(…) when this backend wants create/update/delete for board/column/ card to bypass local command execution entirely (an HTTP backend, where the remote server is authoritative). None (the default) for every local backend — zero behavior change for JSON/SQLite/InMemory.
Source§

fn remote_board_writes(&self) -> Option<&dyn RemoteBoardWrites>

Per-family counterparts to remote_writes(). None by default for every backend; a backend overrides only the families it supports.
Source§

fn remote_card_writes(&self) -> Option<&dyn RemoteCardWrites>

See remote_board_writes().
Source§

fn remote_batch_writes(&self) -> Option<&dyn RemoteBatchWrites>

See remote_board_writes().
Source§

fn remote_sprint_writes(&self) -> Option<&dyn RemoteSprintWrites>

See remote_board_writes().
Source§

fn remote_graph_writes(&self) -> Option<&dyn RemoteGraphWrites>

See remote_board_writes().
Source§

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

Some(…) when a caller needs to downcast to the concrete backend type. None (the default) for backends that offer no such hook.
Source§

impl LocalPersistence for SqliteBackend

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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<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