fix: remove dead deep-verify TODO stub, route to RunDeepVerify
The VerifySnapshotWithOptions method had a dead code path for opts.Deep that printed 'not yet implemented' and returned nil. The CLI already routes --deep to RunDeepVerify (which is fully implemented). Remove the dead branch and update the VerifySnapshot convenience method to also route deep=true to RunDeepVerify. Fixes #2
This commit is contained in:
parent
470bf648c4
commit
46c2ea3079
@ -579,7 +579,11 @@ func (v *Vaultik) PurgeSnapshots(keepLatest bool, olderThan string, force bool)
|
|||||||
|
|
||||||
// VerifySnapshot checks snapshot integrity
|
// VerifySnapshot checks snapshot integrity
|
||||||
func (v *Vaultik) VerifySnapshot(snapshotID string, deep bool) error {
|
func (v *Vaultik) VerifySnapshot(snapshotID string, deep bool) error {
|
||||||
return v.VerifySnapshotWithOptions(snapshotID, &VerifyOptions{Deep: deep})
|
opts := &VerifyOptions{Deep: deep}
|
||||||
|
if deep {
|
||||||
|
return v.RunDeepVerify(snapshotID, opts)
|
||||||
|
}
|
||||||
|
return v.VerifySnapshotWithOptions(snapshotID, opts)
|
||||||
}
|
}
|
||||||
|
|
||||||
// VerifySnapshotWithOptions checks snapshot integrity with full options
|
// VerifySnapshotWithOptions checks snapshot integrity with full options
|
||||||
@ -652,25 +656,16 @@ func (v *Vaultik) VerifySnapshotWithOptions(snapshotID string, opts *VerifyOptio
|
|||||||
for _, blob := range manifest.Blobs {
|
for _, blob := range manifest.Blobs {
|
||||||
blobPath := fmt.Sprintf("blobs/%s/%s/%s", blob.Hash[:2], blob.Hash[2:4], blob.Hash)
|
blobPath := fmt.Sprintf("blobs/%s/%s/%s", blob.Hash[:2], blob.Hash[2:4], blob.Hash)
|
||||||
|
|
||||||
if opts.Deep {
|
// Just check existence (deep verification is handled by RunDeepVerify)
|
||||||
// Download and verify hash
|
_, err := v.Storage.Stat(v.ctx, blobPath)
|
||||||
// TODO: Implement deep verification
|
if err != nil {
|
||||||
if !opts.JSON {
|
if !opts.JSON {
|
||||||
fmt.Printf("Deep verification not yet implemented\n")
|
fmt.Printf(" Missing: %s (%s)\n", blob.Hash, humanize.Bytes(uint64(blob.CompressedSize)))
|
||||||
}
|
}
|
||||||
return nil
|
missing++
|
||||||
|
missingSize += blob.CompressedSize
|
||||||
} else {
|
} else {
|
||||||
// Just check existence
|
verified++
|
||||||
_, err := v.Storage.Stat(v.ctx, blobPath)
|
|
||||||
if err != nil {
|
|
||||||
if !opts.JSON {
|
|
||||||
fmt.Printf(" Missing: %s (%s)\n", blob.Hash, humanize.Bytes(uint64(blob.CompressedSize)))
|
|
||||||
}
|
|
||||||
missing++
|
|
||||||
missingSize += blob.CompressedSize
|
|
||||||
} else {
|
|
||||||
verified++
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user