Remove the blob temp file when a backup stops part-way (closes #302)
check / check (push) Successful in 15m12s
check / check (push) Successful in 15m12s
When `snapshot create` stopped on a file error, a full temporary directory or Ctrl-C, the blob being packed was never finalized, and its `vaultik-blob-*.tmp` file (up to `blob_size_limit` of encrypted data) stayed in `$TMPDIR`. Phase 2 now calls the new `Packer.DiscardCurrentBlob` on the way out, which closes and removes that file. After a successful flush no blob is in progress, so the call then does nothing. The blob's row in the local index is left, as before, for the next run's repair of interrupted blobs to remove. Model: opus-5-5
This commit was merged in pull request #347.
This commit is contained in:
@@ -245,6 +245,17 @@ func (p *Packer) Flush(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// DiscardCurrentBlob closes and removes the temp file of the blob being
|
||||
// packed, if any, and drops that blob. A caller that stops before Flush
|
||||
// must call it, or the temp file is left behind. Thread-safe.
|
||||
func (p *Packer) DiscardCurrentBlob() {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
|
||||
p.cleanupTempFile()
|
||||
p.currentBlob = nil
|
||||
}
|
||||
|
||||
// FinalizeBlob finalizes the current blob being assembled.
|
||||
// This compresses the accumulated chunks, encrypts the result, and computes
|
||||
// the content-addressed hash. The finalized blob is either passed to the
|
||||
|
||||
Reference in New Issue
Block a user