Merge pull request #130 from donovanhide/master

Add rocksdb_open_for_read_only to C API
main
Igor Canadi 11 years ago
commit 7ca06a3974
  1. 14
      db/c.cc
  2. 6
      include/rocksdb/c.h

@ -330,6 +330,20 @@ rocksdb_t* rocksdb_open(
return result;
}
rocksdb_t* rocksdb_open_for_read_only(
const rocksdb_options_t* options,
const char* name,
unsigned char error_if_log_file_exist,
char** errptr) {
DB* db;
if (SaveError(errptr, DB::OpenForReadOnly(options->rep, std::string(name), &db, error_if_log_file_exist))) {
return nullptr;
}
rocksdb_t* result = new rocksdb_t;
result->rep = db;
return result;
}
void rocksdb_close(rocksdb_t* db) {
delete db->rep;
delete db;

@ -83,6 +83,12 @@ extern rocksdb_t* rocksdb_open(
const char* name,
char** errptr);
extern rocksdb_t* rocksdb_open_for_read_only(
const rocksdb_options_t* options,
const char* name,
unsigned char error_if_log_file_exist,
char** errptr);
extern void rocksdb_close(rocksdb_t* db);
extern void rocksdb_put(

Loading…
Cancel
Save