pub struct Database { /* private fields */ }Implementations§
Source§impl Database
impl Database
pub async fn export_data(&self, exported_at: String) -> Result<AvenExport>
pub async fn validate_import_data(&self, export: &AvenExport) -> Result<()>
pub async fn import_data(&self, export: &AvenExport) -> Result<IntegrityReport>
pub async fn database_integrity_report(&self) -> Result<IntegrityReport>
pub async fn attachment_integrity_checks( &self, blob_dir: &Path, deep: bool, ) -> Result<Vec<IntegrityCheck>>
pub async fn create_backup_archive( &self, db_path: &Path, blob_dir: &Path, output: &Path, ) -> Result<()>
Source§impl Database
impl Database
pub async fn open(path: &Path) -> Result<Self>
pub fn path(&self) -> &Path
pub fn latest_schema_version() -> Option<i64>
pub async fn meta(&self, key: &str) -> Result<Option<String>>
pub async fn conflict_exists( &self, workspace_id: &WorkspaceId, task_id: &TaskId, field: &str, ) -> Result<bool>
Source§impl Database
impl Database
pub async fn list_labels( &self, workspace_id: &WorkspaceId, search: Option<&str>, ) -> Result<Vec<String>>
pub async fn resolve_labels( &self, workspace_id: &WorkspaceId, labels: &[String], ) -> Result<Vec<String>>
Source§impl Database
impl Database
pub async fn onboarding_status(&self) -> Result<OnboardingStatus>
pub async fn complete_onboarding(&self) -> Result<()>
Source§impl Database
impl Database
pub async fn set_task_status( &self, workspace: &Workspace, task: &Task, status: &str, ) -> Result<Task>
pub async fn set_task_priority( &self, workspace: &Workspace, task: &Task, priority: &str, ) -> Result<Task>
pub async fn cycle_task_priority( &self, workspace: &Workspace, task: &Task, reverse: bool, ) -> Result<Task>
pub async fn set_task_deleted_state( &self, workspace: &Workspace, task: &Task, deleted: bool, ) -> Result<Task>
pub async fn set_task_field( &self, workspace: &Workspace, task_id: &TaskId, field: &str, value: &str, ) -> Result<bool>
pub async fn set_task_project( &self, workspace: &Workspace, task_id: &TaskId, project: &Project, ) -> Result<bool>
pub async fn set_task_fields( &self, workspace: &Workspace, updates: &[(TaskId, String, String)], ) -> Result<Vec<bool>>
pub async fn cycle_task_priorities( &self, workspace: &Workspace, tasks: &[Task], reverse: bool, ) -> Result<Vec<Task>>
Source§impl Database
impl Database
pub async fn add_task_attachment( &self, workspace: &Workspace, blob_dir: &Path, policy: LifecyclePolicy, task_id: &TaskId, input: AttachmentAddInput, ) -> Result<AttachmentAddOutcome>
pub async fn add_ordered_task_attachment( &self, workspace: &Workspace, blob_dir: &Path, policy: LifecyclePolicy, task_id: &TaskId, created_at: String, input: TaskAttachmentAddInput, ) -> Result<AttachmentAddOutcome>
pub async fn attachment_by_id( &self, workspace: &Workspace, attachment_id: &str, ) -> Result<AttachmentOutcome>
pub async fn delete_task_attachment( &self, workspace: &Workspace, attachment_id: &str, ) -> Result<AttachmentOutcome>
pub async fn attachment_read_items_by_task( &self, workspace_id: &WorkspaceId, task_id: &TaskId, include_deleted: bool, ) -> Result<Vec<AttachmentReadItem>>
pub async fn prune_attachments( &self, blob_dir: &Path, policy: LifecyclePolicy, apply: bool, ) -> Result<PruneSummary>
pub async fn acquire_attachment_lease( &self, sha256: &str, purpose: &str, ) -> Result<String>
pub async fn acquire_live_attachment_read_lease( &self, workspace: &Workspace, attachment_id: &str, ) -> Result<AttachmentReadLease>
pub async fn release_attachment_lease(&self, lease_id: &str) -> Result<()>
pub async fn attachment_lifecycle_report( &self, blob_dir: &Path, policy: LifecyclePolicy, ) -> Result<LifecycleReport>
Source§impl Database
impl Database
pub async fn list_conflicts( &self, workspace: &Workspace, project_key: Option<&str>, field: Option<&str>, ) -> Result<Vec<ConflictListItem>>
pub async fn task_conflicts( &self, workspace: &Workspace, task_id: &TaskId, field: Option<&str>, ) -> Result<Vec<ConflictDetail>>
pub async fn conflict_variant_value( &self, workspace: &Workspace, task_id: &TaskId, field: &str, token: &str, ) -> Result<String>
pub async fn resolve_conflict_for_undo( &self, workspace: &Workspace, task_id: &TaskId, field: &str, value: &str, ) -> Result<ConflictResolutionOutcome>
pub async fn resolve_conflict( &self, workspace: &Workspace, task_id: &TaskId, field: &str, value: &str, ) -> Result<ConflictOutcome>
Source§impl Database
impl Database
pub async fn add_task_dependency( &self, workspace: &Workspace, task_id: &TaskId, depends_on_id: &TaskId, ) -> Result<DependencyOutcome>
pub async fn remove_task_dependency( &self, workspace: &Workspace, task_id: &TaskId, depends_on_id: &TaskId, ) -> Result<DependencyOutcome>
Source§impl Database
impl Database
pub async fn add_task_to_epic( &self, workspace: &Workspace, child_id: &TaskId, epic_id: &TaskId, ) -> Result<EpicLinkOutcome>
pub async fn remove_task_from_epic( &self, workspace: &Workspace, child_id: &TaskId, epic_id: &TaskId, ) -> Result<EpicLinkOutcome>
Source§impl Database
impl Database
pub async fn create_label( &self, workspace: &Workspace, name: &str, ) -> Result<LabelOutcome>
pub async fn delete_label( &self, workspace: &Workspace, name: &str, ) -> Result<LabelDeleteOutcome>
pub async fn create_project( &self, workspace: &Workspace, name: &str, ) -> Result<ProjectOutcome>
pub async fn delete_project( &self, workspace: &Workspace, project: &str, ) -> Result<ProjectDeleteOutcome>
pub async fn rename_project( &self, workspace: &Workspace, project: &str, new_name: &str, prefix: Option<&str>, ) -> Result<ProjectRenameOutcome>
pub async fn rename_project_before_commit<T, F>( &self, workspace: &Workspace, project: &str, new_name: &str, prefix: Option<&str>, before_commit: F, ) -> Result<(ProjectRenameOutcome, T)>
Source§impl Database
impl Database
pub async fn create_task( &self, workspace: &Workspace, draft: TaskDraft, ) -> Result<TaskOutcome>
pub async fn create_task_with_attachments( &self, workspace: &Workspace, blob_dir: &Path, lifecycle_policy: LifecyclePolicy, draft: TaskDraft, attachments: Vec<TaskAttachmentAddInput>, ) -> Result<TaskOutcome>
pub async fn update_task( &self, workspace: &Workspace, task_id: &TaskId, update: TaskUpdate, ) -> Result<TaskUpdateOutcome>
pub async fn update_tasks( &self, workspace: &Workspace, updates: Vec<(TaskId, TaskUpdate)>, ) -> Result<Vec<TaskUpdateOutcome>>
pub async fn set_task_deleted( &self, workspace: &Workspace, task_id: &TaskId, deleted: bool, ) -> Result<TaskOutcome>
pub async fn add_note( &self, workspace: &Workspace, task_id: &TaskId, body: String, ) -> Result<NoteOutcome>
pub async fn delete_note( &self, workspace: &Workspace, task_id: &TaskId, note_id: &str, ) -> Result<NoteDeleteOutcome>
Source§impl Database
impl Database
pub async fn find_project( &self, workspace_id: &WorkspaceId, input: &str, ) -> Result<Option<Project>>
pub async fn resolve_existing_project( &self, workspace_id: &WorkspaceId, project: &str, ) -> Result<Project>
pub async fn list_projects( &self, workspace_id: &WorkspaceId, search: Option<&str>, ) -> Result<Vec<Project>>
pub async fn inferred_project_key_for_add( &self, workspace_id: &WorkspaceId, config_candidate: Option<&str>, cwd: &Path, git_root: Option<&Path>, ) -> Result<Option<String>>
pub async fn inferred_existing_project_key( &self, workspace_id: &WorkspaceId, config_candidate: Option<&str>, cwd: &Path, git_root: Option<&Path>, ) -> Result<Option<String>>
pub async fn remove_project_path( &self, workspace_id: &WorkspaceId, project_id: &ProjectId, path: &Path, ) -> Result<()>
pub async fn resolve_or_create_project( &self, workspace_id: &WorkspaceId, project: &str, ) -> Result<Project>
pub async fn resolve_project_for_stored_value( &self, workspace_id: &WorkspaceId, value: &str, ) -> Result<Project>
Source§impl Database
impl Database
pub async fn list_project_items( &self, workspace_id: &WorkspaceId, ) -> Result<Vec<ProjectListItem>>
pub async fn list_task_items( &self, workspace_id: &WorkspaceId, filters: TaskFilters, mode: TaskQueryMode, sort: TaskSort, direction: SortDirection, ) -> Result<Vec<TaskListItem>>
pub async fn list_task_items_with_display_refs( &self, workspace_id: &WorkspaceId, filters: TaskFilters, mode: TaskQueryMode, sort: TaskSort, direction: SortDirection, display_refs: &DisplayRefContext, ) -> Result<Vec<TaskListItem>>
pub async fn list_recent_actions( &self, workspace_id: &WorkspaceId, project_scope: Option<&str>, ) -> Result<Vec<RecentActionItem>>
pub async fn search_task_items( &self, workspace_id: &WorkspaceId, query: TaskSearchQuery, ) -> Result<Vec<TaskSearchResult>>
pub async fn search_task_preview_set( &self, workspace_id: &WorkspaceId, query: TaskSearchQuery, ) -> Result<TaskSearchPreviewResultSet>
pub async fn task_detail(&self, task: &Task) -> Result<TaskDetail>
pub async fn task_detail_with_display_refs( &self, task: &Task, display_refs: &DisplayRefContext, ) -> Result<TaskDetail>
pub async fn conflict_display_value( &self, workspace_id: &WorkspaceId, field: &str, value: &str, ) -> Result<String>
pub async fn task_dependency_summary( &self, workspace_id: &WorkspaceId, task_id: &TaskId, ) -> Result<TaskDependencySummary>
pub async fn workspace_task_counts( &self, workspace_id: &WorkspaceId, ) -> Result<WorkspaceTaskCounts>
pub async fn unresolved_conflict_count(&self) -> Result<i64>
pub async fn sync_history_stats(&self) -> Result<SyncHistoryStats>
pub async fn database_stats( &self, workspace: &Workspace, ) -> Result<DatabaseStats>
Source§impl Database
impl Database
pub async fn display_ref_context( &self, workspace_id: &WorkspaceId, ) -> Result<DisplayRefContext>
pub async fn resolve_task_ref( &self, workspace: &Workspace, input: &str, ) -> Result<Task>
Source§impl Database
impl Database
pub async fn prepare_server_blob_uploads( &self, blob_dir: &Path, policy: LifecyclePolicy, blobs: &[BlobUploadContract], ) -> Result<Vec<String>>
pub async fn store_server_blob( &self, blob_dir: &Path, policy: LifecyclePolicy, contract: &BlobUploadContract, bytes: Vec<u8>, ) -> Result<()>
pub async fn read_server_blob( &self, blob_dir: &Path, sha256: &str, ) -> Result<Option<ServerBlobDownload>>
pub async fn maintain_server_blobs( &self, blob_dir: &Path, policy: LifecyclePolicy, ) -> Result<()>
Source§impl Database
impl Database
pub async fn sync_persistence_status(&self) -> Result<SyncPersistenceStatus>
pub async fn begin_sync_attempt(&self, attempted_at: String) -> Result<()>
pub async fn record_sync_error(&self, error: String) -> Result<()>
pub async fn prepare_client_sync_page( &self, server: String, push_limit: usize, pull_limit: u32, ) -> Result<ClientSyncPage>
pub async fn apply_client_sync_page(&self, page: ApplySyncPage) -> Result<usize>
pub async fn persist_server_sync_page( &self, page: ServerSyncPage, ) -> Result<ServerSyncResult>
pub async fn persist_server_sync_page_with_blobs( &self, page: ServerSyncPage, blob_dir: &Path, ) -> Result<ServerSyncResult>
Source§impl Database
impl Database
pub async fn task_field_value( &self, workspace_id: &WorkspaceId, task_id: &TaskId, field: &str, ) -> Result<String>
pub async fn task_labels( &self, workspace_id: &WorkspaceId, task_id: &TaskId, ) -> Result<Vec<String>>
pub async fn task_undo_snapshot( &self, workspace_id: &WorkspaceId, task_id: &TaskId, ) -> Result<TaskUndoSnapshot>
pub async fn conflict_row_id( &self, workspace_id: &WorkspaceId, task_id: &TaskId, field: &str, ) -> Result<i64>
pub async fn record_tui_undo( &self, workspace_id: &WorkspaceId, summary: &str, payload: UndoPayload, ) -> Result<()>
pub async fn clear_pending_tui_undo_entries(&self) -> Result<()>
pub async fn apply_latest_tui_undo( &self, workspace_id: &WorkspaceId, ) -> Result<Option<UndoOutcome>>
Source§impl Database
impl Database
pub async fn list_workspaces(&self) -> Result<Vec<Workspace>>
pub async fn find_workspace( &self, name_or_key: &str, ) -> Result<Option<Workspace>>
pub async fn workspace_for_id( &self, workspace_id: &WorkspaceId, ) -> Result<Workspace>
pub async fn resolve_workspace(&self, name_or_key: &str) -> Result<Workspace>
pub async fn resolve_required_workspace( &self, name_or_key: &str, source: &str, ) -> Result<Workspace>
pub async fn create_workspace(&self, name: &str) -> Result<Workspace>
pub async fn rename_workspace( &self, workspace_ref: &str, new_name: &str, ) -> Result<Workspace>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Database
impl !UnwindSafe for Database
impl Freeze for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnsafeUnpin for Database
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.