Skip to main content

Database

Struct Database 

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

Implementations§

Source§

impl Database

Source

pub fn upsert_issue_index( &self, issue: &IssueIndexEntry, workspace_id: &str, sync_token: &str, ) -> Result<IndexUpsertOutcome>

Merge the authoritative list/index fields without replacing rich fields populated by an earlier hydration.

Source

pub fn mark_hydration_running( &self, workspace_id: &str, issue_id: &str, resource: HydrationResource, attempted_at: &str, ) -> Result<u32>

Source

pub fn requeue_issue_hydration( &self, workspace_id: &str, issue_id: &str, reason: &str, ) -> Result<()>

Source

pub fn requeue_team_hydration( &self, workspace_id: &str, team_key: &str, reason: &str, ) -> Result<usize>

Source

pub fn requeue_team_retryable_comments( &self, workspace_id: &str, team_key: &str, ) -> Result<usize>

Source

pub fn mark_hydration_complete( &self, workspace_id: &str, issue_id: &str, resource: HydrationResource, source_updated_at: &str, hydrated_at: &str, ) -> Result<()>

Source

pub fn mark_hydration_failed( &self, workspace_id: &str, issue_id: &str, resource: HydrationResource, status: HydrationStatus, next_retry_at: Option<&str>, error: &str, ) -> Result<()>

Source

pub fn get_issue_hydration_state( &self, workspace_id: &str, issue_id: &str, ) -> Result<IssueHydrationState>

Source

pub fn queue_stale_comment_hydration( &self, workspace_id: &str, team_key: &str, policy: HydrationPolicy, stale_before: &str, recent_after: &str, ) -> Result<usize>

Source

pub fn queue_stale_issue_comment_hydration( &self, workspace_id: &str, issue_id: &str, stale_before: &str, ) -> Result<usize>

Source

pub fn list_hydration_candidates( &self, workspace_id: &str, team_key: &str, limit: usize, policy: HydrationPolicy, now: &str, recent_after: &str, ) -> Result<Vec<HydrationCandidate>>

Source

pub fn ensure_hydration_state_for_issue( &self, workspace_id: &str, issue: &Issue, reason: &str, ) -> Result<()>

Source§

impl Database

Source

pub fn upsert_project_metadata(&self, project: &Project) -> Result<()>

Source

pub fn upsert_project(&self, project: &Project) -> Result<()>

Source

pub fn upsert_project_milestone( &self, milestone: &ProjectMilestone, ) -> Result<()>

Source

pub fn get_project( &self, workspace_id: &str, id_or_name: &str, ) -> Result<Option<Project>>

Source

pub fn list_projects( &self, workspace_id: &str, include_archived: bool, ) -> Result<Vec<Project>>

Source

pub fn get_project_milestone( &self, workspace_id: &str, id_or_name: &str, project_id: Option<&str>, ) -> Result<Option<ProjectMilestone>>

Source

pub fn list_project_milestones( &self, project_id: &str, ) -> Result<Vec<ProjectMilestone>>

Source

pub fn get_project_bundle( &self, workspace_id: &str, id_or_name: &str, ) -> Result<Option<ProjectBundle>>

Source

pub fn get_project_milestone_bundle( &self, workspace_id: &str, id_or_name: &str, project_id: Option<&str>, ) -> Result<Option<ProjectMilestoneBundle>>

Source

pub fn list_project_issues( &self, workspace_id: &str, project_id: &str, ) -> Result<Vec<Issue>>

Source

pub fn list_project_milestone_issues( &self, workspace_id: &str, milestone_id: &str, ) -> Result<Vec<Issue>>

Source

pub fn reconcile_project_issue_membership( &self, workspace_id: &str, project_id: &str, keep_issue_ids: &[String], ) -> Result<usize>

Source

pub fn reconcile_project_milestone_issue_membership( &self, workspace_id: &str, milestone_id: &str, keep_issue_ids: &[String], ) -> Result<usize>

Source

pub fn delete_project_local(&self, project_id: &str) -> Result<usize>

Source

pub fn delete_project_milestone_local( &self, milestone_id: &str, ) -> Result<usize>

Source

pub fn delete_projects_for_workspace_not_in( &self, workspace_id: &str, keep_ids: &[String], ) -> Result<usize>

