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

main
Naitik Shah 9 years ago committed by Siying Dong
parent 6da70c5815
commit c146c9be18
  1. 7
      db/c.cc
  2. 1
      include/rocksdb/c.h

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

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

Loading…
Cancel
Save