feat: add streaming tar export/import and rename "none" to "raw"

- Add streaming tar-based export (--export produces .keep.tar)
- Add streaming tar import (--import reads .keep.tar archives)
- Add server endpoints GET /api/export and POST /api/import
- Rename CompressionType::None to CompressionType::Raw with "none" as alias
- Add DB migration to update existing "none" compression values to "raw"
- Fix export endpoint to propagate errors to client instead of swallowing
- Fix import endpoint to return 413 on max_body_size instead of truncating

Export streams items as tar archives without loading entire files into memory.
Import extracts items with new IDs, preserving original order. Both work
locally and via client/server mode.

Co-Authored-By: opencode <noreply@opencode.ai>
This commit is contained in:
2026-03-17 21:24:39 -03:00
parent 074ba64805
commit 49793a0f94
36 changed files with 1413 additions and 189 deletions

View File

@@ -77,6 +77,7 @@ lazy_static! {
),
M::up("CREATE INDEX idx_tags_name ON tags(name)"),
M::up("CREATE INDEX idx_metas_name ON metas(name)"),
M::up("UPDATE items SET compression = 'raw' WHERE compression = 'none'"),
]);
}
@@ -298,7 +299,7 @@ pub fn create_item(
///
/// * `conn` - Database connection.
/// * `ts` - Timestamp to use for the item.
/// * `compression` - Compression type string (e.g., "lz4", "gzip", "none").
/// * `compression` - Compression type string (e.g., "lz4", "gzip", "raw").
///
/// # Returns
///