Skip to content

Commit

Permalink
Merge branch '8.5.4-repair' into xcframework
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpablo committed Jan 18, 2024
2 parents a3e7c00 + a685be6 commit 991b46a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Code/RocksDB.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,10 @@ typedef void (^RestoreBlock)(NSError * __autoreleasing *);
- (nullable id)withBulkLoad:(id (NS_NOESCAPE ^)(void))actionBlock
error:(NSError * __autoreleasing *)error;

#pragma mark - Repair

+ (BOOL)repairDB:(NSString *)dbPath options:(RocksDBOptions *)options error:(NSError **)error;

@end

NS_ASSUME_NONNULL_END
15 changes: 15 additions & 0 deletions Code/RocksDB.mm
Original file line number Diff line number Diff line change
Expand Up @@ -804,4 +804,19 @@ - (nullable id)withBulkLoad:(id (NS_NOESCAPE ^)(void))actionBlock
return result;
}

#pragma mark - Repair

+ (BOOL)repairDB:(NSString *)dbPath options:(RocksDBOptions *)options error:(NSError **)error {
rocksdb::Status s = rocksdb::RepairDB(dbPath.UTF8String, options.options);

if (!s.ok()) {
if (error != NULL) {
*error = [RocksDBError errorWithRocksStatus:s];
}
return NO;
}

return YES;
}

@end

0 comments on commit 991b46a

Please sign in to comment.