Skip to content

Commit

Permalink
add BackupEngine.VerifyBackup, tecbot#182
Browse files Browse the repository at this point in the history
  • Loading branch information
flier committed Mar 19, 2021
1 parent f0fad39 commit 79d1b6f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,19 @@ func (b *BackupEngine) PurgeOldBackups(n uint32) error {
return nil
}

// VerifyBackup checks the file sizes in the backup directory
// against the original sizes of the corresponding files in the db directory.
// It does not check file checksum.
func (b *BackupEngine) VerifyBackup(id int64) error {
var cErr *C.char
C.rocksdb_backup_engine_verify_backup(b.c, C.uint32_t(id), &cErr)
if cErr != nil {
defer C.rocksdb_free(unsafe.Pointer(cErr))
return errors.New(C.GoString(cErr))
}
return nil
}

// Close close the backup engine and cleans up state
// The backups already taken remain on storage.
func (b *BackupEngine) Close() {
Expand Down

0 comments on commit 79d1b6f

Please sign in to comment.