Add get_immediate_commit() to the node.js binding
This commit is contained in:
@@ -19,6 +19,7 @@ NAN_MODULE_INIT(InitAddon)
|
|||||||
Nan::SetPrototypeMethod(tpl, "on_ready", NodeVitastor::OnReady);
|
Nan::SetPrototypeMethod(tpl, "on_ready", NodeVitastor::OnReady);
|
||||||
Nan::SetPrototypeMethod(tpl, "get_min_io_size", NodeVitastor::GetMinIoSize);
|
Nan::SetPrototypeMethod(tpl, "get_min_io_size", NodeVitastor::GetMinIoSize);
|
||||||
Nan::SetPrototypeMethod(tpl, "get_max_atomic_write_size", NodeVitastor::GetMaxAtomicWriteSize);
|
Nan::SetPrototypeMethod(tpl, "get_max_atomic_write_size", NodeVitastor::GetMaxAtomicWriteSize);
|
||||||
|
Nan::SetPrototypeMethod(tpl, "get_immediate_commit", NodeVitastor::GetImmediateCommit);
|
||||||
//Nan::SetPrototypeMethod(tpl, "destroy", NodeVitastor::Destroy);
|
//Nan::SetPrototypeMethod(tpl, "destroy", NodeVitastor::Destroy);
|
||||||
|
|
||||||
Nan::Set(target, Nan::New("Client").ToLocalChecked(), Nan::GetFunction(tpl).ToLocalChecked());
|
Nan::Set(target, Nan::New("Client").ToLocalChecked(), Nan::GetFunction(tpl).ToLocalChecked());
|
||||||
@@ -66,6 +67,10 @@ NAN_MODULE_INIT(InitAddon)
|
|||||||
Nan::Set(target, Nan::New("ENOSYS").ToLocalChecked(), Nan::New<v8::Int32>(-ENOSYS));
|
Nan::Set(target, Nan::New("ENOSYS").ToLocalChecked(), Nan::New<v8::Int32>(-ENOSYS));
|
||||||
Nan::Set(target, Nan::New("EAGAIN").ToLocalChecked(), Nan::New<v8::Int32>(-EAGAIN));
|
Nan::Set(target, Nan::New("EAGAIN").ToLocalChecked(), Nan::New<v8::Int32>(-EAGAIN));
|
||||||
|
|
||||||
|
Nan::Set(target, Nan::New("IMMEDIATE_NONE").ToLocalChecked(), Nan::New<v8::Int32>(IMMEDIATE_NONE));
|
||||||
|
Nan::Set(target, Nan::New("IMMEDIATE_SMALL").ToLocalChecked(), Nan::New<v8::Int32>(IMMEDIATE_SMALL));
|
||||||
|
Nan::Set(target, Nan::New("IMMEDIATE_ALL").ToLocalChecked(), Nan::New<v8::Int32>(IMMEDIATE_ALL));
|
||||||
|
|
||||||
// Listing handle
|
// Listing handle
|
||||||
|
|
||||||
tpl = Nan::New<v8::FunctionTemplate>(NodeVitastorKVListing::Create);
|
tpl = Nan::New<v8::FunctionTemplate>(NodeVitastorKVListing::Create);
|
||||||
|
|||||||
@@ -314,6 +314,17 @@ NAN_METHOD(NodeVitastor::GetMaxAtomicWriteSize)
|
|||||||
info.GetReturnValue().Set(Nan::New<v8::Number>(vitastor_c_inode_get_block_size(self->c, INODE_WITH_POOL(pool, 1))));
|
info.GetReturnValue().Set(Nan::New<v8::Number>(vitastor_c_inode_get_block_size(self->c, INODE_WITH_POOL(pool, 1))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// get_immediate_commit(pool_id)
|
||||||
|
NAN_METHOD(NodeVitastor::GetImmediateCommit)
|
||||||
|
{
|
||||||
|
TRACE("NodeVitastor::GetImmediateCommit");
|
||||||
|
if (info.Length() < 1)
|
||||||
|
Nan::ThrowError("Not enough arguments to get_immediate_commit(pool_id)");
|
||||||
|
NodeVitastor* self = Nan::ObjectWrap::Unwrap<NodeVitastor>(info.This());
|
||||||
|
uint64_t pool = get_ui64(info[0]);
|
||||||
|
info.GetReturnValue().Set(Nan::New<v8::Number>(vitastor_c_inode_get_immediate_commit(self->c, INODE_WITH_POOL(pool, 1))));
|
||||||
|
}
|
||||||
|
|
||||||
void NodeVitastor::on_read_finish(void *opaque, long retval, uint64_t version)
|
void NodeVitastor::on_read_finish(void *opaque, long retval, uint64_t version)
|
||||||
{
|
{
|
||||||
TRACE("NodeVitastor::on_read_finish");
|
TRACE("NodeVitastor::on_read_finish");
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ public:
|
|||||||
static NAN_METHOD(GetMinIoSize);
|
static NAN_METHOD(GetMinIoSize);
|
||||||
// get_max_atomic_write_size(pool_id)
|
// get_max_atomic_write_size(pool_id)
|
||||||
static NAN_METHOD(GetMaxAtomicWriteSize);
|
static NAN_METHOD(GetMaxAtomicWriteSize);
|
||||||
|
// get_immediate_commit(pool_id)
|
||||||
|
static NAN_METHOD(GetImmediateCommit);
|
||||||
// // destroy()
|
// // destroy()
|
||||||
// static NAN_METHOD(Destroy);
|
// static NAN_METHOD(Destroy);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user