Refactor blob storage to use UUID primary keys and implement streaming chunking
- Changed blob table to use ID (UUID) as primary key instead of hash - Blob records are now created at packing start, enabling immediate chunk associations - Implemented streaming chunking to process large files without memory exhaustion - Fixed blob manifest generation to include all referenced blobs - Updated all foreign key references from blob_hash to blob_id - Added progress reporting and improved error handling - Enforced encryption requirement for all blob packing - Updated tests to use test encryption keys - Added Cyrillic transliteration to README
This commit is contained in:
@@ -35,13 +35,18 @@ type Chunk struct {
|
||||
|
||||
// Blob represents a blob record in the database
|
||||
type Blob struct {
|
||||
BlobHash string
|
||||
CreatedTS time.Time
|
||||
ID string
|
||||
Hash string // Can be empty until blob is finalized
|
||||
CreatedTS time.Time
|
||||
FinishedTS *time.Time // nil if not yet finalized
|
||||
UncompressedSize int64
|
||||
CompressedSize int64
|
||||
UploadedTS *time.Time // nil if not yet uploaded
|
||||
}
|
||||
|
||||
// BlobChunk represents the mapping between blobs and chunks
|
||||
type BlobChunk struct {
|
||||
BlobHash string
|
||||
BlobID string
|
||||
ChunkHash string
|
||||
Offset int64
|
||||
Length int64
|
||||
@@ -60,7 +65,8 @@ type Snapshot struct {
|
||||
ID string
|
||||
Hostname string
|
||||
VaultikVersion string
|
||||
CreatedTS time.Time
|
||||
StartedAt time.Time
|
||||
CompletedAt *time.Time // nil if still in progress
|
||||
FileCount int64
|
||||
ChunkCount int64
|
||||
BlobCount int64
|
||||
@@ -68,3 +74,21 @@ type Snapshot struct {
|
||||
BlobSize int64 // Total size of all referenced blobs (compressed and encrypted)
|
||||
CompressionRatio float64 // Compression ratio (BlobSize / TotalSize)
|
||||
}
|
||||
|
||||
// IsComplete returns true if the snapshot has completed
|
||||
func (s *Snapshot) IsComplete() bool {
|
||||
return s.CompletedAt != nil
|
||||
}
|
||||
|
||||
// SnapshotFile represents the mapping between snapshots and files
|
||||
type SnapshotFile struct {
|
||||
SnapshotID string
|
||||
FilePath string
|
||||
}
|
||||
|
||||
// SnapshotBlob represents the mapping between snapshots and blobs
|
||||
type SnapshotBlob struct {
|
||||
SnapshotID string
|
||||
BlobID string
|
||||
BlobHash string // Denormalized for easier manifest generation
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user