Squashed 'librocksdb-sys/rocksdb/' changes from 217f76421..a397fbd0e

a397fbd0e adding rocksdb_create_encrypted_env

git-subtree-dir: librocksdb-sys/rocksdb
git-subtree-split: a397fbd0e250e986da8d6ad87036578733068e1d
master
Niko PLP 1 year ago
parent 081ffa92ee
commit 90a3378b2d
  1. 15
      db/c.cc
  2. 1
      include/rocksdb/c.h

@ -46,6 +46,7 @@
#include "rocksdb/utilities/write_batch_with_index.h"
#include "rocksdb/write_batch.h"
#include "utilities/merge_operators.h"
#include "rocksdb/env_encryption.h"
using ROCKSDB_NAMESPACE::BackupEngine;
using ROCKSDB_NAMESPACE::BackupEngineOptions;
@ -4874,6 +4875,20 @@ rocksdb_env_t* rocksdb_create_default_env() {
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* result = new rocksdb_env_t;
result->rep = ROCKSDB_NAMESPACE::NewMemEnv(Env::Default());

@ -2097,6 +2097,7 @@ extern ROCKSDB_LIBRARY_API void rocksdb_dbpath_destroy(rocksdb_dbpath_t*);
/* Env */
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 void rocksdb_env_set_background_threads(
rocksdb_env_t* env, int n);

Loading…
Cancel
Save