Fix formatting

main
Igor Canadi 10 years ago
parent ee4aa9a0ee
commit aaceef3638
  1. 47
      db/c.cc
  2. 3
      examples/c_simple_example.c

@ -536,11 +536,10 @@ rocksdb_t* rocksdb_open_for_read_only(
} }
rocksdb_backup_engine_t* rocksdb_backup_engine_open( rocksdb_backup_engine_t* rocksdb_backup_engine_open(
const rocksdb_options_t* options, const rocksdb_options_t* options, const char* path, char** errptr) {
const char* path,
char** errptr) {
BackupEngine* be; BackupEngine* be;
if (SaveError(errptr, BackupEngine::Open(options->rep.env, BackupableDBOptions(path), &be))) { if (SaveError(errptr, BackupEngine::Open(options->rep.env,
BackupableDBOptions(path), &be))) {
return nullptr; return nullptr;
} }
rocksdb_backup_engine_t* result = new rocksdb_backup_engine_t; rocksdb_backup_engine_t* result = new rocksdb_backup_engine_t;
@ -548,10 +547,8 @@ rocksdb_backup_engine_t* rocksdb_backup_engine_open(
return result; return result;
} }
void rocksdb_backup_engine_create_new_backup( void rocksdb_backup_engine_create_new_backup(rocksdb_backup_engine_t* be,
rocksdb_backup_engine_t *be, rocksdb_t* db, char** errptr) {
rocksdb_t *db,
char** errptr) {
SaveError(errptr, be->rep->CreateNewBackup(db->rep)); SaveError(errptr, be->rep->CreateNewBackup(db->rep));
} }
@ -563,18 +560,17 @@ void rocksdb_restore_options_destroy(rocksdb_restore_options_t* opt) {
delete opt; delete opt;
} }
void rocksdb_restore_options_set_keep_log_files( void rocksdb_restore_options_set_keep_log_files(rocksdb_restore_options_t* opt,
rocksdb_restore_options_t* opt, int v) { int v) {
opt->rep.keep_log_files = v; opt->rep.keep_log_files = v;
} }
void rocksdb_backup_engine_restore_db_from_latest_backup( void rocksdb_backup_engine_restore_db_from_latest_backup(
rocksdb_backup_engine_t *be, rocksdb_backup_engine_t* be, const char* db_dir, const char* wal_dir,
const char* db_dir, const rocksdb_restore_options_t* restore_options, char** errptr) {
const char* wal_dir, SaveError(errptr, be->rep->RestoreDBFromLatestBackup(std::string(db_dir),
const rocksdb_restore_options_t *restore_options, std::string(wal_dir),
char** errptr) { restore_options->rep));
SaveError(errptr, be->rep->RestoreDBFromLatestBackup(std::string(db_dir), std::string(wal_dir), restore_options->rep));
} }
const rocksdb_backup_engine_info_t* rocksdb_backup_engine_get_backup_info( const rocksdb_backup_engine_info_t* rocksdb_backup_engine_get_backup_info(
@ -584,32 +580,27 @@ const rocksdb_backup_engine_info_t* rocksdb_backup_engine_get_backup_info(
return result; return result;
} }
int rocksdb_backup_engine_info_count( int rocksdb_backup_engine_info_count(const rocksdb_backup_engine_info_t* info) {
const rocksdb_backup_engine_info_t* info) {
return static_cast<int>(info->rep.size()); return static_cast<int>(info->rep.size());
} }
const int64_t rocksdb_backup_engine_info_timestamp( const int64_t rocksdb_backup_engine_info_timestamp(
const rocksdb_backup_engine_info_t* info, const rocksdb_backup_engine_info_t* info, int index) {
int index) {
return info->rep[index].timestamp; return info->rep[index].timestamp;
} }
const uint32_t rocksdb_backup_engine_info_backup_id( const uint32_t rocksdb_backup_engine_info_backup_id(
const rocksdb_backup_engine_info_t* info, const rocksdb_backup_engine_info_t* info, int index) {
int index) {
return info->rep[index].backup_id; return info->rep[index].backup_id;
} }
const uint64_t rocksdb_backup_engine_info_size( const uint64_t rocksdb_backup_engine_info_size(
const rocksdb_backup_engine_info_t* info, const rocksdb_backup_engine_info_t* info, int index) {
int index) {
return info->rep[index].size; return info->rep[index].size;
} }
const uint32_t rocksdb_backup_engine_info_number_files( const uint32_t rocksdb_backup_engine_info_number_files(
const rocksdb_backup_engine_info_t* info, const rocksdb_backup_engine_info_t* info, int index) {
int index) {
return info->rep[index].number_files; return info->rep[index].number_files;
} }
@ -618,13 +609,11 @@ void rocksdb_backup_engine_info_destroy(
delete info; delete info;
} }
void rocksdb_backup_engine_close( void rocksdb_backup_engine_close(rocksdb_backup_engine_t* be) {
rocksdb_backup_engine_t *be) {
delete be->rep; delete be->rep;
delete be; delete be;
} }
void rocksdb_close(rocksdb_t* db) { void rocksdb_close(rocksdb_t* db) {
delete db->rep; delete db->rep;
delete db; delete db;

@ -55,7 +55,8 @@ int main(int argc, char **argv) {
// If something is wrong, you might want to restore data from last backup // If something is wrong, you might want to restore data from last backup
rocksdb_restore_options_t *restore_options = rocksdb_restore_options_create(); rocksdb_restore_options_t *restore_options = rocksdb_restore_options_create();
rocksdb_backup_engine_restore_db_from_latest_backup(be, DBPath, DBPath, restore_options, &err); rocksdb_backup_engine_restore_db_from_latest_backup(be, DBPath, DBPath,
restore_options, &err);
assert(!err); assert(!err);
rocksdb_restore_options_destroy(restore_options); rocksdb_restore_options_destroy(restore_options);

Loading…
Cancel
Save