Source

pub fn delete_milestones_for_workspace_not_in( &self, workspace_id: &str, keep_ids: &[String], ) -> Result<usize>

Source

pub fn delete_milestones_for_project_not_in( &self, project_id: &str, keep_ids: &[String], ) -> Result<usize>

Source§

impl Database

Source

pub fn upsert_issue_label_page( &self, issue_id: &str, label_ids: &[String], sync_token: &str, ) -> Result<()>

Source

pub fn complete_issue_label_sync( &self, issue_id: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn mark_project_sync_token( &self, project_id: &str, sync_token: &str, ) -> Result<()>

Source

pub fn list_project_ids_for_sync_token( &self, workspace_id: &str, sync_token: &str, after_id: Option<&str>, limit: usize, ) -> Result<Vec<String>>

Source

pub fn reconcile_workspace_projects( &self, workspace_id: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn reconcile_team_projects( &self, workspace_id: &str, team_key: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn upsert_project_team_page( &self, project_id: &str, teams: &[ProjectTeam], sync_token: &str, ) -> Result<()>

Source

pub fn complete_project_team_sync( &self, project_id: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn upsert_project_member_page( &self, project_id: &str, members: &[ProjectMember], sync_token: &str, ) -> Result<()>

Source

pub fn complete_project_member_sync( &self, project_id: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn upsert_project_label_page( &self, project_id: &str, labels: &[ProjectLabel], sync_token: &str, ) -> Result<()>

Source

pub fn complete_project_label_sync( &self, project_id: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn mark_project_milestone_sync_token( &self, milestone_id: &str, sync_token: &str, ) -> Result<()>

Source

pub fn reconcile_project_milestones_by_token( &self, project_id: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn mark_label_sync_token( &self, label_id: &str, sync_token: &str, ) -> Result<()>

Source

pub fn reconcile_label_sync( &self, workspace_id: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn mark_issue_sync_token( &self, issue_id: &str, sync_token: &str, ) -> Result<()>

Source

pub fn list_issue_sync_refs( &self, workspace_id: &str, team_key: &str, sync_token: &str, after_id: Option<&str>, limit: usize, ) -> Result<Vec<IssueSyncRef>>

Source

pub fn list_comment_hydration_refs( &self, workspace_id: &str, team_key: &str, sync_token: &str, after_id: Option<&str>, limit: usize, ) -> Result<Vec<IssueSyncRef>>

Issues changed in this catalog sync plus any issue whose previous comment hydration failed. The latter makes supplemental failures naturally recoverable even after the authoritative issue cursor moves.

Source

pub fn reconcile_full_issue_sync( &self, workspace_id: &str, team_key: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn reconcile_full_issue_index( &self, workspace_id: &str, team_key: &str, sync_token: &str, upper_bound: &str, ) -> Result<usize>

Reconcile a full issue-index traversal as of its fixed upper bound. Locally cached rows newer than that bound were intentionally outside the traversal and must not be mistaken for hard deletions.

Source

pub fn upsert_relation_page( &self, issue_id: &str, relations: &[Relation], sync_token: &str, ) -> Result<()>

Source

pub fn complete_relation_sync( &self, issue_id: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn upsert_comment_page( &self, issue_id: &str, workspace_id: &str, comments: &[Comment], sync_token: &str, ) -> Result<()>

Source

pub fn complete_comment_sync( &self, issue_id: &str, workspace_id: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn upsert_cycle(&self, cycle: &Cycle, sync_token: &str) -> Result<()>

Source

pub fn reconcile_cycles( &self, workspace_id: &str, team_key: &str, sync_token: &str, ) -> Result<usize>

Source

pub fn mark_sync_family_running( &self, workspace_id: &str, team_key: &str, family: &str, cursor: Option<&str>, page_size: Option<usize>, sync_token: &str, ) -> Result<()>

Source

pub fn mark_sync_family_complete( &self, workspace_id: &str, team_key: &str, family: &str, page_size: Option<usize>, sync_token: &str, ) -> Result<()>

Source

pub fn mark_sync_family_failed( &self, workspace_id: &str, team_key: &str, family: &str, sync_token: &str, error: &str, ) -> Result<()>

Source

pub fn mark_sync_family_partial( &self, workspace_id: &str, team_key: &str, family: &str, sync_token: &str, error: &str, ) -> Result<()>

Source

pub fn get_sync_family_state( &self, workspace_id: &str, team_key: &str, family: &str, ) -> Result<Option<SyncFamilyState>>

Source§

impl Database

Source

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

Source

pub fn with_conn<F, T>(&self, f: F) -> Result<T>
where F: FnOnce(&Connection) -> Result<T>,

Source

pub fn upsert_workspace( &self, id: &str, linear_org_id: Option<&str>, display_name: Option<&str>, ) -> Result<()>

Source

pub fn get_workspace(&self, id: &str) -> Result<Option<WorkspaceRow>>

Source

pub fn list_workspaces(&self) -> Result<Vec<WorkspaceRow>>

Source

pub fn delete_workspace(&self, id: &str) -> Result<usize>

Delete a workspace and all its associated data (issues, chunks, comments, sync state).

Source

pub fn upsert_label(&self, label: &Label) -> Result<()>

Source

pub fn list_labels(&self, workspace_id: &str) -> Result<Vec<Label>>

Source

pub fn delete_labels_for_workspace_not_in( &self, workspace_id: &str, keep_ids: &[String], ) -> Result<usize>

Delete labels in workspace_id whose id is NOT in keep_ids. Returns the number of rows deleted. Cascades to issue_labels.

Source

pub fn resolve_label_ids_local( &self, workspace_id: &str, names: &[String], ) -> Result<(Vec<String>, Vec<String>)>

Resolve label names to ids using the local catalog (case-insensitive). Returns (resolved_ids, unknown_names). Order of resolved_ids is not guaranteed.

Source

pub fn replace_issue_labels( &self, issue_id: &str, label_ids: &[String], ) -> Result<()>

Replace the label set for an issue. Atomic via transaction. Skips any label_ids not present in the labels table (logged at warn level via eprintln).

Source

pub fn get_issue_label_ids(&self, issue_id: &str) -> Result<Vec<String>>

Source

pub fn upsert_issue(&self, issue: &Issue) -> Result<()>

Source

pub fn upsert_issue_preserving_labels(&self, issue: &Issue) -> Result<()>

Source

pub fn get_issue(&self, id_or_identifier: &str) -> Result<Option<Issue>>

Source

pub fn get_unprioritized_issues( &self, team_key: Option<&str>, include_completed: bool, workspace_id: &str, ) -> Result<Vec<Issue>>

Source

pub fn get_unprioritized_issues_filtered( &self, team_key: Option<&str>, include_completed: bool, workspace_id: &str, label_ids: Option<&[String]>, ) -> Result<Vec<Issue>>

Source

pub fn get_issues_by_state_types( &self, team_key: &str, state_types: &[String], workspace_id: &str, ) -> Result<Vec<Issue>>

Source

pub fn get_blockers_for_issues( &self, issue_ids: &[String], ) -> Result<Vec<BlockerRow>>

For a set of issue IDs, return all blocked_by relations with resolved state info. Returns (issue_id, blocker_identifier, blocker_title, blocker_state_name, blocker_state_type).

Source

pub fn count_issues( &self, team_key: Option<&str>, workspace_id: &str, ) -> Result<usize>

Source

pub fn get_field_completeness( &self, team_key: Option<&str>, workspace_id: &str, ) -> Result<(usize, usize, usize, usize, usize)>

Count issues with each optional field populated. Returns (total, with_description, with_priority, with_labels, with_project).

Source

pub fn list_all_issues( &self, team_key: Option<&str>, filter: Option<&str>, limit: usize, offset: usize, workspace_id: &str, ) -> Result<Vec<IssueSummary>>

List all issues with summary info (no description text). Supports pagination, optional team filter, and optional text filter on identifier/title.

Source

pub fn upsert_relations( &self, issue_id: &str, relations: &[Relation], ) -> Result<()>

Source

pub fn get_relations_enriched( &self, issue_id: &str, ) -> Result<Vec<EnrichedRelation>>

Source

pub fn find_relation_id( &self, issue_id: &str, related_issue_id: &str, relation_type: &str, ) -> Result<Option<String>>

Look up a relation ID between two issues (by identifier) for deletion

Source

pub fn upsert_chunks( &self, issue_id: &str, chunks: &[(usize, String, Vec<u8>)], ) -> Result<()>

Source

pub fn upsert_chunks_with_model( &self, issue_id: &str, chunks: &[(usize, String, Vec<u8>)], model_name: &str, ) -> Result<()>

Source

pub fn upsert_chunks_with_model_and_hash( &self, issue_id: &str, chunks: &[(usize, String, Vec<u8>)], model_name: &str, source_content_hash: &str, ) -> Result<()>

Source

pub fn get_embedding_model(&self, issue_id: &str) -> Result<Option<String>>

Get the embedding model name for an issue’s chunks, if any exist.

Source

pub fn compute_issue_embedding_content_hash( &self, issue_id: &str, ) -> Result<String>

Source

pub fn get_all_chunks(&self, workspace_id: &str) -> Result<Vec<Chunk>>

Source

pub fn get_chunks_for_team( &self, team_key: &str, workspace_id: &str, ) -> Result<Vec<Chunk>>

Source

pub fn count_embedded_issues( &self, team_key: Option<&str>, workspace_id: &str, ) -> Result<usize>

Source

pub fn get_issues_needing_embedding( &self, team_key: Option<&str>, force: bool, workspace_id: &str, ) -> Result<Vec<Issue>>

Source

pub fn get_issues_needing_embedding_for_model( &self, team_key: Option<&str>, force: bool, workspace_id: &str, model_name: Option<&str>, ) -> Result<Vec<Issue>>

Source

pub fn get_comments(&self, issue_id: &str) -> Result<Vec<Comment>>

Source

pub fn replace_issue_comments( &self, issue_id: &str, workspace_id: &str, comments: &[Comment], ) -> Result<()>

Source

pub fn get_comment_sync_state(&self, issue_id: &str) -> Result<CommentSyncState>

Source

pub fn mark_comments_synced( &self, issue_id: &str, workspace_id: &str, comment_count: usize, ) -> Result<()>

Source

pub fn mark_comments_sync_failed( &self, issue_id: &str, workspace_id: &str, status: &str, error: &str, ) -> Result<()>

Source

pub fn get_sync_cursor( &self, workspace_id: &str, team_key: &str, ) -> Result<Option<String>>

Source

pub fn get_synced_through_at( &self, workspace_id: &str, team_key: &str, ) -> Result<Option<String>>

Source

pub fn set_sync_cursor( &self, workspace_id: &str, team_key: &str, last_updated_at: &str, ) -> Result<()>

Source

pub fn is_full_sync_done( &self, workspace_id: &str, team_key: &str, ) -> Result<bool>

Source

pub fn get_last_synced_at( &self, workspace_id: &str, team_key: &str, ) -> Result<Option<String>>

Get the wall-clock time of the last sync for a team.

Source

pub fn get_metadata(&self, key: &str) -> Result<Option<String>>

Source

pub fn set_metadata(&self, key: &str, value: &str) -> Result<()>

Source

pub fn list_synced_teams(&self, workspace_id: &str) -> Result<Vec<TeamSummary>>

List teams that have synced issues, with issue and embedding counts. Local-only query — no network required.

Source

pub fn fts_search_filtered( &self, query: &str, limit: usize, workspace_id: &str, label_ids: Option<&[String]>, ) -> Result<Vec<FtsResult>>

Trait Implementations§

Source§

impl Clone for Database

Source§

fn clone(&self) -> Database

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CompatExt for T

Source§

fn compat(self) -> Compat<T>
where T: Sized,

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, UT> HandleAlloc<UT> for T
where T: Send + Sync,

Source§

fn new_handle(value: Arc<T>) -> Handle

Create a new handle for an Arc value Read more
Source§

unsafe fn clone_handle(handle: Handle) -> Handle

Clone a handle Read more
Source§

unsafe fn consume_handle(handle: Handle) -> Arc<T>

Consume a handle, getting back the initial Arc<> Read more
Source§

unsafe fn get_arc(handle: Handle) -> Arc<Self>

Get a clone of the Arc<> using a “borrowed” handle. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<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