-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathOptionsHelper.h
23 lines (18 loc) · 945 Bytes
/
OptionsHelper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef OptionsHelper_h
#define OptionsHelper_h
#include <nan.h>
#include "rocksdb/db.h"
class OptionsHelper {
public:
static void ProcessOpenOptions(v8::Local<v8::Object>, rocksdb::Options *opts);
static void ProcessWriteOptions(v8::Local<v8::Object>, rocksdb::WriteOptions *opts);
static void ProcessReadOptions(v8::Local<v8::Object>, rocksdb::ReadOptions *opts);
static void ProcessCompactRangeOptions(v8::Local<v8::Object>, rocksdb::CompactRangeOptions *opts);
};
#define BOOLEAN_OPTION(name, opts, options) \
v8::Local<v8::String> name = Nan::New(#name).ToLocalChecked(); \
if (opts->Has(name)) options->name = opts->Get(name)->BooleanValue();
#define INT_OPTION(name, opts, options) \
v8::Local<v8::String> name = Nan::New(#name).ToLocalChecked(); \
if (opts->Has(name)) options->name = opts->Get(name)->IntegerValue();
#endif // OptionsHelper_h