- 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
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
package backup
|
|
|
|
import (
|
|
"git.eeqj.de/sneak/vaultik/internal/config"
|
|
"git.eeqj.de/sneak/vaultik/internal/database"
|
|
"git.eeqj.de/sneak/vaultik/internal/s3"
|
|
"github.com/spf13/afero"
|
|
"go.uber.org/fx"
|
|
)
|
|
|
|
// ScannerParams holds parameters for scanner creation
|
|
type ScannerParams struct {
|
|
EnableProgress bool
|
|
}
|
|
|
|
// Module exports backup functionality
|
|
var Module = fx.Module("backup",
|
|
fx.Provide(
|
|
provideScannerFactory,
|
|
),
|
|
)
|
|
|
|
// ScannerFactory creates scanners with custom parameters
|
|
type ScannerFactory func(params ScannerParams) *Scanner
|
|
|
|
func provideScannerFactory(cfg *config.Config, repos *database.Repositories, s3Client *s3.Client) ScannerFactory {
|
|
return func(params ScannerParams) *Scanner {
|
|
return NewScanner(ScannerConfig{
|
|
FS: afero.NewOsFs(),
|
|
ChunkSize: cfg.ChunkSize.Int64(),
|
|
Repositories: repos,
|
|
S3Client: s3Client,
|
|
MaxBlobSize: cfg.BlobSizeLimit.Int64(),
|
|
CompressionLevel: cfg.CompressionLevel,
|
|
AgeRecipients: cfg.AgeRecipients,
|
|
EnableProgress: params.EnableProgress,
|
|
})
|
|
}
|
|
}
|