k2hdkc 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.auditignore +1 -0
- package/ChangeLog +23 -0
- package/README.md +3 -7
- package/index.js +7 -4
- package/package.json +6 -10
- package/src/binding.gyp +69 -0
- package/src/k2hdkc.cc +7 -4
- package/src/k2hdkc_cbs.cc +7 -4
- package/src/k2hdkc_cbs.h +7 -4
- package/src/k2hdkc_common.h +7 -4
- package/src/k2hdkc_node.cc +33 -31
- package/src/k2hdkc_node.h +7 -4
- package/src/k2hdkc_node_async.h +11 -8
- package/binding.gyp +0 -63
package/.auditignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
https://npmjs.com/advisories/1673
|
package/ChangeLog
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
k2hdkc (1.0.3) unstable; urgency=low
|
|
2
|
+
|
|
3
|
+
* Added build flags and removed unnecessary files - #36
|
|
4
|
+
* Updated header and footer in comment lines - #35
|
|
5
|
+
* Updated issue/pullrequest templates and README.md - #33
|
|
6
|
+
* Reviewed ShellCheck processing again - #32
|
|
7
|
+
* Reviewed ShellCheck processing and fixed bugs - #31
|
|
8
|
+
* Eliminated unnecessary copies in nodejs_helper.sh - #30
|
|
9
|
+
* Updated packages - #29
|
|
10
|
+
* Updated github actions and nodejs version, and fixed bugs - #28
|
|
11
|
+
* Changed run_process_helper.sh simply instead of the which command etc - #27
|
|
12
|
+
* Renamed the test directory to tests and run_test.sh to test.sh - #26
|
|
13
|
+
* Removed install entry from scripts in package.json file - #25
|
|
14
|
+
* Cleaned up package.json and updated related package versions - #24
|
|
15
|
+
|
|
16
|
+
-- Takeshi Nakatani <ggtakec@gmail.com> Fri, 17 Feb 2023 22:25:53 +0900
|
|
17
|
+
|
|
18
|
+
k2hdkc (1.0.2) unstable; urgency=low
|
|
19
|
+
|
|
20
|
+
* Updated some npm packages, added .auditignore, etc - #22
|
|
21
|
+
|
|
22
|
+
-- Takeshi Nakatani <ggtakec@gmail.com> Thu, 26 Aug 2021 11:40:52 +0900
|
|
23
|
+
|
|
1
24
|
k2hdkc (1.0.1) unstable; urgency=low
|
|
2
25
|
|
|
3
26
|
* Updated package.json for mocha and chai - #20
|
package/README.md
CHANGED
|
@@ -7,15 +7,14 @@ k2hdkc nodejs addon library
|
|
|
7
7
|
[](https://github.com/yahoojapan/k2hdkc_nodejs/issues)
|
|
8
8
|
[](https://badge.fury.io/js/k2hdkc)
|
|
9
9
|
|
|
10
|
-
K2HDKC addon library for Node.js
|
|
11
|
-
- K2HDKC - K2Hash based Distributed Kvs Cluster by Yahoo! JAPAN
|
|
10
|
+
K2HDKC addon library for Node.js
|
|
12
11
|
|
|
13
12
|
### Overview
|
|
14
13
|
K2HDKC is k2hash based distributed KVS cluster server program and client library by Yahoo! JAPAN.
|
|
15
14
|
This addon library is for using K2HASH on nodejs.
|
|
16
15
|
|
|
17
16
|
By k2hdkc nodejs addon library, you can easily create K2HDKC slave client program in JavaScript language.
|
|
18
|
-
For details on the features and functions of k2hdkc nodejs,
|
|
17
|
+
For details on the features and functions of k2hdkc nodejs, see the [k2hdkc nodejs documentation](https://nodejs.k2hdkc.antpick.ax/) and [k2hdkc documentation](https://k2hdkc.antpick.ax/).
|
|
19
18
|
|
|
20
19
|

|
|
21
20
|
|
|
@@ -38,13 +37,10 @@ $ npm install k2hdkc
|
|
|
38
37
|
- [NPM packages](https://www.npmjs.com/package/k2hdkc)
|
|
39
38
|
- [NPM antpickax](https://www.npmjs.com/org/antpickax)
|
|
40
39
|
|
|
41
|
-
### Related products
|
|
42
|
-
- [K2HDKC Database As A Service(DBaaS)](https://dbaas.k2hdkc.antpick.ax/)
|
|
43
|
-
|
|
44
40
|
### License
|
|
45
41
|
This software is released under the MIT License, see the license file.
|
|
46
42
|
|
|
47
43
|
### AntPickax
|
|
48
44
|
CHMPX is one of [AntPickax](https://antpick.ax/) products.
|
|
49
45
|
|
|
50
|
-
Copyright(C) 2017 Yahoo
|
|
46
|
+
Copyright(C) 2017 Yahoo Japan Corporation.
|
package/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* K2HDKC
|
|
3
3
|
*
|
|
4
|
-
* Copyright 2017 Yahoo
|
|
4
|
+
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
5
|
*
|
|
6
6
|
* K2HDKC is k2hash based distributed KVS cluster.
|
|
7
7
|
* K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
module.exports = require('bindings')('k2hdkc');
|
|
21
21
|
|
|
22
22
|
/*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
23
|
+
* Local variables:
|
|
24
|
+
* tab-width: 4
|
|
25
|
+
* c-basic-offset: 4
|
|
26
|
+
* End:
|
|
27
|
+
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
28
|
+
* vim<600: noexpandtab sw=4 ts=4
|
|
26
29
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "k2hdkc",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "K2HDKC addon library for Node.js",
|
|
5
5
|
"os": "linux",
|
|
6
6
|
"main": "index.js",
|
|
@@ -9,12 +9,11 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"bindings": "^1.5.0",
|
|
12
|
-
"nan": "^2.
|
|
12
|
+
"nan": "^2.17.0"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"chai": "^4.3.
|
|
16
|
-
"mocha": "^
|
|
17
|
-
"publish-please": "^5.5.2"
|
|
15
|
+
"chai": "^4.3.7",
|
|
16
|
+
"mocha": "^10.2.0"
|
|
18
17
|
},
|
|
19
18
|
"scripts": {
|
|
20
19
|
"build": "npm run build:before && npm run build:configure && npm run build:rebuild && npm run build:linkdir && npm run build:after",
|
|
@@ -23,12 +22,9 @@
|
|
|
23
22
|
"build:rebuild": "if [ -f src/binding.gyp ]; then cd src; fi && node-gyp rebuild --verbose --release --target_arch=x64 --coverage=true",
|
|
24
23
|
"build:linkdir": "if [ ! -f build -a ! -s build ]; then ln -s src/build .; fi",
|
|
25
24
|
"build:after": "echo \"Build - Succeed\"",
|
|
26
|
-
"install": "npm run build",
|
|
27
25
|
"test": "npm run test:all",
|
|
28
|
-
"test:all": "echo \"Test - k2hdkc all\" &&
|
|
29
|
-
"test:k2hdkc": "echo \"Test - k2hdkc k2hdkc\" &&
|
|
30
|
-
"publish-please": "publish-please",
|
|
31
|
-
"prepublishOnly": "publish-please guard"
|
|
26
|
+
"test:all": "echo \"Test - k2hdkc all\" && tests/test.sh k2hdkc && echo \"Finished\"",
|
|
27
|
+
"test:k2hdkc": "echo \"Test - k2hdkc k2hdkc\" && tests/test.sh k2hdkc && echo \"Finished\""
|
|
32
28
|
},
|
|
33
29
|
"repository": {
|
|
34
30
|
"type": "git",
|
package/src/binding.gyp
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#
|
|
2
|
+
# K2HDKC
|
|
3
|
+
#
|
|
4
|
+
# Copyright 2017 Yahoo Japan Corporation.
|
|
5
|
+
#
|
|
6
|
+
# K2HDKC is k2hash based distributed KVS cluster.
|
|
7
|
+
# K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
8
|
+
# distributed KVS cluster server program and client libraries.
|
|
9
|
+
#
|
|
10
|
+
# For the full copyright and license information, please view
|
|
11
|
+
# the license file that was distributed with this source code.
|
|
12
|
+
#
|
|
13
|
+
# AUTHOR: Takeshi Nakatani
|
|
14
|
+
# CREATE: Fri 10 Mar 2017
|
|
15
|
+
# REVISION:
|
|
16
|
+
#
|
|
17
|
+
|
|
18
|
+
{
|
|
19
|
+
"variables": {
|
|
20
|
+
"coverage": "false"
|
|
21
|
+
},
|
|
22
|
+
"targets": [
|
|
23
|
+
{
|
|
24
|
+
"target_name": "k2hdkc",
|
|
25
|
+
"sources": [
|
|
26
|
+
"k2hdkc.cc",
|
|
27
|
+
"k2hdkc_node.cc",
|
|
28
|
+
"k2hdkc_cbs.cc"
|
|
29
|
+
],
|
|
30
|
+
"cflags": [
|
|
31
|
+
#
|
|
32
|
+
# We get too many deprecated message building with nodejs 0.12.x.
|
|
33
|
+
# Those messages are depricated functions/methods, but we do not use those.
|
|
34
|
+
# So that we ignore these deprecated warning here.
|
|
35
|
+
#
|
|
36
|
+
"-Wno-deprecated",
|
|
37
|
+
#
|
|
38
|
+
# For nodejs 9.x/10.x, it puts about MakeCallback / CreateDataProperty / DefineOwnProperty
|
|
39
|
+
#
|
|
40
|
+
"-Wno-deprecated-declarations",
|
|
41
|
+
#
|
|
42
|
+
# For nodejs 12.x/..., it suppress warnings: "'deprecated' attribute directive ignored"
|
|
43
|
+
#
|
|
44
|
+
"-Wno-attributes",
|
|
45
|
+
#
|
|
46
|
+
# nodejs/nan#807(https://github.com/nodejs/nan/issues/807#issuecomment-455750192)
|
|
47
|
+
# recommends using the "-Wno-cast-function-type" to silence deprecations warnings
|
|
48
|
+
# that appear with GCC 8.
|
|
49
|
+
#
|
|
50
|
+
"-Wno-cast-function-type"
|
|
51
|
+
],
|
|
52
|
+
"include_dirs": [
|
|
53
|
+
"<!(node -e \"require('nan')\")"
|
|
54
|
+
],
|
|
55
|
+
"libraries": [
|
|
56
|
+
"-lk2hdkc"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#
|
|
63
|
+
# Local variables:
|
|
64
|
+
# tab-width: 4
|
|
65
|
+
# c-basic-offset: 4
|
|
66
|
+
# End:
|
|
67
|
+
# vim600: expandtab sw=4 ts=4 fdm=marker
|
|
68
|
+
# vim<600: expandtab sw=4 ts=4
|
|
69
|
+
#
|
package/src/k2hdkc.cc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* K2HDKC
|
|
3
3
|
*
|
|
4
|
-
* Copyright 2017 Yahoo
|
|
4
|
+
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
5
|
*
|
|
6
6
|
* K2HDKC is k2hash based distributed KVS cluster.
|
|
7
7
|
* K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
@@ -36,7 +36,10 @@ void InitAll(Local<Object> exports, Local<Object> module)
|
|
|
36
36
|
NODE_MODULE(k2hdkc , InitAll)
|
|
37
37
|
|
|
38
38
|
/*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* Local variables:
|
|
40
|
+
* tab-width: 4
|
|
41
|
+
* c-basic-offset: 4
|
|
42
|
+
* End:
|
|
43
|
+
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
44
|
+
* vim<600: noexpandtab sw=4 ts=4
|
|
42
45
|
*/
|
package/src/k2hdkc_cbs.cc
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* K2HDKC
|
|
3
3
|
*
|
|
4
|
-
* Copyright 2017 Yahoo
|
|
4
|
+
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
5
|
*
|
|
6
6
|
* K2HDKC is k2hash based distributed KVS cluster.
|
|
7
7
|
* K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
@@ -102,7 +102,10 @@ bool StackEmitCB::Unset(const char* pemitname)
|
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
/*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
105
|
+
* Local variables:
|
|
106
|
+
* tab-width: 4
|
|
107
|
+
* c-basic-offset: 4
|
|
108
|
+
* End:
|
|
109
|
+
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
110
|
+
* vim<600: noexpandtab sw=4 ts=4
|
|
108
111
|
*/
|
package/src/k2hdkc_cbs.h
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* K2HDKC
|
|
3
3
|
*
|
|
4
|
-
* Copyright 2017 Yahoo
|
|
4
|
+
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
5
|
*
|
|
6
6
|
* K2HDKC is k2hash based distributed KVS cluster.
|
|
7
7
|
* K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
@@ -49,7 +49,10 @@ class StackEmitCB
|
|
|
49
49
|
#endif
|
|
50
50
|
|
|
51
51
|
/*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
52
|
+
* Local variables:
|
|
53
|
+
* tab-width: 4
|
|
54
|
+
* c-basic-offset: 4
|
|
55
|
+
* End:
|
|
56
|
+
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
57
|
+
* vim<600: noexpandtab sw=4 ts=4
|
|
55
58
|
*/
|
package/src/k2hdkc_common.h
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* K2HDKC
|
|
3
3
|
*
|
|
4
|
-
* Copyright 2017 Yahoo
|
|
4
|
+
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
5
|
*
|
|
6
6
|
* K2HDKC is k2hash based distributed KVS cluster.
|
|
7
7
|
* K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
@@ -37,7 +37,10 @@
|
|
|
37
37
|
#endif
|
|
38
38
|
|
|
39
39
|
/*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* Local variables:
|
|
41
|
+
* tab-width: 4
|
|
42
|
+
* c-basic-offset: 4
|
|
43
|
+
* End:
|
|
44
|
+
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
45
|
+
* vim<600: noexpandtab sw=4 ts=4
|
|
43
46
|
*/
|
package/src/k2hdkc_node.cc
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* K2HDKC
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2017 Yahoo
|
|
5
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
|
+
*
|
|
6
6
|
* K2HDKC is k2hash based distributed KVS cluster.
|
|
7
7
|
* K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
8
8
|
* distributed KVS cluster server program and client libraries.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* For the full copyright and license information, please view
|
|
11
11
|
* the license file that was distributed with this source code.
|
|
12
12
|
*
|
|
@@ -281,25 +281,24 @@ NAN_METHOD(K2hdkcNode::New)
|
|
|
281
281
|
if(0 < info.Length()){
|
|
282
282
|
// create permanent connection at initializing
|
|
283
283
|
int argpos = 0;
|
|
284
|
-
std::string conf("");
|
|
285
284
|
int16_t ctlport = CHM_INVALID_PORT;
|
|
286
|
-
std::string cuk("");
|
|
287
|
-
bool auto_rejoin = false;
|
|
288
|
-
bool no_giveup_rejoin= false;
|
|
289
285
|
|
|
290
286
|
if(!info[argpos]->IsString()){
|
|
291
287
|
Nan::ThrowSyntaxError("First parameter is not configuration");
|
|
292
288
|
}else{
|
|
293
289
|
// 1'st argument is conf
|
|
294
290
|
Nan::Utf8String buf(info[argpos++]);
|
|
295
|
-
conf
|
|
291
|
+
std::string conf = std::string(*buf);
|
|
292
|
+
std::string cuk("");
|
|
293
|
+
bool auto_rejoin = false;
|
|
294
|
+
bool no_giveup_rejoin= false;
|
|
296
295
|
if(argpos < info.Length() && info[argpos]->IsNumber()){
|
|
297
296
|
// 2'nd argument is port
|
|
298
297
|
ctlport = static_cast<int16_t>(Nan::To<int32_t>(info[argpos++]).FromJust());
|
|
299
298
|
if(argpos < info.Length() && (info[argpos]->IsString() || info[argpos]->IsNull())){
|
|
300
299
|
// 3'rd argument is cuk
|
|
301
|
-
Nan::Utf8String
|
|
302
|
-
cuk = std::string(*
|
|
300
|
+
Nan::Utf8String buf2(info[argpos++]);
|
|
301
|
+
cuk = std::string(*buf2);
|
|
303
302
|
if(argpos < info.Length() && info[argpos]->IsBoolean()){
|
|
304
303
|
// 4'th argument is auto rejoin
|
|
305
304
|
auto_rejoin = Nan::To<bool>(info[argpos++]).FromJust();
|
|
@@ -325,8 +324,8 @@ NAN_METHOD(K2hdkcNode::New)
|
|
|
325
324
|
|
|
326
325
|
}else if(argpos < info.Length() && (info[argpos]->IsString() || info[argpos]->IsNull())){
|
|
327
326
|
// 2'nd argument is cuk
|
|
328
|
-
Nan::Utf8String
|
|
329
|
-
cuk = std::string(*
|
|
327
|
+
Nan::Utf8String buf3(info[argpos++]);
|
|
328
|
+
cuk = std::string(*buf3);
|
|
330
329
|
if(argpos < info.Length() && info[argpos]->IsBoolean()){
|
|
331
330
|
// 3'rd argument is auto rejoin
|
|
332
331
|
auto_rejoin = Nan::To<bool>(info[argpos++]).FromJust();
|
|
@@ -1060,8 +1059,8 @@ NAN_METHOD(K2hdkcNode::Init)
|
|
|
1060
1059
|
|
|
1061
1060
|
if(argpos < info.Length() && (info[argpos]->IsString() || info[argpos]->IsNull())){
|
|
1062
1061
|
// 3'rd argument is cuk
|
|
1063
|
-
Nan::Utf8String
|
|
1064
|
-
cuk = std::string(*
|
|
1062
|
+
Nan::Utf8String buf2(info[argpos++]);
|
|
1063
|
+
cuk = std::string(*buf2);
|
|
1065
1064
|
if(argpos < info.Length() && info[argpos]->IsBoolean()){
|
|
1066
1065
|
// 4'th argument is auto rejoin
|
|
1067
1066
|
auto_rejoin = Nan::To<bool>(info[argpos++]).FromJust();
|
|
@@ -1122,8 +1121,8 @@ NAN_METHOD(K2hdkcNode::Init)
|
|
|
1122
1121
|
|
|
1123
1122
|
}else if(argpos < info.Length() && (info[argpos]->IsString() || info[argpos]->IsNull())){
|
|
1124
1123
|
// 2'nd argument is cuk
|
|
1125
|
-
Nan::Utf8String
|
|
1126
|
-
cuk = std::string(*
|
|
1124
|
+
Nan::Utf8String buf3(info[argpos++]);
|
|
1125
|
+
cuk = std::string(*buf3);
|
|
1127
1126
|
if(argpos < info.Length() && info[argpos]->IsBoolean()){
|
|
1128
1127
|
// 3'rd argument is auto rejoin
|
|
1129
1128
|
auto_rejoin = Nan::To<bool>(info[argpos++]).FromJust();
|
|
@@ -1503,8 +1502,8 @@ NAN_METHOD(K2hdkcNode::GetValue)
|
|
|
1503
1502
|
size_t valtmplen = 0L;
|
|
1504
1503
|
bool result = pComObj->CommandSend(reinterpret_cast<const unsigned char*>(strkey.c_str()), strkey.length() + 1, attrchk, (is_pass_set ? strpass.c_str() : NULL), &pvaltmp, &valtmplen, &rescode);
|
|
1505
1504
|
if(result && (pvaltmp && 0 < valtmplen)){
|
|
1506
|
-
string
|
|
1507
|
-
info.GetReturnValue().Set(Nan::New<String>(
|
|
1505
|
+
string strresult(reinterpret_cast<const char*>(pvaltmp), valtmplen);
|
|
1506
|
+
info.GetReturnValue().Set(Nan::New<String>(strresult.c_str()).ToLocalChecked());
|
|
1508
1507
|
}else{
|
|
1509
1508
|
info.GetReturnValue().Set(Nan::Null());
|
|
1510
1509
|
}
|
|
@@ -2066,12 +2065,12 @@ NAN_METHOD(K2hdkcNode::SetSubkeys)
|
|
|
2066
2065
|
Local<Array> inSubkeys = Local<Array>::Cast(info[argpos++]);
|
|
2067
2066
|
K2HSubKeys Subkeys;
|
|
2068
2067
|
for(int pos = 0; pos < static_cast<int>(inSubkeys->Length()); ++pos){
|
|
2069
|
-
string
|
|
2068
|
+
string tmpkey;
|
|
2070
2069
|
{
|
|
2071
2070
|
Nan::Utf8String buf(Nan::Get(inSubkeys, pos).ToLocalChecked());
|
|
2072
|
-
|
|
2071
|
+
tmpkey = std::string(*buf);
|
|
2073
2072
|
}
|
|
2074
|
-
if(Subkeys.end() == Subkeys.insert(
|
|
2073
|
+
if(Subkeys.end() == Subkeys.insert(tmpkey.c_str())){
|
|
2075
2074
|
// failed to set subkey
|
|
2076
2075
|
info.GetReturnValue().Set(Nan::False());
|
|
2077
2076
|
return;
|
|
@@ -2254,12 +2253,12 @@ NAN_METHOD(K2hdkcNode::SetAll)
|
|
|
2254
2253
|
Local<Array> inSubkeys = Local<Array>::Cast(info[argpos++]);
|
|
2255
2254
|
K2HSubKeys Subkeys;
|
|
2256
2255
|
for(int pos = 0; pos < static_cast<int>(inSubkeys->Length()); ++pos){
|
|
2257
|
-
string
|
|
2256
|
+
string tmpkey;
|
|
2258
2257
|
{
|
|
2259
2258
|
Nan::Utf8String buf(Nan::Get(inSubkeys, pos).ToLocalChecked());
|
|
2260
|
-
|
|
2259
|
+
tmpkey = std::string(*buf);
|
|
2261
2260
|
}
|
|
2262
|
-
if(Subkeys.end() == Subkeys.insert(
|
|
2261
|
+
if(Subkeys.end() == Subkeys.insert(tmpkey.c_str())){
|
|
2263
2262
|
// failed to set subkey
|
|
2264
2263
|
info.GetReturnValue().Set(Nan::False());
|
|
2265
2264
|
return;
|
|
@@ -2358,7 +2357,7 @@ NAN_METHOD(K2hdkcNode::SetAll)
|
|
|
2358
2357
|
}
|
|
2359
2358
|
|
|
2360
2359
|
// set value to key
|
|
2361
|
-
result = pComObj->CommandSend(reinterpret_cast<const unsigned char*>(strkey.c_str()), strkey.length() + 1, (is_val_set ? reinterpret_cast<const unsigned char*>(strval.c_str()) : NULL), (is_val_set ? strval.length() + 1 : 0), false,
|
|
2360
|
+
result = pComObj->CommandSend(reinterpret_cast<const unsigned char*>(strkey.c_str()), strkey.length() + 1, (is_val_set ? reinterpret_cast<const unsigned char*>(strval.c_str()) : NULL), (is_val_set ? strval.length() + 1 : 0), false, strpass.c_str(), &expire, &rescode);
|
|
2362
2361
|
DKC_DELETE(pComObj);
|
|
2363
2362
|
|
|
2364
2363
|
// set subkeys
|
|
@@ -3343,8 +3342,8 @@ NAN_METHOD(K2hdkcNode::QueuePop)
|
|
|
3343
3342
|
result = pComObj->QueueCommandSend(reinterpret_cast<const unsigned char*>(strprefix.c_str()), strprefix.length() + 1, is_fifo, true, (is_pass_set ? strpass.c_str() : NULL), &pvaltmp, &valtmplen, &rescode);
|
|
3344
3343
|
|
|
3345
3344
|
if(result && (pvaltmp && 0 < valtmplen)){
|
|
3346
|
-
string
|
|
3347
|
-
info.GetReturnValue().Set(Nan::New<String>(
|
|
3345
|
+
string strresult(reinterpret_cast<const char*>(pvaltmp), valtmplen);
|
|
3346
|
+
info.GetReturnValue().Set(Nan::New<String>(strresult.c_str()).ToLocalChecked());
|
|
3348
3347
|
}else{
|
|
3349
3348
|
info.GetReturnValue().Set(Nan::Null());
|
|
3350
3349
|
}
|
|
@@ -4339,7 +4338,10 @@ NAN_METHOD(K2hdkcNode::PrintVersion)
|
|
|
4339
4338
|
//@}
|
|
4340
4339
|
|
|
4341
4340
|
/*
|
|
4342
|
-
*
|
|
4343
|
-
*
|
|
4344
|
-
*
|
|
4341
|
+
* Local variables:
|
|
4342
|
+
* tab-width: 4
|
|
4343
|
+
* c-basic-offset: 4
|
|
4344
|
+
* End:
|
|
4345
|
+
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
4346
|
+
* vim<600: noexpandtab sw=4 ts=4
|
|
4345
4347
|
*/
|
package/src/k2hdkc_node.h
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* K2HDKC
|
|
3
3
|
*
|
|
4
|
-
* Copyright 2017 Yahoo
|
|
4
|
+
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
5
|
*
|
|
6
6
|
* K2HDKC is k2hash based distributed KVS cluster.
|
|
7
7
|
* K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
@@ -103,7 +103,10 @@ class K2hdkcNode : public Nan::ObjectWrap
|
|
|
103
103
|
#endif
|
|
104
104
|
|
|
105
105
|
/*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
106
|
+
* Local variables:
|
|
107
|
+
* tab-width: 4
|
|
108
|
+
* c-basic-offset: 4
|
|
109
|
+
* End:
|
|
110
|
+
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
111
|
+
* vim<600: noexpandtab sw=4 ts=4
|
|
109
112
|
*/
|
package/src/k2hdkc_node_async.h
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* K2HDKC
|
|
3
|
-
*
|
|
4
|
-
* Copyright 2017 Yahoo
|
|
5
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Copyright 2017 Yahoo Japan Corporation.
|
|
5
|
+
*
|
|
6
6
|
* K2HDKC is k2hash based distributed KVS cluster.
|
|
7
7
|
* K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
8
8
|
* distributed KVS cluster server program and client libraries.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* For the full copyright and license information, please view
|
|
11
11
|
* the license file that was distributed with this source code.
|
|
12
12
|
*
|
|
@@ -756,7 +756,7 @@ class SetAllWorker : public Nan::AsyncWorker
|
|
|
756
756
|
}
|
|
757
757
|
|
|
758
758
|
// set value to key
|
|
759
|
-
result = pComObj->CommandSend(reinterpret_cast<const unsigned char*>(strkey.c_str()), strkey.length() + 1, (is_val_set ? reinterpret_cast<const unsigned char*>(strval.c_str()) : NULL), (is_val_set ? strval.length() + 1 : 0), false, (is_pass_set ? strpass.c_str() : NULL),
|
|
759
|
+
result = pComObj->CommandSend(reinterpret_cast<const unsigned char*>(strkey.c_str()), strkey.length() + 1, (is_val_set ? reinterpret_cast<const unsigned char*>(strval.c_str()) : NULL), (is_val_set ? strval.length() + 1 : 0), false, (is_pass_set ? strpass.c_str() : NULL), &expire, &rescode);
|
|
760
760
|
DKC_DELETE(pComObj);
|
|
761
761
|
|
|
762
762
|
// set subkeys
|
|
@@ -1786,7 +1786,10 @@ class CasIncDecWorker : public Nan::AsyncWorker
|
|
|
1786
1786
|
#endif
|
|
1787
1787
|
|
|
1788
1788
|
/*
|
|
1789
|
-
*
|
|
1790
|
-
*
|
|
1791
|
-
*
|
|
1789
|
+
* Local variables:
|
|
1790
|
+
* tab-width: 4
|
|
1791
|
+
* c-basic-offset: 4
|
|
1792
|
+
* End:
|
|
1793
|
+
* vim600: noexpandtab sw=4 ts=4 fdm=marker
|
|
1794
|
+
* vim<600: noexpandtab sw=4 ts=4
|
|
1792
1795
|
*/
|
package/binding.gyp
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#
|
|
2
|
-
# K2HDKC
|
|
3
|
-
#
|
|
4
|
-
# Copyright 2017 Yahoo! JAPAN corporation.
|
|
5
|
-
#
|
|
6
|
-
# K2HDKC is k2hash based distributed KVS cluster.
|
|
7
|
-
# K2HDKC uses K2HASH, CHMPX, FULLOCK libraries. K2HDKC supports
|
|
8
|
-
# distributed KVS cluster server program and client libraries.
|
|
9
|
-
#
|
|
10
|
-
# For the full copyright and license information, please view
|
|
11
|
-
# the license file that was distributed with this source code.
|
|
12
|
-
#
|
|
13
|
-
# AUTHOR: Takeshi Nakatani
|
|
14
|
-
# CREATE: Fri 10 Mar 2017
|
|
15
|
-
# REVISION:
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
{
|
|
19
|
-
"variables": {
|
|
20
|
-
"coverage": "false"
|
|
21
|
-
},
|
|
22
|
-
"targets": [
|
|
23
|
-
{
|
|
24
|
-
"target_name": "k2hdkc",
|
|
25
|
-
"sources": [
|
|
26
|
-
"src/k2hdkc.cc",
|
|
27
|
-
"src/k2hdkc_node.cc",
|
|
28
|
-
"src/k2hdkc_cbs.cc"
|
|
29
|
-
],
|
|
30
|
-
"cflags": [
|
|
31
|
-
#
|
|
32
|
-
# We get too many deprecated message building with nodejs 0.12.x.
|
|
33
|
-
# Those messages are depricated functions/methods, but we do not use those.
|
|
34
|
-
# So that we ignore these deprecated warning here.
|
|
35
|
-
#
|
|
36
|
-
"-Wno-deprecated",
|
|
37
|
-
#
|
|
38
|
-
# For nodejs 9.x/10.x, it puts about MakeCallback / CreateDataProperty / DefineOwnProperty
|
|
39
|
-
#
|
|
40
|
-
"-Wno-deprecated-declarations",
|
|
41
|
-
#
|
|
42
|
-
# For nodejs 12.x/..., it suppress warnings: "'deprecated' attribute directive ignored"
|
|
43
|
-
#
|
|
44
|
-
"-Wno-attributes"
|
|
45
|
-
],
|
|
46
|
-
"include_dirs": [
|
|
47
|
-
"<!(node -e \"require('nan')\")"
|
|
48
|
-
],
|
|
49
|
-
"libraries": [
|
|
50
|
-
"-lk2hdkc"
|
|
51
|
-
]
|
|
52
|
-
}
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
#
|
|
57
|
-
# Local variables:
|
|
58
|
-
# tab-width: 4
|
|
59
|
-
# c-basic-offset: 4
|
|
60
|
-
# End:
|
|
61
|
-
# vim600: expandtab sw=4 ts=4 fdm=marker
|
|
62
|
-
# vim<600: expandtab sw=4 ts=4
|
|
63
|
-
#
|