Merge pull request #130 from donovanhide/master

Add rocksdb_open_for_read_only to C API
This commit is contained in:
Igor Canadi 2014-04-27 20:17:15 -04:00
commit 7ca06a3974
2 changed files with 20 additions and 0 deletions

14
db/c.cc
View file

@ -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;

View file

@ -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(