uniqc.gateway.db.archive_store module
Archive store — moves tasks in/out of the archived_tasks table.
The archive lives in the same tasks.sqlite file as the main task store.
This module provides an ArchiveStore class that mirrors TaskStore’s
interface but operates on the archived_tasks table.
-
class uniqc.gateway.db.archive_store.ArchiveStore[source]
Bases: object
Persistent archive for completed / failed tasks.
Tasks are moved atomically from tasks → archived_tasks so that
the hot-path query on tasks stays fast even when many historical
tasks have accumulated.
-
archive_task(task_id)[source]
Move a task from tasks to archived_tasks.
Cascades shards to archived_task_shards first; the task row’s
ON DELETE CASCADE would otherwise wipe them silently.
Returns True if the task existed and was moved.
- Parameters:
task_id (str)
- Return type:
bool
-
count_archived(*, status=None, backend=None)[source]
Return total number of archived tasks.
- Parameters:
status (str | None)
backend (str | None)
- Return type:
int
-
delete_archived(task_id)[source]
Permanently remove an archived task. Returns True if it existed.
- Parameters:
task_id (str)
- Return type:
bool
-
get_archived(task_id)[source]
Return an archived task by id, or None.
- Parameters:
task_id (str)
- Return type:
TaskInfo | None
-
list_archived(*, status=None, backend=None, limit=None, offset=None)[source]
List archived tasks, newest-first by submit_time.
- Parameters:
status (str | None)
backend (str | None)
limit (int | None)
offset (int | None)
- Return type:
list[TaskInfo]
-
restore_task(task_id)[source]
Move a task from archived_tasks back to tasks.
Cascades archived shards back to task_shards. Returns
True if the task existed and was restored.
- Parameters:
task_id (str)
- Return type:
bool