rocksdb_create_mem_env to allow C libraries to create mem env (#1066)

This commit is contained in:
Naitik Shah 2016-04-22 22:25:05 +02:00 committed by Siying Dong
parent 6da70c5815
commit c146c9be18
2 changed files with 8 additions and 0 deletions

View File

@ -2162,6 +2162,13 @@ rocksdb_env_t* rocksdb_create_default_env() {
return result; return result;
} }
rocksdb_env_t* rocksdb_create_mem_env() {
rocksdb_env_t* result = new rocksdb_env_t;
result->rep = rocksdb::NewMemEnv(Env::Default());
result->is_default = false;
return result;
}
void rocksdb_env_set_background_threads(rocksdb_env_t* env, int n) { void rocksdb_env_set_background_threads(rocksdb_env_t* env, int n) {
env->rep->SetBackgroundThreads(n); env->rep->SetBackgroundThreads(n);
} }

View File

@ -844,6 +844,7 @@ extern ROCKSDB_LIBRARY_API void rocksdb_cache_destroy(rocksdb_cache_t* cache);
/* Env */ /* Env */
extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_default_env(); extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_default_env();
extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_mem_env();
extern ROCKSDB_LIBRARY_API void rocksdb_env_set_background_threads( extern ROCKSDB_LIBRARY_API void rocksdb_env_set_background_threads(
rocksdb_env_t* env, int n); rocksdb_env_t* env, int n);
extern ROCKSDB_LIBRARY_API void extern ROCKSDB_LIBRARY_API void