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,15 +656,7 @@ 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
|
|
||||||
// TODO: Implement deep verification
|
|
||||||
if !opts.JSON {
|
|
||||||
fmt.Printf("Deep verification not yet implemented\n")
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
} else {
|
|
||||||
// Just check existence
|
|
||||||
_, err := v.Storage.Stat(v.ctx, blobPath)
|
_, err := v.Storage.Stat(v.ctx, blobPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !opts.JSON {
|
if !opts.JSON {
|
||||||
@ -672,7 +668,6 @@ func (v *Vaultik) VerifySnapshotWithOptions(snapshotID string, opts *VerifyOptio
|
|||||||
verified++
|
verified++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
result.Verified = verified
|
result.Verified = verified
|
||||||
result.Missing = missing
|
result.Missing = missing
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user