-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbdb_object.cc
More file actions
37 lines (27 loc) · 911 Bytes
/
bdb_object.cc
File metadata and controls
37 lines (27 loc) · 911 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
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2011 Mark Cavage <mcavage@gmail.com> All rights reserved.
#include "bdb_common.h"
#include "bdb_object.h"
#define ERR_MSG(RC) \
(RC == -2 ? "ConsistencyError" : db_strerror(RC))
int DbObject::EIO_After_ReturnStatus(eio_req *req) {
v8::HandleScope scope;
EIOBaton *baton = static_cast<EIOBaton *>(req->data);
ev_unref(EV_DEFAULT_UC);
DB_RES(baton->status, ERR_MSG(baton->status), msg);
v8::Local<v8::Value> argv[1] = { msg };
v8::TryCatch try_catch;
baton->cb->Call(v8::Context::GetCurrent()->Global(), 1, argv);
if (try_catch.HasCaught()) {
node::FatalException(try_catch);
}
baton->object->Unref();
delete baton;
return 0;
}
DbObject::DbObject() {}
DbObject::~DbObject() {}
// Start EIOBaton
EIOBaton::EIOBaton(DbObject *obj): object(obj), flags(0), status(0) {}
EIOBaton::~EIOBaton() {
cb.Dispose();
}