forked from dberesford/rocksdb-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeleteWorker.cc
More file actions
25 lines (20 loc) · 737 Bytes
/
DeleteWorker.cc
File metadata and controls
25 lines (20 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <nan.h>
#include "DeleteWorker.h"
#include "rocksdb/db.h"
DeleteWorker::DeleteWorker(Nan::Callback *callback, rocksdb::DB *db, rocksdb::ColumnFamilyHandle *family, rocksdb::Slice key, rocksdb::WriteOptions options)
: AsyncWorker(callback), _db(db), _family(family), _key(key), _options(options) {}
DeleteWorker::~DeleteWorker() {}
void DeleteWorker::Execute () {
_status = _db->Delete(_options, _family, _key);
}
void DeleteWorker::HandleOKCallback () {
Nan::HandleScope scope;
v8::Local<v8::Value> argv[1] = { Nan::Null() };
if (!_status.ok()) {
v8::Local<v8::Value> errv[1] = {};
errv[0] = Nan::Error(_status.getState());
callback->Call(1, errv);
return;
}
callback->Call(1, argv);
}