Merge commit '90a3378b2d429e8105bdf56c27281450a40ff36c'

master
Niko PLP 1 year ago
commit 5ac4946462
  1. 15
      librocksdb-sys/rocksdb/db/c.cc
  2. 1
      librocksdb-sys/rocksdb/include/rocksdb/c.h

@ -46,6 +46,7 @@
#include "rocksdb/utilities/write_batch_with_index.h" #include "rocksdb/utilities/write_batch_with_index.h"
#include "rocksdb/write_batch.h" #include "rocksdb/write_batch.h"
#include "utilities/merge_operators.h" #include "utilities/merge_operators.h"
#include "rocksdb/env_encryption.h"
using ROCKSDB_NAMESPACE::BackupEngine; using ROCKSDB_NAMESPACE::BackupEngine;
using ROCKSDB_NAMESPACE::BackupEngineOptions; using ROCKSDB_NAMESPACE::BackupEngineOptions;
@ -4874,6 +4875,20 @@ rocksdb_env_t* rocksdb_create_default_env() {
return result; return result;
} }
rocksdb_env_t* rocksdb_create_encrypted_env(const char* key) {
rocksdb_env_t* result = new rocksdb_env_t;
std::shared_ptr<rocksdb::EncryptionProvider> provider;
Status status = rocksdb::EncryptionProvider::CreateFromString(
ConfigOptions(), "ippcp", &provider);
assert(status.ok());
status =
provider->AddCipher("", key, 32, false);
assert(status.ok());
result->rep = NewEncryptedEnv(Env::Default(), provider);
result->is_default = true;
return result;
}
rocksdb_env_t* rocksdb_create_mem_env() { rocksdb_env_t* rocksdb_create_mem_env() {
rocksdb_env_t* result = new rocksdb_env_t; rocksdb_env_t* result = new rocksdb_env_t;
result->rep = ROCKSDB_NAMESPACE::NewMemEnv(Env::Default()); result->rep = ROCKSDB_NAMESPACE::NewMemEnv(Env::Default());

@ -2097,6 +2097,7 @@ extern ROCKSDB_LIBRARY_API void rocksdb_dbpath_destroy(rocksdb_dbpath_t*);
/* Env */ /* Env */
extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_default_env(void); extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_default_env(void);
extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_encrypted_env(const char* key);
extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_mem_env(void); extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_mem_env(void);
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);

Loading…
Cancel
Save