From c146c9be18599ee334a0beeba34e8f89f49ceea2 Mon Sep 17 00:00:00 2001 From: Naitik Shah Date: Fri, 22 Apr 2016 22:25:05 +0200 Subject: [PATCH] rocksdb_create_mem_env to allow C libraries to create mem env (#1066) --- db/c.cc | 7 +++++++ include/rocksdb/c.h | 1 + 2 files changed, 8 insertions(+) diff --git a/db/c.cc b/db/c.cc index 8494d4d7b..55cfe4d93 100644 --- a/db/c.cc +++ b/db/c.cc @@ -2162,6 +2162,13 @@ rocksdb_env_t* rocksdb_create_default_env() { 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) { env->rep->SetBackgroundThreads(n); } diff --git a/include/rocksdb/c.h b/include/rocksdb/c.h index 92bc26255..a720a8cb1 100644 --- a/include/rocksdb/c.h +++ b/include/rocksdb/c.h @@ -844,6 +844,7 @@ extern ROCKSDB_LIBRARY_API void rocksdb_cache_destroy(rocksdb_cache_t* cache); /* 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( rocksdb_env_t* env, int n); extern ROCKSDB_LIBRARY_API void