aerospike 5.10.0 → 5.12.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/README.md +35 -35
- package/binding.gyp +2 -1
- package/examples/typescript.ts +23 -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-core-client/aerospik.95E228AA.tlog/CustomBuild.command.1.tlog +1 -1
- package/lib/binding/node-v108-win32-x64/aerospike-core-client/aerospik.95E228AA.tlog/CustomBuild.read.1.tlog +0 -0
- package/lib/binding/node-v108-win32-x64/aerospike-core-client/aerospik.95E228AA.tlog/CustomBuild.write.1.tlog +0 -0
- package/lib/binding/node-v108-win32-x64/aerospike-core-client/aerospik.95E228AA.tlog/aerospike-core-client.lastbuildstate +1 -1
- package/lib/binding/node-v108-win32-x64/aerospike-core-client/aerospik.95E228AA.tlog/unsuccessfulbuild +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-v108-win32-x64/event_core.dll +0 -0
- package/lib/binding/node-v108-win32-x64/getopt.dll +0 -0
- package/lib/binding/node-v108-win32-x64/libeay32.dll +0 -0
- package/lib/binding/node-v108-win32-x64/pthreadVC2.dll +0 -0
- package/lib/binding/node-v108-win32-x64/ssleay32.dll +0 -0
- package/lib/binding/node-v108-win32-x64/zlib.dll +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-v115-win32-x64/event_core.dll +0 -0
- package/lib/binding/node-v115-win32-x64/getopt.dll +0 -0
- package/lib/binding/node-v115-win32-x64/libeay32.dll +0 -0
- package/lib/binding/node-v115-win32-x64/pthreadVC2.dll +0 -0
- package/lib/binding/node-v115-win32-x64/ssleay32.dll +0 -0
- package/lib/binding/node-v115-win32-x64/zlib.dll +0 -0
- package/lib/binding/node-v120-darwin-arm64/aerospike.node +0 -0
- package/lib/binding/node-v120-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v120-win32-x64/aerospike.dll +0 -0
- package/lib/binding/node-v120-win32-x64/aerospike.node +0 -0
- package/lib/binding/node-v120-win32-x64/event_core.dll +0 -0
- package/lib/binding/node-v120-win32-x64/getopt.dll +0 -0
- package/lib/binding/node-v120-win32-x64/libeay32.dll +0 -0
- package/lib/binding/node-v120-win32-x64/pthreadVC2.dll +0 -0
- package/lib/binding/node-v120-win32-x64/ssleay32.dll +0 -0
- package/lib/binding/node-v120-win32-x64/zlib.dll +0 -0
- package/lib/binding/openssl@1/node-v108-linux-arm64/aerospike.node +0 -0
- package/lib/binding/openssl@1/node-v108-linux-x64/aerospike.node +0 -0
- package/lib/binding/openssl@1/node-v115-linux-arm64/aerospike.node +0 -0
- package/lib/binding/openssl@1/node-v115-linux-x64/aerospike.node +0 -0
- package/lib/binding/openssl@1/node-v120-linux-arm64/aerospike.node +0 -0
- package/lib/binding/openssl@1/node-v120-linux-x64/aerospike.node +0 -0
- package/lib/binding/openssl@3/node-v108-linux-arm64/aerospike.node +0 -0
- package/lib/binding/openssl@3/node-v108-linux-x64/aerospike.node +0 -0
- package/lib/binding/openssl@3/node-v115-linux-arm64/aerospike.node +0 -0
- package/lib/binding/openssl@3/node-v115-linux-x64/aerospike.node +0 -0
- package/lib/binding/openssl@3/node-v120-linux-arm64/aerospike.node +0 -0
- package/lib/binding/openssl@3/node-v120-linux-x64/aerospike.node +0 -0
- package/lib/lists.js +55 -0
- package/lib/policies/batch_policy.js +16 -0
- package/lib/policies/batch_read_policy.js +15 -0
- package/lib/policies/batch_write_policy.js +8 -0
- package/lib/policies/operate_policy.js +15 -0
- package/lib/policies/query_policy.js +10 -0
- package/lib/policies/read_policy.js +15 -0
- package/lib/policy.js +32 -1
- package/lib/status.js +31 -0
- package/lib/typedefs.js +2 -0
- package/package.json +12 -12
- package/src/include/enums.h +2 -0
- package/src/main/aerospike.cc +1 -0
- package/src/main/bit_operations.cc +1 -1
- package/src/main/config.cc +20 -0
- package/src/main/enums/query_duration.cc +38 -0
- package/src/main/enums/ttl.cc +1 -0
- package/src/main/list_operations.cc +25 -1
- package/src/main/policy.cc +35 -1
- package/src/main/util/conversions_batch.cc +1 -0
- package/test/admin.js +12 -9
- package/test/batch_apply.js +2 -1
- package/test/batch_exists.js +2 -1
- package/test/batch_get.js +2 -1
- package/test/batch_read.js +191 -11
- package/test/batch_remove.js +2 -1
- package/test/batch_select.js +2 -1
- package/test/batch_write.js +68 -11
- package/test/client.js +8 -7
- package/test/config.js +2 -1
- package/test/enterprise.js +2 -2
- package/test/error.js +5 -4
- package/test/exists.js +5 -4
- package/test/exp.js +2 -0
- package/test/exp_map.js +0 -2
- package/test/get.js +87 -0
- package/test/index.js +4 -4
- package/test/index_job.js +3 -2
- package/test/info.js +8 -7
- package/test/key.js +37 -36
- package/test/lists.js +64 -0
- package/test/maps.js +54 -46
- package/test/operate.js +88 -2
- package/test/policy.js +11 -10
- package/test/put.js +1 -1
- package/test/query.js +270 -169
- package/test/remove.js +3 -3
- package/test/scan.js +9 -8
- package/test/stats.js +3 -2
- package/test/test_helper.js +0 -2
- package/typings/index.d.ts +31 -23
- package/lib/binding/node-v115-win32-x64/aerospike-core-client/aerospik.95E228AA.tlog/CustomBuild.command.1.tlog +0 -3
- package/lib/binding/node-v115-win32-x64/aerospike-core-client/aerospik.95E228AA.tlog/CustomBuild.read.1.tlog +0 -1
- package/lib/binding/node-v115-win32-x64/aerospike-core-client/aerospik.95E228AA.tlog/CustomBuild.write.1.tlog +0 -3
- package/lib/binding/node-v115-win32-x64/aerospike-core-client/aerospik.95E228AA.tlog/aerospike-core-client.lastbuildstate +0 -2
- package/lib/binding/node-v115-win32-x64/aerospike-core-client/aerospik.95E228AA.tlog/unsuccessfulbuild +0 -0
- package/lib/binding/node-v120-darwin-x64/node-v120-darwin-x64/aerospike.node +0 -0
package/README.md
CHANGED
|
@@ -78,8 +78,11 @@ const config = {
|
|
|
78
78
|
|
|
79
79
|
const key = new Aerospike.Key('test', 'demo', 'demo')
|
|
80
80
|
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
;(async function () {
|
|
82
|
+
let client
|
|
83
|
+
try {
|
|
84
|
+
client = await Aerospike.connect(config)
|
|
85
|
+
|
|
83
86
|
const bins = {
|
|
84
87
|
i: 123,
|
|
85
88
|
s: 'hello',
|
|
@@ -97,39 +100,32 @@ Aerospike.connect(config)
|
|
|
97
100
|
totalTimeout : 0
|
|
98
101
|
})
|
|
99
102
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
})
|
|
127
|
-
.catch(error => {
|
|
128
|
-
console.error('Error: %s [%i]', error.message, error.code)
|
|
129
|
-
if (error.client) {
|
|
130
|
-
error.client.close()
|
|
131
|
-
}
|
|
132
|
-
})
|
|
103
|
+
|
|
104
|
+
await client.put(key, bins, meta, policy)
|
|
105
|
+
const ops = [
|
|
106
|
+
Aerospike.operations.incr('i', 1),
|
|
107
|
+
Aerospike.operations.read('i'),
|
|
108
|
+
Aerospike.lists.append('l', 'z'),
|
|
109
|
+
Aerospike.maps.removeByKey('m', 'bar')
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
await client.operate(key, ops)
|
|
113
|
+
let record = await client.get(key)
|
|
114
|
+
|
|
115
|
+
console.log(record.bins) // => { i: 124,
|
|
116
|
+
// s: 'hello',
|
|
117
|
+
// b: <Buffer 77 6f 72 6c 64>,
|
|
118
|
+
// d: 3.1415,
|
|
119
|
+
// g: '{"type":"Point","coordinates":[103.913,1.308]}',
|
|
120
|
+
// l: [ 1, 'a', { x: 'y' }, 'z' ],
|
|
121
|
+
// m: { foo: 4 } }
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error('Error:', error)
|
|
124
|
+
process.exit(1)
|
|
125
|
+
} finally {
|
|
126
|
+
if (client) client.close()
|
|
127
|
+
}
|
|
128
|
+
})()
|
|
133
129
|
```
|
|
134
130
|
## Prerequisites
|
|
135
131
|
|
|
@@ -188,6 +184,10 @@ To install library prerequisites using `apt`:
|
|
|
188
184
|
sudo apt install g++ libssl libssl-dev zlib1g-dev
|
|
189
185
|
```
|
|
190
186
|
|
|
187
|
+
### Windows
|
|
188
|
+
|
|
189
|
+
See our [Windows README.md](https://github.com/aerospike/aerospike-client-nodejs/blob/master/README_WINDOWS.md) for details on how to build and install on windows.
|
|
190
|
+
|
|
191
191
|
### macOS
|
|
192
192
|
|
|
193
193
|
Before starting with the Aerospike Nodejs Client, verify that you have the following prerequisites:
|
package/binding.gyp
CHANGED
|
@@ -144,13 +144,14 @@
|
|
|
144
144
|
'src/main/enums/config_enum.cc',
|
|
145
145
|
'src/main/enums/exp_enum.cc',
|
|
146
146
|
'src/main/enums/batch_type.cc',
|
|
147
|
+
'src/main/enums/query_duration.cc',
|
|
147
148
|
'src/main/enums/privilege_code.cc',
|
|
148
149
|
'src/main/enums/exp_read_flags.cc',
|
|
149
150
|
'src/main/enums/exp_write_flags.cc',
|
|
150
151
|
'src/main/stats.cc',
|
|
151
152
|
'src/main/util/conversions.cc',
|
|
152
153
|
'src/main/util/conversions_batch.cc',
|
|
153
|
-
'src/main/util/log.cc'
|
|
154
|
+
'src/main/util/log.cc',
|
|
154
155
|
],
|
|
155
156
|
'configurations': {
|
|
156
157
|
'Release': {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as Aerospike from 'aerospike';
|
|
2
|
+
|
|
3
|
+
(async function () {
|
|
4
|
+
let client = null;
|
|
5
|
+
try {
|
|
6
|
+
client = await Aerospike.connect();
|
|
7
|
+
const key = new Aerospike.Key('test', 'test', 'abcd');
|
|
8
|
+
const bins = {
|
|
9
|
+
name: 'Norma',
|
|
10
|
+
age: 31
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
await client.put(key, bins);
|
|
14
|
+
const record = await client.get(key);
|
|
15
|
+
console.info('Record:', record);
|
|
16
|
+
await client.remove(key);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error('Error:', error);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
} finally {
|
|
21
|
+
if (client) client.close();
|
|
22
|
+
}
|
|
23
|
+
})();
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
^C:\USERS\ADMINISTRATOR\DOCUMENTS\AEROSPIKE-CLIENT-NODEJS\BINDING.GYP
|
|
2
|
-
call call "pwsh" "../scripts/build-c-client.ps1" "-Configuration" "Release" "-NodeLibFile" "C:/Users/Administrator/AppData/Local/node-gyp/Cache/18.
|
|
2
|
+
call call "pwsh" "../scripts/build-c-client.ps1" "-Configuration" "Release" "-NodeLibFile" "C:/Users/Administrator/AppData/Local/node-gyp/Cache/18.20.2/x64/node.lib"
|
|
3
3
|
if %errorlevel% neq 0 exit /b %errorlevel%
|
|
File without changes
|
|
File without changes
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.
|
|
1
|
+
PlatformToolSet=v143:VCToolArchitecture=Native64Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0:
|
|
2
2
|
Release|x64|C:\Users\Administrator\Documents\aerospike-client-nodejs\build\|
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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/lists.js
CHANGED
|
@@ -1079,6 +1079,61 @@ exports.clear = function (bin) {
|
|
|
1079
1079
|
return new ListOperation(opcodes.LIST_CLEAR, bin)
|
|
1080
1080
|
}
|
|
1081
1081
|
|
|
1082
|
+
/**
|
|
1083
|
+
* @summary Creates list create operation.
|
|
1084
|
+
*
|
|
1085
|
+
*
|
|
1086
|
+
* @param {string} bin - bin name.
|
|
1087
|
+
* @param {number} order - list order.
|
|
1088
|
+
* @parm {boolean} pad - If true, the context is allowed to be beyond list boundaries. In that case, nil
|
|
1089
|
+
* list entries will be inserted to satisfy the context position.
|
|
1090
|
+
* @param {boolean} persistIndex - If true, persist list index. A list index improves lookup performance,
|
|
1091
|
+
* but requires more storage. A list index can be created for a top-level ordered list only. Nested and
|
|
1092
|
+
* unordered list indexes are not supported.
|
|
1093
|
+
* @param {number} ctx - optional path to nested list. If not defined, the top-level list is used.
|
|
1094
|
+
*
|
|
1095
|
+
* @returns {Object} Operation that can be passed to the {@link Client#operate} command.
|
|
1096
|
+
*
|
|
1097
|
+
* @example
|
|
1098
|
+
*
|
|
1099
|
+
* const Aerospike = require('aerospike')
|
|
1100
|
+
* const lists = Aerospike.lists
|
|
1101
|
+
* const key = new Aerospike.Key('test', 'demo', 'listKey')
|
|
1102
|
+
*
|
|
1103
|
+
* // INSERT HOSTNAME AND PORT NUMBER OF AEROSPIKE SERVER NODE HERE!
|
|
1104
|
+
* var config = {
|
|
1105
|
+
* hosts: '192.168.33.10:3000',
|
|
1106
|
+
* // Timeouts disabled, latency dependent on server location. Configure as needed.
|
|
1107
|
+
* policies: {
|
|
1108
|
+
* operate : new Aerospike.OperatePolicy({socketTimeout : 0, totalTimeout : 0})
|
|
1109
|
+
* }
|
|
1110
|
+
* }
|
|
1111
|
+
*
|
|
1112
|
+
* Aerospike.connect(config).then(async client => {
|
|
1113
|
+
* let ops = [
|
|
1114
|
+
* lists.create('list', lists.order.ORDERED, false, true)
|
|
1115
|
+
* ]
|
|
1116
|
+
* let result = await client.operate(key, ops)
|
|
1117
|
+
* console.log(result.bins) // => { list: null }
|
|
1118
|
+
* let record = await client.get(key)
|
|
1119
|
+
* console.log(record.bins) // => { list: [] }
|
|
1120
|
+
*
|
|
1121
|
+
* await client.remove(key)
|
|
1122
|
+
* client.close()
|
|
1123
|
+
* })
|
|
1124
|
+
*/
|
|
1125
|
+
exports.create = function (bin, order, pad = false, persistIndex = false, ctx) {
|
|
1126
|
+
const op = new ListOperation(opcodes.LIST_CREATE, bin)
|
|
1127
|
+
op.order = order
|
|
1128
|
+
op.pad = pad
|
|
1129
|
+
op.persistIndex = persistIndex
|
|
1130
|
+
if (ctx === undefined) {
|
|
1131
|
+
return op
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
return op.withContext(ctx)
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1082
1137
|
/**
|
|
1083
1138
|
* @summary Sets the list element at the specified index to a new value.
|
|
1084
1139
|
* @description This operation returns no result.
|
|
@@ -58,6 +58,22 @@ class BatchPolicy extends BasePolicy {
|
|
|
58
58
|
* @see {@link module:aerospike/policy.readModeSC} for supported policy values.
|
|
59
59
|
*/
|
|
60
60
|
this.readModeSC = props.readModeSC
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Determine how record TTL (time to live) is affected on reads. When enabled, the server can
|
|
64
|
+
* efficiently operate as a read-based LRU cache where the least recently used records are expired.
|
|
65
|
+
* The value is expressed as a percentage of the TTL sent on the most recent write such that a read
|
|
66
|
+
* within this interval of the record’s end of life will generate a touch.
|
|
67
|
+
*
|
|
68
|
+
* For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
|
|
69
|
+
* 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
|
|
70
|
+
* recent write) will result in a touch, resetting the TTL to another 10 hours.
|
|
71
|
+
* *
|
|
72
|
+
* @type number
|
|
73
|
+
* @default 0
|
|
74
|
+
*/
|
|
75
|
+
this.readTouchTtlPercent = props.readTouchTtlPercent
|
|
76
|
+
|
|
61
77
|
/**
|
|
62
78
|
* Determine if batch commands to each server are run in parallel threads.
|
|
63
79
|
*
|
|
@@ -52,6 +52,21 @@ class BatchReadPolicy {
|
|
|
52
52
|
* @see {@link module:aerospike/policy.readModeSC} for supported policy values.
|
|
53
53
|
*/
|
|
54
54
|
this.readModeSC = props.readModeSC
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Determine how record TTL (time to live) is affected on reads. When enabled, the server can
|
|
58
|
+
* efficiently operate as a read-based LRU cache where the least recently used records are expired.
|
|
59
|
+
* The value is expressed as a percentage of the TTL sent on the most recent write such that a read
|
|
60
|
+
* within this interval of the record’s end of life will generate a touch.
|
|
61
|
+
*
|
|
62
|
+
* For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
|
|
63
|
+
* 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
|
|
64
|
+
* recent write) will result in a touch, resetting the TTL to another 10 hours.
|
|
65
|
+
* *
|
|
66
|
+
* @type number
|
|
67
|
+
* @default 0
|
|
68
|
+
*/
|
|
69
|
+
this.readTouchTtlPercent = props.readTouchTtlPercent
|
|
55
70
|
}
|
|
56
71
|
}
|
|
57
72
|
|
|
@@ -36,6 +36,14 @@ class BatchWritePolicy {
|
|
|
36
36
|
*
|
|
37
37
|
*/
|
|
38
38
|
this.filterExpression = props.filterExpression
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The time-to-live (expiration) of the record in seconds.
|
|
42
|
+
*
|
|
43
|
+
* @type number
|
|
44
|
+
*/
|
|
45
|
+
this.ttl = props.ttl
|
|
46
|
+
|
|
39
47
|
/**
|
|
40
48
|
* Specifies the behavior for the key.
|
|
41
49
|
*
|
|
@@ -113,6 +113,21 @@ class OperatePolicy extends BasePolicy {
|
|
|
113
113
|
* @see {@link module:aerospike/policy.readModeSC} for supported policy values.
|
|
114
114
|
*/
|
|
115
115
|
this.readModeSC = props.readModeSC
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Determine how record TTL (time to live) is affected on reads. When enabled, the server can
|
|
119
|
+
* efficiently operate as a read-based LRU cache where the least recently used records are expired.
|
|
120
|
+
* The value is expressed as a percentage of the TTL sent on the most recent write such that a read
|
|
121
|
+
* within this interval of the record’s end of life will generate a touch.
|
|
122
|
+
*
|
|
123
|
+
* For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
|
|
124
|
+
* 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
|
|
125
|
+
* recent write) will result in a touch, resetting the TTL to another 10 hours.
|
|
126
|
+
* *
|
|
127
|
+
* @type number
|
|
128
|
+
* @default 0
|
|
129
|
+
*/
|
|
130
|
+
this.readTouchTtlPercent = props.readTouchTtlPercent
|
|
116
131
|
}
|
|
117
132
|
}
|
|
118
133
|
|
|
@@ -95,6 +95,16 @@ class QueryPolicy extends BasePolicy {
|
|
|
95
95
|
* @override
|
|
96
96
|
*/
|
|
97
97
|
this.totalTimeout = props.totalTimeout
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Expected query duration. The server treats the query in different ways depending on the expected duration.
|
|
101
|
+
* This field is ignored for aggregation queries, background queries and server versions < 6.0.
|
|
102
|
+
*
|
|
103
|
+
* @see {@link module:aerospike/policy.queryDuration} for supported policy values.
|
|
104
|
+
* @type {@link module:aerospike/policy.queryDuration}
|
|
105
|
+
* @default {@link module:aerospike/policy.queryDuration.LONG}
|
|
106
|
+
*/
|
|
107
|
+
this.expectedDuration = props.expectedDuration
|
|
98
108
|
}
|
|
99
109
|
}
|
|
100
110
|
|
|
@@ -68,6 +68,21 @@ class ReadPolicy extends BasePolicy {
|
|
|
68
68
|
*/
|
|
69
69
|
this.readModeSC = props.readModeSC
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Determine how record TTL (time to live) is affected on reads. When enabled, the server can
|
|
73
|
+
* efficiently operate as a read-based LRU cache where the least recently used records are expired.
|
|
74
|
+
* The value is expressed as a percentage of the TTL sent on the most recent write such that a read
|
|
75
|
+
* within this interval of the record’s end of life will generate a touch.
|
|
76
|
+
*
|
|
77
|
+
* For example, if the most recent write had a TTL of 10 hours and read_touch_ttl_percent is set to
|
|
78
|
+
* 80, the next read within 8 hours of the record's end of life (equivalent to 2 hours after the most
|
|
79
|
+
* recent write) will result in a touch, resetting the TTL to another 10 hours.
|
|
80
|
+
* *
|
|
81
|
+
* @type number
|
|
82
|
+
* @default 0
|
|
83
|
+
*/
|
|
84
|
+
this.readTouchTtlPercent = props.readTouchTtlPercent
|
|
85
|
+
|
|
71
86
|
/**
|
|
72
87
|
* Should CDT data types (Lists / Maps) be deserialized to JS data types
|
|
73
88
|
* (Arrays / Objects) or returned as raw bytes (Buffer).
|
package/lib/policy.js
CHANGED
|
@@ -60,7 +60,7 @@ const AdminPolicy = require('./policies/admin_policy')
|
|
|
60
60
|
* * {@link WritePolicy} - Applies to {@link Client#put}.
|
|
61
61
|
* * {@link BatchPolicy} - Applies to {@link Client#batchRead} as well as the
|
|
62
62
|
* deprecated {@link Client#batchExists}, {@link Client#batchGet}, and {@link
|
|
63
|
-
* Client#batchSelect} operations.
|
|
63
|
+
* Client#batchSelect} operations. Also used when providing batchParentWrite policy to a client configuration.
|
|
64
64
|
* * {@link BatchApplyPolicy} - Applies to {@link Client#batchApply}.
|
|
65
65
|
* * {@link BatchReadPolicy} - Applies to {@link Client#batchRead}.
|
|
66
66
|
* * {@link BatchRemovePolicy} - Applies to {@link Client#batchRemove}.
|
|
@@ -296,6 +296,36 @@ exports.readModeSC = as.policy.readModeSC
|
|
|
296
296
|
*/
|
|
297
297
|
exports.commitLevel = as.policy.commitLevel
|
|
298
298
|
|
|
299
|
+
/**
|
|
300
|
+
* @summary Expected query duration. The server treats the query in different ways depending on the expected duration.
|
|
301
|
+
* This enum is ignored for aggregation (UDF) queries, background queries and server versions < 6.0.
|
|
302
|
+
*
|
|
303
|
+
* @enum {number}
|
|
304
|
+
*
|
|
305
|
+
* @property {number} LONG - The query is expected to return more than 100 records per node. The server optimizes for a
|
|
306
|
+
* large record set in the following ways:
|
|
307
|
+
* <ul>
|
|
308
|
+
* <li>Allow query to be run in multiple threads using the server's query threading configuration.</li>
|
|
309
|
+
* <li>Do not relax read consistency for AP namespaces.</li>
|
|
310
|
+
* <li>Add the query to the server's query monitor.</li>
|
|
311
|
+
* <li>Do not add the overall latency to the server's latency histogram.</li>
|
|
312
|
+
* <li>Do not allow server timeouts.</li>
|
|
313
|
+
* </ul>
|
|
314
|
+
* @property {number} SHORT - The query is expected to return less than 100 records per node. The server optimizes for a
|
|
315
|
+
* small record set in the following ways:
|
|
316
|
+
* <ul>
|
|
317
|
+
* <li>Always run the query in one thread and ignore the server's query threading configuration.</li>
|
|
318
|
+
* <li>Allow query to be inlined directly on the server's service thread.</li>
|
|
319
|
+
* <li>Relax read consistency for AP namespaces.</li>
|
|
320
|
+
* <li>Do not add the query to the server's query monitor.</li>
|
|
321
|
+
* <li>Add the overall latency to the server's latency histogram.</li>
|
|
322
|
+
* <li>Allow server timeouts. The default server timeout for a short query is 1 second.</li>
|
|
323
|
+
* </ul>
|
|
324
|
+
* @property {number} LONG_RELAX_AP - Treat query as a LONG query, but relax read consistency for AP namespaces.
|
|
325
|
+
* This value is treated exactly like LONG for server versions < 7.1.
|
|
326
|
+
*/
|
|
327
|
+
exports.queryDuration = as.queryDuration
|
|
328
|
+
|
|
299
329
|
/**
|
|
300
330
|
* A base class extended to client policies.
|
|
301
331
|
*
|
|
@@ -443,6 +473,7 @@ function policyClass (type) {
|
|
|
443
473
|
case 'batchRead': return BatchReadPolicy
|
|
444
474
|
case 'batchRemove': return BatchRemovePolicy
|
|
445
475
|
case 'batchWrite': return BatchWritePolicy
|
|
476
|
+
case 'batchParentWrite': return BatchPolicy
|
|
446
477
|
case 'batchApply': return BatchApplyPolicy
|
|
447
478
|
case 'commandQueue': return CommandQueuePolicy
|
|
448
479
|
case 'hll': return HLLPolicy
|
package/lib/status.js
CHANGED
|
@@ -24,6 +24,37 @@ const as = require('bindings')('aerospike.node')
|
|
|
24
24
|
* @description Database operation error codes.
|
|
25
25
|
*/
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* One or more keys failed in a batch.
|
|
29
|
+
* @const {number}
|
|
30
|
+
*/
|
|
31
|
+
exports.BATCH_FAILED = exports.AEROSPIKE_BATCH_FAILED = as.status.AEROSPIKE_BATCH_FAILED
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* No response received from server.
|
|
35
|
+
* @const {number}
|
|
36
|
+
*/
|
|
37
|
+
exports.NO_RESPONSE = exports.AEROSPIKE_NO_RESPONSE = as.status.AEROSPIKE_NO_RESPONSE
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Max errors limit reached.
|
|
41
|
+
* @const {number}
|
|
42
|
+
*/
|
|
43
|
+
exports.MAX_ERROR_RATE = exports.AEROSPIKE_MAX_ERROR_RATE = as.status.AEROSPIKE_MAX_ERROR_RATE
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Abort split batch retry and use normal node retry instead.
|
|
47
|
+
* Used internally and should not be returned to user.
|
|
48
|
+
* @const {number}
|
|
49
|
+
*/
|
|
50
|
+
exports.USE_NORMAL_RETRY = exports.AEROSPIKE_USE_NORMAL_RETRY = as.status.AEROSPIKE_USE_NORMAL_RETRY
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Max retries limit reached.
|
|
54
|
+
* @const {number}
|
|
55
|
+
*/
|
|
56
|
+
exports.ERR_MAX_RETRIES_EXCEEDED = exports.AEROSPIKE_ERR_MAX_RETRIES_EXCEEDED = as.status.AEROSPIKE_ERR_MAX_RETRIES_EXCEEDED
|
|
57
|
+
|
|
27
58
|
/**
|
|
28
59
|
* Async command delay queue is full.
|
|
29
60
|
* @const {number}
|
package/lib/typedefs.js
CHANGED
|
@@ -229,6 +229,8 @@
|
|
|
229
229
|
*
|
|
230
230
|
* @property {ApplyPolicy} apply - Default apply policy
|
|
231
231
|
* @property {BatchPolicy} batch - Default batch policy
|
|
232
|
+
* @property {BatchPolicy} batchWrite - Default write policy used in batch operate commands. Contains a {@link BatchWritePolicy}.
|
|
233
|
+
* @property {BatchPolicy} batchParentWrite - Default parent policy used in batch write commands. Contains a {@link BatchPolicy}.
|
|
232
234
|
* @property {InfoPolicy} info - Default info policy
|
|
233
235
|
* @property {OperatePolicy} operate - Default operate policy
|
|
234
236
|
* @property {ReadPolicy} read - Default read policy
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aerospike",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.0",
|
|
4
4
|
"description": "Aerospike Client Library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aerospike",
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"install": "npm-run-all removeExtraBinaries build",
|
|
43
43
|
"build": "node-pre-gyp install --fallback-to-build",
|
|
44
44
|
"test": "mocha",
|
|
45
|
+
"test-dry-run": "mocha --dry-run",
|
|
45
46
|
"test-noserver": "GLOBAL_CLIENT=false mocha -g '#noserver'",
|
|
46
47
|
"lint": "standard",
|
|
47
48
|
"posttest": "npm run lint",
|
|
@@ -58,26 +59,25 @@
|
|
|
58
59
|
"@mapbox/node-pre-gyp": "^1.0.11",
|
|
59
60
|
"bindings": "^1.5.0",
|
|
60
61
|
"minimatch": "^3.1.2",
|
|
61
|
-
"nan": "^2.
|
|
62
|
-
"node-gyp": "^
|
|
62
|
+
"nan": "^2.19.0",
|
|
63
|
+
"node-gyp": "^10.1.0",
|
|
63
64
|
"npm-run-all": "^4.1.5"
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
|
-
"@types/node": "^
|
|
67
|
-
"chai": "^4.
|
|
67
|
+
"@types/node": "^20.12.7",
|
|
68
|
+
"chai": "^4.4.1",
|
|
68
69
|
"choma": "^1.2.1",
|
|
69
70
|
"codecov": "^3.8.3",
|
|
70
71
|
"deep-eql": "^4.1.3",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"mocha": "^9.2.2",
|
|
72
|
+
"husky": "^9.0.11",
|
|
73
|
+
"mocha": "^10.4.0",
|
|
74
74
|
"mocha-clean": "^1.0.0",
|
|
75
75
|
"nyc": "^15.1.0",
|
|
76
76
|
"p-throttle": "^3.1.0",
|
|
77
|
-
"semver": "^7.
|
|
78
|
-
"standard": "^
|
|
79
|
-
"tmp": "^0.
|
|
80
|
-
"yargs": "^
|
|
77
|
+
"semver": "^7.6.0",
|
|
78
|
+
"standard": "^17.1.0",
|
|
79
|
+
"tmp": "^0.2.3",
|
|
80
|
+
"yargs": "^17.7.2"
|
|
81
81
|
},
|
|
82
82
|
"standard": {
|
|
83
83
|
"ignore": [
|
package/src/include/enums.h
CHANGED
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
#define TTL_NAMESPACE_DEFAULT 0
|
|
22
22
|
#define TTL_NEVER_EXPIRE -1
|
|
23
23
|
#define TTL_DONT_UPDATE -2
|
|
24
|
+
#define TTL_CLIENT_DEFAULT -3
|
|
24
25
|
|
|
25
26
|
v8::Local<v8::Object> auth_mode_enum_values();
|
|
26
27
|
v8::Local<v8::Object> bitwise_enum_values();
|
|
@@ -40,6 +41,7 @@ v8::Local<v8::Object> retry_policy_values();
|
|
|
40
41
|
v8::Local<v8::Object> status();
|
|
41
42
|
v8::Local<v8::Object> ttl_enum_values();
|
|
42
43
|
v8::Local<v8::Object> batchTypes();
|
|
44
|
+
v8::Local<v8::Object> queryDuration();
|
|
43
45
|
v8::Local<v8::Object> privilegeCode();
|
|
44
46
|
v8::Local<v8::Object> expReadFlags();
|
|
45
47
|
v8::Local<v8::Object> expWriteFlags();
|
package/src/main/aerospike.cc
CHANGED
|
@@ -156,6 +156,7 @@ NAN_MODULE_INIT(Aerospike)
|
|
|
156
156
|
export("ttl", ttl_enum_values());
|
|
157
157
|
export("auth", auth_mode_enum_values());
|
|
158
158
|
export("batchTypes", batchTypes());
|
|
159
|
+
export("queryDuration", queryDuration());
|
|
159
160
|
export("privilegeCode", privilegeCode());
|
|
160
161
|
export("expReadFlags", expReadFlags());
|
|
161
162
|
export("expWriteFlags", expWriteFlags());
|
|
@@ -254,7 +254,7 @@ bool add_bit_rshift_op(as_operations *ops, char *bin, as_bit_policy *policy,
|
|
|
254
254
|
|
|
255
255
|
typedef bool (*AsBitMath)(as_operations *ops, const char *bin, as_cdt_ctx *ctx,
|
|
256
256
|
as_bit_policy *policy, int bit_offset,
|
|
257
|
-
uint32_t bit_size,
|
|
257
|
+
uint32_t bit_size, uint64_t value, bool sign,
|
|
258
258
|
as_bit_overflow_action action);
|
|
259
259
|
|
|
260
260
|
bool add_bit_math_op(as_operations *ops, AsBitMath math_op, char *bin,
|