diff options
Diffstat (limited to 'makima/src/db/models.rs')
| -rw-r--r-- | makima/src/db/models.rs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/makima/src/db/models.rs b/makima/src/db/models.rs index 6ede268..58f4da1 100644 --- a/makima/src/db/models.rs +++ b/makima/src/db/models.rs @@ -1966,3 +1966,45 @@ pub struct ForkPoint { pub checkpoint: Option<TaskCheckpoint>, pub timestamp: DateTime<Utc>, } + +// ============================================================================ +// Checkpoint Patches (for task recovery when worktrees are lost) +// ============================================================================ + +/// A stored git patch for checkpoint recovery. +/// Enables task recovery when local worktrees are deleted or corrupted. +#[derive(Debug, Clone, FromRow, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct CheckpointPatch { + pub id: Uuid, + pub task_id: Uuid, + /// Optional link to a task_checkpoint record + pub checkpoint_id: Option<Uuid>, + /// The commit SHA that the patch should be applied on top of + pub base_commit_sha: String, + /// Compressed git diff data (gzip) + #[sqlx(rename = "patch_data")] + #[serde(skip)] // Don't serialize binary data to JSON + pub patch_data: Vec<u8>, + /// Size of the compressed patch in bytes + pub patch_size_bytes: i32, + /// Number of files affected by this patch + pub files_count: i32, + pub created_at: DateTime<Utc>, + /// When this patch expires and will be automatically deleted + pub expires_at: DateTime<Utc>, +} + +/// Response for checkpoint patch (without binary data) +#[derive(Debug, Clone, FromRow, Serialize, ToSchema)] +#[serde(rename_all = "camelCase")] +pub struct CheckpointPatchInfo { + pub id: Uuid, + pub task_id: Uuid, + pub checkpoint_id: Option<Uuid>, + pub base_commit_sha: String, + pub patch_size_bytes: i32, + pub files_count: i32, + pub created_at: DateTime<Utc>, + pub expires_at: DateTime<Utc>, +} |
