aerospike 6.0.2 → 6.2.0
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/binding.gyp +3 -0
- package/lib/aerospike.js +2 -0
- package/lib/binding/glibc@2.31/node-v108-linux-arm64/aerospike.node +0 -0
- package/lib/binding/glibc@2.31/node-v108-linux-x64/aerospike.node +0 -0
- package/lib/binding/glibc@2.31/node-v115-linux-arm64/aerospike.node +0 -0
- package/lib/binding/glibc@2.31/node-v115-linux-x64/aerospike.node +0 -0
- package/lib/binding/glibc@2.31/node-v127-linux-arm64/aerospike.node +0 -0
- package/lib/binding/glibc@2.31/node-v127-linux-x64/aerospike.node +0 -0
- package/lib/binding/glibc@2.31/node-v131-linux-arm64/aerospike.node +0 -0
- package/lib/binding/glibc@2.31/node-v131-linux-x64/aerospike.node +0 -0
- package/lib/binding/glibc@2.35/node-v108-linux-arm64/aerospike.node +0 -0
- package/lib/binding/glibc@2.35/node-v108-linux-x64/aerospike.node +0 -0
- package/lib/binding/glibc@2.35/node-v115-linux-arm64/aerospike.node +0 -0
- package/lib/binding/glibc@2.35/node-v115-linux-x64/aerospike.node +0 -0
- package/lib/binding/glibc@2.35/node-v127-linux-arm64/aerospike.node +0 -0
- package/lib/binding/glibc@2.35/node-v127-linux-x64/aerospike.node +0 -0
- package/lib/binding/glibc@2.35/node-v131-linux-arm64/aerospike.node +0 -0
- package/lib/binding/glibc@2.35/node-v131-linux-x64/aerospike.node +0 -0
- package/lib/binding/node-v108-darwin-arm64/aerospike.node +0 -0
- package/lib/binding/node-v108-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v108-win32-x64/aerospike.dll +0 -0
- package/lib/binding/node-v108-win32-x64/aerospike.node +0 -0
- package/lib/binding/node-v115-darwin-arm64/aerospike.node +0 -0
- package/lib/binding/node-v115-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v115-win32-x64/aerospike.dll +0 -0
- package/lib/binding/node-v115-win32-x64/aerospike.node +0 -0
- package/lib/binding/node-v127-darwin-arm64/aerospike.node +0 -0
- package/lib/binding/node-v127-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v127-win32-x64/aerospike.dll +0 -0
- package/lib/binding/node-v127-win32-x64/aerospike.node +0 -0
- package/lib/binding/node-v131-darwin-arm64/aerospike.node +0 -0
- package/lib/binding/node-v131-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v131-win32-x64/aerospike.dll +0 -0
- package/lib/binding/node-v131-win32-x64/aerospike.node +0 -0
- package/lib/client.js +39 -1
- package/lib/commands/index.js +3 -0
- package/lib/config.js +1 -0
- package/lib/metrics_listeners.js +28 -0
- package/lib/policies/apply_policy.js +16 -0
- package/lib/policies/batch_apply_policy.js +2 -0
- package/lib/policies/batch_write_policy.js +2 -0
- package/lib/policies/metrics_policy.js +37 -0
- package/lib/policies/remove_policy.js +14 -0
- package/lib/policies/write_policy.js +16 -0
- package/lib/policy.js +5 -0
- package/package.json +1 -1
- package/src/include/client.h +3 -0
- package/src/include/conversions.h +36 -0
- package/src/include/policy.h +4 -0
- package/src/main/client.cc +6 -0
- package/src/main/commands/disable_metrics.cc +48 -0
- package/src/main/commands/enable_metrics.cc +508 -0
- package/src/main/commands/set_xdr_filter.cc +181 -0
- package/src/main/config.cc +25 -0
- package/src/main/policy.cc +62 -0
- package/src/main/scan.cc +0 -1
- package/src/main/util/conversions.cc +348 -0
- package/src/main/util/conversions_batch.cc +1 -17
- package/test/batch_read.js +8 -8
- package/test/get.js +4 -4
- package/test/operate.js +4 -4
- package/test/udf.lua +1 -1
- package/ts-test/package-lock.json +754 -189
- package/ts-test/package.json +8 -5
- package/ts-test/scripts/three_node.sh +21 -0
- package/ts-test/tests/apply.ts +35 -2
- package/ts-test/tests/batch_apply.ts +53 -3
- package/ts-test/tests/batch_read.ts +8 -8
- package/ts-test/tests/batch_write.ts +153 -12
- package/ts-test/tests/config.ts +16 -0
- package/ts-test/tests/exists.ts +6 -6
- package/ts-test/tests/get.ts +4 -4
- package/ts-test/tests/metrics.ts +336 -0
- package/ts-test/tests/metrics_cluster_name.ts +130 -0
- package/ts-test/tests/metrics_node_close.ts +176 -0
- package/ts-test/tests/mrt_api.ts +166 -164
- package/ts-test/tests/operate.ts +4 -4
- package/ts-test/tests/policy.ts +64 -12
- package/ts-test/tests/prefer_rack.ts +100 -0
- package/ts-test/tests/put.ts +31 -1
- package/ts-test/tests/query.ts +2 -0
- package/ts-test/tests/scan.ts +4 -1
- package/ts-test/tests/set_xdr_filter.ts +124 -0
- package/ts-test/tests/stats.ts +8 -1
- package/ts-test/tests/test_helper.ts +35 -12
- package/ts-test/tests/udf.ts +2 -2
- package/ts-test/tests/util/options.ts +20 -3
- package/ts-test/tests/util/statefulAsyncTest.ts +1 -1
- package/typings/index.d.ts +700 -11
package/binding.gyp
CHANGED
|
@@ -84,6 +84,9 @@
|
|
|
84
84
|
'src/main/expressions.cc',
|
|
85
85
|
'src/main/async.cc',
|
|
86
86
|
'src/main/command.cc',
|
|
87
|
+
'src/main/commands/set_xdr_filter.cc',
|
|
88
|
+
'src/main/commands/disable_metrics.cc',
|
|
89
|
+
'src/main/commands/enable_metrics.cc',
|
|
87
90
|
'src/main/commands/apply_async.cc',
|
|
88
91
|
'src/main/commands/batch_exists.cc',
|
|
89
92
|
'src/main/commands/batch_get.cc',
|
package/lib/aerospike.js
CHANGED
|
@@ -186,6 +186,7 @@ exports.CommandQueuePolicy = require('./policy').CommandQueuePolicy
|
|
|
186
186
|
exports.InfoPolicy = require('./policy').InfoPolicy
|
|
187
187
|
exports.ListPolicy = require('./policy').ListPolicy
|
|
188
188
|
exports.MapPolicy = require('./policy').MapPolicy
|
|
189
|
+
exports.MetricsPolicy = require('./policy').MetricsPolicy
|
|
189
190
|
exports.AdminPolicy = require('./policy').AdminPolicy
|
|
190
191
|
|
|
191
192
|
/**
|
|
@@ -738,6 +739,7 @@ exports.setupGlobalCommandQueue = function (policy) {
|
|
|
738
739
|
*/
|
|
739
740
|
exports.batchType = require('./batch_type')
|
|
740
741
|
|
|
742
|
+
exports.MetricsListeners = require('./metrics_listeners')
|
|
741
743
|
/**
|
|
742
744
|
* The {@link module:aerospike/commit_status|aerospike/commit_status}
|
|
743
745
|
* module contains a list of commit statuses.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// *****************************************************************************
|
|
2
|
-
// Copyright 2013-
|
|
2
|
+
// Copyright 2013-2025 Aerospike, Inc.
|
|
3
3
|
//
|
|
4
4
|
// Licensed under the Apache License, Version 2.0 (the "License")
|
|
5
5
|
// you may not use this file except in compliance with the License.
|
|
@@ -255,6 +255,36 @@ Client.prototype.commit = function (transaction, callback) {
|
|
|
255
255
|
return cmd.execute()
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
Client.prototype.enableMetrics = function (policy, callback) {
|
|
259
|
+
let args
|
|
260
|
+
|
|
261
|
+
if (typeof policy === 'function') {
|
|
262
|
+
callback = policy
|
|
263
|
+
policy = null
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (!(policy) || !(policy.metricsListeners)) {
|
|
267
|
+
args = [policy, null, null, null, null]
|
|
268
|
+
} else {
|
|
269
|
+
args = [
|
|
270
|
+
policy,
|
|
271
|
+
policy.metricsListeners.enableListener,
|
|
272
|
+
policy.metricsListeners.snapshotListener,
|
|
273
|
+
policy.metricsListeners.nodeCloseListener,
|
|
274
|
+
policy.metricsListeners.disableListener
|
|
275
|
+
]
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const cmd = new Commands.EnableMetrics(this, args, callback)
|
|
279
|
+
|
|
280
|
+
return cmd.execute()
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
Client.prototype.disableMetrics = function (callback) {
|
|
284
|
+
const cmd = new Commands.DisableMetrics(this, [], callback)
|
|
285
|
+
return cmd.execute()
|
|
286
|
+
}
|
|
287
|
+
|
|
258
288
|
/**
|
|
259
289
|
* @function Client#contextToBase64
|
|
260
290
|
*
|
|
@@ -326,6 +356,14 @@ Client.prototype.contextToBase64 = function (context) {
|
|
|
326
356
|
return this.as_client.contextToBase64({ context })
|
|
327
357
|
}
|
|
328
358
|
|
|
359
|
+
Client.prototype.setXDRFilter = function (expression, dataCenter, namespace, policy, callback) {
|
|
360
|
+
if (typeof policy === 'function') {
|
|
361
|
+
callback = policy
|
|
362
|
+
policy = null
|
|
363
|
+
}
|
|
364
|
+
const cmd = new Commands.SetXDRFilter(this, [expression, dataCenter, namespace, policy], callback)
|
|
365
|
+
return cmd.execute()
|
|
366
|
+
}
|
|
329
367
|
/**
|
|
330
368
|
* @function Client#contextFromBase64
|
|
331
369
|
*
|
package/lib/commands/index.js
CHANGED
|
@@ -35,6 +35,8 @@ exports.BatchRemove = class BatchRemoveCommand extends BatchCommand('batchRemove
|
|
|
35
35
|
exports.BatchSelect = class BatchSelectCommand extends BatchCommand('batchSelect') { }
|
|
36
36
|
exports.ChangePassword = class ChangePasswordCommand extends Command('changePassword') { }
|
|
37
37
|
exports.Connect = class ConnectCommand extends ConnectCommandBase('connect') { }
|
|
38
|
+
exports.DisableMetrics = class DisableMetricsCommand extends Command('disableMetrics') { }
|
|
39
|
+
exports.EnableMetrics = class EnableMetricsCommand extends Command('enableMetrics') { }
|
|
38
40
|
exports.Exists = class ExistsCommand extends ExistsCommandBase('existsAsync') { }
|
|
39
41
|
exports.Get = class GetCommand extends ReadRecordCommand('getAsync') { }
|
|
40
42
|
exports.IndexCreate = class IndexCreateCommand extends Command('indexCreate') { }
|
|
@@ -65,6 +67,7 @@ exports.RoleGrant = class RoleGrantCommand extends Command('roleGrant') { }
|
|
|
65
67
|
exports.RoleRevoke = class RoleRevokeCommand extends Command('roleRevoke') { }
|
|
66
68
|
exports.RoleSetWhitelist = class RoleSetWhitelistCommand extends Command('roleSetWhitelist') { }
|
|
67
69
|
exports.RoleSetQuotas = class RoleSetQuotasCommand extends Command('roleSetQuotas') { }
|
|
70
|
+
exports.SetXDRFilter = class SetXDRFilterCommand extends Command('setXDRFilter') { }
|
|
68
71
|
exports.Scan = class ScanCommand extends StreamCommand('scanAsync') { }
|
|
69
72
|
exports.ScanPages = class ScanPagesCommand extends StreamCommand('scanPages') { }
|
|
70
73
|
exports.ScanBackground = class ScanBackgroundCommand extends QueryBackgroundBaseCommand('scanBackground') { }
|
package/lib/config.js
CHANGED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright 2025 Aerospike, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License")
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
'use strict'
|
|
18
|
+
|
|
19
|
+
class MetricsListeners {
|
|
20
|
+
constructor (options) {
|
|
21
|
+
this.enableListener = options.enableListener
|
|
22
|
+
this.snapshotListener = options.snapshotListener
|
|
23
|
+
this.nodeCloseListener = options.nodeCloseListener
|
|
24
|
+
this.disableListener = options.disableListener
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = MetricsListeners
|
|
@@ -34,6 +34,14 @@ class ApplyPolicy extends BasePolicy {
|
|
|
34
34
|
props = props || {}
|
|
35
35
|
super(props)
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the replica to be consulted for the scan operation.
|
|
39
|
+
*
|
|
40
|
+
* @type number
|
|
41
|
+
* @see {@link module:aerospike/policy.replica} for supported policy values.
|
|
42
|
+
*/
|
|
43
|
+
this.replica = props.replica
|
|
44
|
+
|
|
37
45
|
/**
|
|
38
46
|
* Specifies the behavior for the key.
|
|
39
47
|
*
|
|
@@ -68,6 +76,14 @@ class ApplyPolicy extends BasePolicy {
|
|
|
68
76
|
* @default <code>false</code> (do not tombstone deleted records)
|
|
69
77
|
*/
|
|
70
78
|
this.durableDelete = props.durableDelete
|
|
79
|
+
this.onLockingOnly = props.onLockingOnly
|
|
80
|
+
/**
|
|
81
|
+
* Specifies the replica to be consulted for the scan operation.
|
|
82
|
+
*
|
|
83
|
+
* @type number
|
|
84
|
+
* @see {@link module:aerospike/policy.replica} for supported policy values.
|
|
85
|
+
*/
|
|
86
|
+
this.replica = props.replica
|
|
71
87
|
}
|
|
72
88
|
}
|
|
73
89
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright 2025 Aerospike, Inc.
|
|
3
|
+
//
|
|
4
|
+
// Licensed under the Apache License, Version 2.0 (the "License")
|
|
5
|
+
// you may not use this file except in compliance with the License.
|
|
6
|
+
// You may obtain a copy of the License at
|
|
7
|
+
//
|
|
8
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
//
|
|
10
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
// See the License for the specific language governing permissions and
|
|
14
|
+
// limitations under the License.
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
'use strict'
|
|
18
|
+
|
|
19
|
+
class MetricsPolicy {
|
|
20
|
+
constructor (props) {
|
|
21
|
+
props = props || {}
|
|
22
|
+
|
|
23
|
+
this.metricsListeners = props.metricsListeners
|
|
24
|
+
|
|
25
|
+
this.reportDir = props.reportDir
|
|
26
|
+
|
|
27
|
+
this.reportSizeLimit = props.reportSizeLimit
|
|
28
|
+
|
|
29
|
+
this.interval = props.interval
|
|
30
|
+
|
|
31
|
+
this.latencyColumns = props.latencyColumns
|
|
32
|
+
|
|
33
|
+
this.latencyShift = props.latecnyShift
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = MetricsPolicy
|
|
@@ -34,6 +34,13 @@ class RemovePolicy extends BasePolicy {
|
|
|
34
34
|
props = props || {}
|
|
35
35
|
super(props)
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the replica to be consulted for the scan operation.
|
|
39
|
+
*
|
|
40
|
+
* @type number
|
|
41
|
+
* @see {@link module:aerospike/policy.replica} for supported policy values.
|
|
42
|
+
*/
|
|
43
|
+
this.replica = props.replica
|
|
37
44
|
/**
|
|
38
45
|
* The generation of the record.
|
|
39
46
|
*
|
|
@@ -76,6 +83,13 @@ class RemovePolicy extends BasePolicy {
|
|
|
76
83
|
* @default <code>false</code> (do not tombstone deleted records)
|
|
77
84
|
*/
|
|
78
85
|
this.durableDelete = props.durableDelete
|
|
86
|
+
/**
|
|
87
|
+
* Specifies the replica to be consulted for the scan operation.
|
|
88
|
+
*
|
|
89
|
+
* @type number
|
|
90
|
+
* @see {@link module:aerospike/policy.replica} for supported policy values.
|
|
91
|
+
*/
|
|
92
|
+
this.replica = props.replica
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
95
|
|
|
@@ -34,6 +34,14 @@ class WritePolicy extends BasePolicy {
|
|
|
34
34
|
props = props || {}
|
|
35
35
|
super(props)
|
|
36
36
|
|
|
37
|
+
/**
|
|
38
|
+
* Specifies the replica to be consulted for the scan operation.
|
|
39
|
+
*
|
|
40
|
+
* @type number
|
|
41
|
+
* @see {@link module:aerospike/policy.replica} for supported policy values.
|
|
42
|
+
*/
|
|
43
|
+
this.replica = props.replica
|
|
44
|
+
|
|
37
45
|
/**
|
|
38
46
|
* Minimum record size beyond which it is compressed and sent to the
|
|
39
47
|
* server.
|
|
@@ -85,6 +93,14 @@ class WritePolicy extends BasePolicy {
|
|
|
85
93
|
* @default <code>false</code> (do not tombstone deleted records)
|
|
86
94
|
*/
|
|
87
95
|
this.durableDelete = props.durableDelete
|
|
96
|
+
this.onLockingOnly = props.onLockingOnly
|
|
97
|
+
/**
|
|
98
|
+
* Specifies the replica to be consulted for the scan operation.
|
|
99
|
+
*
|
|
100
|
+
* @type number
|
|
101
|
+
* @see {@link module:aerospike/policy.replica} for supported policy values.
|
|
102
|
+
*/
|
|
103
|
+
this.replica = props.replica
|
|
88
104
|
}
|
|
89
105
|
}
|
|
90
106
|
|
package/lib/policy.js
CHANGED
|
@@ -31,6 +31,7 @@ const HLLPolicy = require('./policies/hll_policy')
|
|
|
31
31
|
const InfoPolicy = require('./policies/info_policy')
|
|
32
32
|
const ListPolicy = require('./policies/list_policy')
|
|
33
33
|
const MapPolicy = require('./policies/map_policy')
|
|
34
|
+
const MetricsPolicy = require('./policies/metrics_policy')
|
|
34
35
|
const OperatePolicy = require('./policies/operate_policy')
|
|
35
36
|
const QueryPolicy = require('./policies/query_policy')
|
|
36
37
|
const ReadPolicy = require('./policies/read_policy')
|
|
@@ -429,6 +430,8 @@ exports.InfoPolicy = InfoPolicy
|
|
|
429
430
|
*/
|
|
430
431
|
exports.AdminPolicy = AdminPolicy
|
|
431
432
|
|
|
433
|
+
exports.MetricsPolicy = MetricsPolicy
|
|
434
|
+
|
|
432
435
|
/**
|
|
433
436
|
* A policy affecting the behavior of list operations.
|
|
434
437
|
*
|
|
@@ -458,6 +461,8 @@ function policyClass (type) {
|
|
|
458
461
|
case 'batchRemove': return BatchRemovePolicy
|
|
459
462
|
case 'batchWrite': return BatchWritePolicy
|
|
460
463
|
case 'batchParentWrite': return BatchPolicy
|
|
464
|
+
case 'txnRoll': return BatchPolicy
|
|
465
|
+
case 'txnVerify': return BatchPolicy
|
|
461
466
|
case 'batchApply': return BatchApplyPolicy
|
|
462
467
|
case 'commandQueue': return CommandQueuePolicy
|
|
463
468
|
case 'hll': return HLLPolicy
|
package/package.json
CHANGED
package/src/include/client.h
CHANGED
|
@@ -88,6 +88,8 @@ class AerospikeClient : public Nan::ObjectWrap {
|
|
|
88
88
|
static NAN_METHOD(ChangePassword);
|
|
89
89
|
static NAN_METHOD(Close);
|
|
90
90
|
static NAN_METHOD(Connect);
|
|
91
|
+
static NAN_METHOD(DisableMetrics);
|
|
92
|
+
static NAN_METHOD(EnableMetrics);
|
|
91
93
|
static NAN_METHOD(ExistsAsync);
|
|
92
94
|
static NAN_METHOD(GetAsync);
|
|
93
95
|
static NAN_METHOD(GetNodes);
|
|
@@ -127,6 +129,7 @@ class AerospikeClient : public Nan::ObjectWrap {
|
|
|
127
129
|
static NAN_METHOD(SelectAsync);
|
|
128
130
|
static NAN_METHOD(SetLogLevel);
|
|
129
131
|
static NAN_METHOD(SetupEventCb);
|
|
132
|
+
static NAN_METHOD(SetXDRFilter);
|
|
130
133
|
static NAN_METHOD(TransactionAbort);
|
|
131
134
|
static NAN_METHOD(TransactionCommit);
|
|
132
135
|
static NAN_METHOD(Truncate);
|
|
@@ -22,7 +22,10 @@ extern "C" {
|
|
|
22
22
|
#include <aerospike/aerospike.h>
|
|
23
23
|
#include <aerospike/aerospike_key.h>
|
|
24
24
|
#include <aerospike/aerospike_batch.h>
|
|
25
|
+
#include <aerospike/aerospike_stats.h>
|
|
26
|
+
#include <aerospike/as_metrics_writer.h>
|
|
25
27
|
#include <aerospike/as_job.h>
|
|
28
|
+
#include <aerospike/as_node.h>
|
|
26
29
|
#include <aerospike/as_key.h>
|
|
27
30
|
#include <aerospike/as_record.h>
|
|
28
31
|
#include <aerospike/as_scan.h>
|
|
@@ -95,6 +98,8 @@ int get_optional_transaction_property(as_txn **txn, bool *defined,
|
|
|
95
98
|
int get_optional_bytes_property(uint8_t **bytes, int *size, bool *defined,
|
|
96
99
|
v8::Local<v8::Object> obj, char const *prop,
|
|
97
100
|
const LogInfo *log);
|
|
101
|
+
int get_optional_rack_ids_property(as_config *config, bool *defined, v8::Local<v8::Object> obj,
|
|
102
|
+
char const *prop, const LogInfo *log);
|
|
98
103
|
int get_optional_int_property(int *intp, bool *defined,
|
|
99
104
|
v8::Local<v8::Object> obj, char const *prop,
|
|
100
105
|
const LogInfo *log);
|
|
@@ -107,6 +112,9 @@ int get_optional_int64_property(int64_t *intp, bool *defined,
|
|
|
107
112
|
int get_optional_string_property(char **strp, bool *defined,
|
|
108
113
|
v8::Local<v8::Object> obj, char const *prop,
|
|
109
114
|
const LogInfo *log);
|
|
115
|
+
int get_optional_uint64_property(uint64_t *intp, bool *defined,
|
|
116
|
+
v8::Local<v8::Object> obj, char const *prop,
|
|
117
|
+
const LogInfo *log);
|
|
110
118
|
int get_optional_uint32_property(uint32_t *intp, bool *defined,
|
|
111
119
|
v8::Local<v8::Object> obj, char const *prop,
|
|
112
120
|
const LogInfo *log);
|
|
@@ -119,6 +127,9 @@ bool get_optional_list_policy(as_list_policy *policy, bool *has_policy,
|
|
|
119
127
|
v8::Local<v8::Object> obj, const LogInfo *log);
|
|
120
128
|
bool get_map_policy(as_map_policy *policy, v8::Local<v8::Object> obj,
|
|
121
129
|
const LogInfo *log);
|
|
130
|
+
int get_optional_report_dir_property(char **report_dir, bool *defined,
|
|
131
|
+
v8::Local<v8::Object> obj, const char *prop,
|
|
132
|
+
const LogInfo *log);
|
|
122
133
|
|
|
123
134
|
// Functions to convert C client structure to v8 object(map)
|
|
124
135
|
v8::Local<v8::Object> error_to_jsobject(as_error *error, const LogInfo *log);
|
|
@@ -147,6 +158,8 @@ void load_bytes(v8::Local<v8::Object> saved_object, uint8_t* bytes, uint32_t byt
|
|
|
147
158
|
// Functions to convert v8 objects(maps) to C client structures
|
|
148
159
|
int host_from_jsobject(v8::Local<v8::Object> obj, char **addr, uint16_t *port,
|
|
149
160
|
const LogInfo *log);
|
|
161
|
+
int datacenter_from_jsobject(v8::Local<v8::Value> v8_dc, char **dc,
|
|
162
|
+
const LogInfo *log);
|
|
150
163
|
int log_from_jsobject(LogInfo *log, v8::Local<v8::Object> obj);
|
|
151
164
|
int recordbins_from_jsobject(as_record *rec, v8::Local<v8::Object> obj,
|
|
152
165
|
const LogInfo *log);
|
|
@@ -180,6 +193,17 @@ int batch_remove_record_from_jsobject(as_batch_records *batch,
|
|
|
180
193
|
void batch_records_free(as_batch_records *records, const LogInfo *log);
|
|
181
194
|
int udfargs_from_jsobject(char **filename, char **funcname, as_list **args,
|
|
182
195
|
v8::Local<v8::Object> obj, const LogInfo *log);
|
|
196
|
+
|
|
197
|
+
typedef struct {
|
|
198
|
+
uint32_t *connection;
|
|
199
|
+
uint32_t *write;
|
|
200
|
+
uint32_t *read;
|
|
201
|
+
uint32_t *batch;
|
|
202
|
+
uint32_t *query;
|
|
203
|
+
} latency;
|
|
204
|
+
|
|
205
|
+
void cluster_to_jsobject(as_cluster_s* cluster, v8::Local<v8::Object> v8_cluster, latency* latency, uint32_t bucket_max);
|
|
206
|
+
void node_to_jsobject(as_node_s* node, v8::Local<v8::Object> v8_node, latency* latency, uint32_t bucket_max);
|
|
183
207
|
int extract_blob_from_jsobject(uint8_t **data, int *len,
|
|
184
208
|
v8::Local<v8::Object> obj, const LogInfo *log);
|
|
185
209
|
int list_from_jsarray(as_list **list, v8::Local<v8::Array> array,
|
|
@@ -206,3 +230,15 @@ int setGeneration(v8::Local<v8::Object> obj, uint16_t *generation,
|
|
|
206
230
|
const LogInfo *log);
|
|
207
231
|
|
|
208
232
|
size_t as_strlcpy(char *d, const char *s, size_t bufsize);
|
|
233
|
+
|
|
234
|
+
static inline void
|
|
235
|
+
as_conn_stats_init_internal(as_conn_stats* stats)
|
|
236
|
+
{
|
|
237
|
+
stats->in_pool = 0;
|
|
238
|
+
stats->in_use = 0;
|
|
239
|
+
stats->opened = 0;
|
|
240
|
+
stats->closed = 0;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
void
|
|
244
|
+
as_conn_stats_sum_internal(as_conn_stats* stats, as_async_conn_pool* pool);
|
package/src/include/policy.h
CHANGED
|
@@ -23,6 +23,8 @@ extern "C" {
|
|
|
23
23
|
#include <aerospike/as_policy.h>
|
|
24
24
|
#include <aerospike/as_partition_filter.h>
|
|
25
25
|
#include <aerospike/as_event.h>
|
|
26
|
+
#include <aerospike/as_metrics_writer.h>
|
|
27
|
+
#include <aerospike/as_metrics.h>
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
// Functions to convert v8 policies to C structures
|
|
@@ -54,6 +56,8 @@ int infopolicy_from_jsobject(as_policy_info *policy, v8::Local<v8::Object> obj,
|
|
|
54
56
|
const LogInfo *log);
|
|
55
57
|
int adminpolicy_from_jsobject(as_policy_admin *policy, v8::Local<v8::Object> obj,
|
|
56
58
|
const LogInfo *log);
|
|
59
|
+
int metricspolicy_from_jsobject_with_listeners(as_metrics_policy *policy, v8::Local<v8::Object> obj,
|
|
60
|
+
as_metrics_listeners* listeners, const LogInfo *log);
|
|
57
61
|
int applypolicy_from_jsobject(as_policy_apply *policy,
|
|
58
62
|
v8::Local<v8::Object> obj, const LogInfo *log);
|
|
59
63
|
int scanpolicy_from_jsobject(as_policy_scan *policy, v8::Local<v8::Object> obj,
|
package/src/main/client.cc
CHANGED
|
@@ -60,6 +60,7 @@ NAN_METHOD(AerospikeClient::New)
|
|
|
60
60
|
client->log->fd = g_log_info.fd;
|
|
61
61
|
client->log->level = g_log_info.level;
|
|
62
62
|
|
|
63
|
+
|
|
63
64
|
// initialize the config to default values.
|
|
64
65
|
as_config config;
|
|
65
66
|
as_config_init(&config);
|
|
@@ -121,8 +122,10 @@ NAN_METHOD(AerospikeClient::Close)
|
|
|
121
122
|
events_callback_close(&client->as->config);
|
|
122
123
|
aerospike_close(client->as, &err);
|
|
123
124
|
aerospike_destroy(client->as);
|
|
125
|
+
|
|
124
126
|
free(client->as);
|
|
125
127
|
free(client->log);
|
|
128
|
+
|
|
126
129
|
client->closed = true;
|
|
127
130
|
}
|
|
128
131
|
|
|
@@ -295,6 +298,8 @@ void AerospikeClient::Init()
|
|
|
295
298
|
Nan::SetPrototypeMethod(tpl, "close", Close);
|
|
296
299
|
Nan::SetPrototypeMethod(tpl, "connect", Connect);
|
|
297
300
|
Nan::SetPrototypeMethod(tpl, "existsAsync", ExistsAsync);
|
|
301
|
+
Nan::SetPrototypeMethod(tpl, "disableMetrics", DisableMetrics);
|
|
302
|
+
Nan::SetPrototypeMethod(tpl, "enableMetrics", EnableMetrics);
|
|
298
303
|
Nan::SetPrototypeMethod(tpl, "getAsync", GetAsync);
|
|
299
304
|
Nan::SetPrototypeMethod(tpl, "getNodes", GetNodes);
|
|
300
305
|
Nan::SetPrototypeMethod(tpl, "getStats", GetStats);
|
|
@@ -333,6 +338,7 @@ void AerospikeClient::Init()
|
|
|
333
338
|
Nan::SetPrototypeMethod(tpl, "scanBackground", ScanBackground);
|
|
334
339
|
Nan::SetPrototypeMethod(tpl, "selectAsync", SelectAsync);
|
|
335
340
|
Nan::SetPrototypeMethod(tpl, "setupEventCb", SetupEventCb);
|
|
341
|
+
Nan::SetPrototypeMethod(tpl, "setXDRFilter", SetXDRFilter);
|
|
336
342
|
Nan::SetPrototypeMethod(tpl, "transactionAbort", TransactionAbort);
|
|
337
343
|
Nan::SetPrototypeMethod(tpl, "transactionCommit", TransactionCommit);
|
|
338
344
|
Nan::SetPrototypeMethod(tpl, "truncate", Truncate);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*******************************************************************************
|
|
2
|
+
* Copyright 2013-2023 Aerospike, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
******************************************************************************/
|
|
16
|
+
|
|
17
|
+
#include "client.h"
|
|
18
|
+
#include "command.h"
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
extern "C" {
|
|
23
|
+
#include <aerospike/as_metrics.h>
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
using namespace v8;
|
|
27
|
+
|
|
28
|
+
NAN_METHOD(AerospikeClient::DisableMetrics)
|
|
29
|
+
{
|
|
30
|
+
TYPE_CHECK_REQ(info[0], IsFunction, "Callback must be a function");
|
|
31
|
+
|
|
32
|
+
AerospikeClient *client =
|
|
33
|
+
Nan::ObjectWrap::Unwrap<AerospikeClient>(info.This());
|
|
34
|
+
AsyncCommand *cmd =
|
|
35
|
+
new AsyncCommand("DisableMetrics", client, info[0].As<Function>());
|
|
36
|
+
|
|
37
|
+
if (aerospike_disable_metrics(client->as, &cmd->err) != AEROSPIKE_OK) {
|
|
38
|
+
cmd->ErrorCallback(&cmd->err);
|
|
39
|
+
goto Cleanup;
|
|
40
|
+
}
|
|
41
|
+
else{
|
|
42
|
+
Local<Value> argv[] = {Nan::Null(), Nan::Null()};
|
|
43
|
+
cmd->Callback(2, argv);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
Cleanup:
|
|
47
|
+
delete cmd;
|
|
48
|
+
}
|