aerospike 4.0.4 → 5.0.2
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 +119 -146
- package/binding.gyp +5 -1
- package/docker/Dockerfile.alpine +47 -0
- package/docker/Dockerfile.bullseye-slim +18 -0
- package/docker/Dockerfile.lambda +44 -0
- package/docker/Dockerfile.ubuntu22.04 +45 -0
- package/examples/batch.js +1 -1
- package/examples/put.js +1 -1
- package/examples/shared/cli.js +1 -1
- package/lib/aerospike.js +18 -16
- package/lib/batch_type.js +54 -0
- package/lib/binding/node-v102-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v102-linux-x64/aerospike.node +0 -0
- package/lib/binding/node-v102-win32-x64/aerospike.node +0 -0
- package/lib/binding/node-v108-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v108-linux-x64/aerospike.node +0 -0
- package/lib/binding/node-v108-win32-x64/aerospike.node +0 -0
- package/lib/binding/node-v64-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v64-linux-x64/aerospike.node +0 -0
- package/lib/binding/node-v64-win32-x64/aerospike.node +0 -0
- package/lib/binding/node-v72-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v72-linux-x64/aerospike.node +0 -0
- package/lib/binding/node-v72-win32-x64/aerospike.node +0 -0
- package/lib/binding/node-v83-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v83-linux-x64/aerospike.node +0 -0
- package/lib/binding/node-v83-win32-x64/aerospike.node +0 -0
- package/lib/binding/node-v93-darwin-x64/aerospike.node +0 -0
- package/lib/binding/node-v93-linux-x64/aerospike.node +0 -0
- package/lib/binding/node-v93-win32-x64/aerospike.node +0 -0
- package/lib/client.js +258 -6
- package/lib/commands/index.js +3 -0
- package/lib/commands/query_background_command.js +1 -1
- package/lib/exp.js +0 -1
- package/lib/exp_operations.js +1 -1
- package/lib/policies/base_policy.js +19 -44
- package/lib/policies/batch_apply_policy.js +75 -0
- package/lib/policies/batch_policy.js +75 -20
- package/lib/policies/batch_read_policy.js +58 -0
- package/lib/policies/batch_remove_policy.js +84 -0
- package/lib/policies/batch_write_policy.js +84 -0
- package/lib/policies/command_queue_policy.js +1 -1
- package/lib/policies/query_policy.js +0 -8
- package/lib/policies/scan_policy.js +0 -8
- package/lib/policy.js +112 -48
- package/lib/query.js +40 -65
- package/lib/record.js +124 -2
- package/lib/scan.js +32 -0
- package/lib/status.js +1 -1
- package/package.json +3 -2
- package/scripts/build-c-client.sh +3 -0
- package/scripts/build-c-client.sh-cclient-output.log +462 -482
- package/scripts/build-c-client.sh-libuv-output.log +92 -89
- package/scripts/build-commands.sh +23 -0
- package/scripts/build-package.ps1 +5 -0
- package/scripts/build-package.sh +2 -0
- package/scripts/build-package.sh-cclient-output.log +124 -124
- package/src/include/async.h +15 -11
- package/src/include/client.h +64 -58
- package/src/include/command.h +41 -32
- package/src/include/config.h +2 -1
- package/src/include/conversions.h +115 -52
- package/src/include/enums.h +4 -3
- package/src/include/events.h +3 -2
- package/src/include/expressions.h +2 -1
- package/src/include/log.h +27 -20
- package/src/include/operations.h +17 -8
- package/src/include/policy.h +35 -10
- package/src/include/query.h +4 -2
- package/src/include/scan.h +3 -1
- package/src/main/aerospike.cc +18 -13
- package/src/main/async.cc +51 -51
- package/src/main/bit_operations.cc +195 -145
- package/src/main/cdt_ctx.cc +55 -45
- package/src/main/client.cc +44 -27
- package/src/main/command.cc +27 -26
- package/src/main/commands/apply_async.cc +30 -18
- package/src/main/commands/batch_apply.cc +259 -0
- package/src/main/commands/batch_exists.cc +65 -53
- package/src/main/commands/batch_get.cc +66 -55
- package/src/main/commands/batch_read_async.cc +21 -14
- package/src/main/commands/batch_remove.cc +219 -0
- package/src/main/commands/batch_select.cc +76 -60
- package/src/main/commands/batch_write_async.cc +76 -0
- package/src/main/commands/exists_async.cc +19 -11
- package/src/main/commands/get_async.cc +18 -11
- package/src/main/commands/index_create.cc +63 -44
- package/src/main/commands/index_remove.cc +43 -32
- package/src/main/commands/info_any.cc +55 -42
- package/src/main/commands/info_foreach.cc +75 -60
- package/src/main/commands/info_host.cc +63 -47
- package/src/main/commands/info_node.cc +60 -46
- package/src/main/commands/job_info.cc +40 -34
- package/src/main/commands/operate_async.cc +20 -12
- package/src/main/commands/put_async.cc +26 -15
- package/src/main/commands/query_apply.cc +44 -38
- package/src/main/commands/query_async.cc +39 -14
- package/src/main/commands/query_background.cc +41 -30
- package/src/main/commands/query_foreach.cc +67 -62
- package/src/main/commands/remove_async.cc +19 -11
- package/src/main/commands/scan_async.cc +40 -15
- package/src/main/commands/scan_background.cc +41 -30
- package/src/main/commands/select_async.cc +23 -13
- package/src/main/commands/truncate.cc +44 -31
- package/src/main/commands/udf_register.cc +67 -46
- package/src/main/commands/udf_remove.cc +32 -25
- package/src/main/config.cc +227 -91
- package/src/{include/predexp.h → main/enums/batch_type.cc} +17 -7
- package/src/main/enums/bitwise_enum.cc +2 -1
- package/src/main/enums/config_enum.cc +4 -2
- package/src/main/enums/exp_enum.cc +4 -2
- package/src/main/enums/hll_enum.cc +2 -1
- package/src/main/enums/index.cc +2 -1
- package/src/main/enums/job_status.cc +2 -1
- package/src/main/enums/lists.cc +8 -4
- package/src/main/enums/maps.cc +35 -28
- package/src/main/enums/policy_enum.cc +20 -15
- package/src/main/enums/predicates.cc +2 -1
- package/src/main/enums/scanPriority.cc +2 -1
- package/src/main/enums/status.cc +36 -18
- package/src/main/enums/ttl.cc +2 -1
- package/src/main/enums/udf_languages.cc +6 -5
- package/src/main/events.cc +71 -70
- package/src/main/exp_operations.cc +22 -26
- package/src/main/expressions.cc +76 -42
- package/src/main/hll_operations.cc +108 -76
- package/src/main/list_operations.cc +354 -241
- package/src/main/map_operations.cc +352 -239
- package/src/main/operations.cc +17 -18
- package/src/main/policy.cc +479 -115
- package/src/main/query.cc +135 -95
- package/src/main/scalar_operations.cc +105 -79
- package/src/main/scan.cc +30 -18
- package/src/main/stats.cc +32 -23
- package/src/main/util/conversions.cc +1465 -1306
- package/src/main/util/conversions_batch.cc +463 -0
- package/src/main/util/log.cc +22 -27
- package/test/batch_apply.js +86 -0
- package/test/batch_read.js +8 -8
- package/test/batch_remove.js +76 -0
- package/test/batch_write.js +187 -0
- package/test/client.js +0 -17
- package/test/query.js +28 -0
- package/test/remove_bin.js +48 -0
- package/test/scan.js +14 -2
- package/typings/index.d.ts +14 -67
- package/lib/predexp.js +0 -1123
- package/scripts/build-package.sh-libuv-output.log +0 -118
- package/src/main/predexp.cc +0 -139
package/README.md
CHANGED
|
@@ -9,26 +9,8 @@
|
|
|
9
9
|
[downloads-image]: https://img.shields.io/npm/dm/aerospike.svg
|
|
10
10
|
[downloads-url]: http://npm-stat.com/charts.html?package=aerospike
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
The Aerospike Node.js client is a Node.js add-on module, written using V8.
|
|
13
13
|
|
|
14
|
-
The client is compatible with Node.js 10, 12 (LTS), 14 (LTS), and 16 (LTS). It
|
|
15
|
-
supports the following operating systems: CentOS/RHEL 7/8, Debian 8/9/10,
|
|
16
|
-
Ubuntu 18.04/20.04, as well as many Linux distributions compatible with one of
|
|
17
|
-
these OS releases. macOS is also supported. The client port to Windows is a
|
|
18
|
-
community supported project and suitable for application prototyping and
|
|
19
|
-
development.
|
|
20
|
-
|
|
21
|
-
- [Usage](#Usage)
|
|
22
|
-
- [Prerequisites](#Prerequisites)
|
|
23
|
-
- [Installation](#Installation)
|
|
24
|
-
- [Primer on Node.js Modules](#Primer-on-Node.js-Modules)
|
|
25
|
-
- [Installing via npm Registry](#Installing-via-npm-Registry)
|
|
26
|
-
- [Installing via Git Repository](#Installing-via-Git-Repository)
|
|
27
|
-
- [Documentation](#Documentation)
|
|
28
|
-
- [Tests](#Tests)
|
|
29
|
-
- [Benchmarks](#Benchmarks)
|
|
30
|
-
|
|
31
|
-
<a name="Usage"></a>
|
|
32
14
|
## Usage
|
|
33
15
|
|
|
34
16
|
The following is very simple example how to create, update, read and remove a
|
|
@@ -93,62 +75,92 @@ Aerospike.connect(config)
|
|
|
93
75
|
})
|
|
94
76
|
```
|
|
95
77
|
|
|
96
|
-
<a name="Prerequisites"></a>
|
|
97
78
|
## Prerequisites
|
|
98
79
|
|
|
80
|
+
The client is compatible with Node.js 10, 12 (LTS), 14 (LTS), 16 (LTS) and 18 (LTS). It
|
|
81
|
+
supports the following operating systems: CentOS/RHEL 7/8, Debian 8/9/10/11,
|
|
82
|
+
Ubuntu 18.04/20.04, as well as many Linux distributions compatible with one of
|
|
83
|
+
these OS releases. macOS is also supported. The client port to Windows is a
|
|
84
|
+
community supported project and suitable for application prototyping and
|
|
85
|
+
development.
|
|
86
|
+
|
|
99
87
|
The Aerospike Node.js client supports all Node.js [LTS
|
|
100
88
|
releases](https://github.com/nodejs/Release#release-schedule). To download and
|
|
101
89
|
install the latest stable version of Node.js, visit
|
|
102
90
|
[nodejs.org](http://nodejs.org/) or use the version that comes bundled with
|
|
103
91
|
your operating system.
|
|
104
92
|
|
|
105
|
-
|
|
106
|
-
|
|
93
|
+
Install the necessary "development tools" and other libraries to build the client software.
|
|
94
|
+
|
|
95
|
+
Reference various docker files in the repository under the docker / directory for more information.
|
|
96
|
+
|
|
97
|
+
#### CentOS/RHEL
|
|
98
|
+
|
|
99
|
+
To install library prerequisites using `yum`:
|
|
107
100
|
|
|
108
|
-
|
|
101
|
+
```bash
|
|
102
|
+
sudo yum group install "Development Tools"
|
|
103
|
+
sudo yum install openssl openssl-devel
|
|
104
|
+
sudo yum install python3 python3-devel
|
|
105
|
+
```
|
|
109
106
|
|
|
110
|
-
|
|
111
|
-
| --- | --- |
|
|
112
|
-
| libssl | |
|
|
113
|
-
| libcrypto | Required for RIPEMD160 hash function. |
|
|
114
|
-
| libz | Required for (optional) command compression. |
|
|
107
|
+
#### Alpine Linux
|
|
115
108
|
|
|
116
|
-
|
|
109
|
+
```bash
|
|
110
|
+
apk add build-base \
|
|
111
|
+
linux-headers \
|
|
112
|
+
bash \
|
|
113
|
+
libuv-dev \
|
|
114
|
+
openssl-dev \
|
|
115
|
+
lua5.1-dev \
|
|
116
|
+
zlib-dev \
|
|
117
|
+
git \
|
|
118
|
+
python3
|
|
119
|
+
```
|
|
117
120
|
|
|
118
|
-
|
|
121
|
+
#### Amazon Linux
|
|
119
122
|
|
|
120
123
|
```bash
|
|
121
|
-
|
|
124
|
+
yum groupinstall "Development Tools"
|
|
125
|
+
yum install openssl openssl-devel
|
|
126
|
+
yum install python3 python3-devel
|
|
122
127
|
```
|
|
123
128
|
|
|
124
|
-
|
|
129
|
+
#### Debian
|
|
125
130
|
|
|
126
|
-
To install library prerequisites
|
|
131
|
+
To install library prerequisites using `apt-get`:
|
|
127
132
|
|
|
128
133
|
```bash
|
|
129
|
-
sudo apt-
|
|
134
|
+
sudo apt -y install software-properties-common
|
|
135
|
+
sudo apt -y install build-essential
|
|
136
|
+
sudo apt -y install libssl-dev
|
|
137
|
+
sudo apt -y install libarchive-dev cmake rsync curl libcurl4-openssl-dev zip
|
|
138
|
+
sudo apt -y install python3 python3-dev python3-pip
|
|
139
|
+
sudo apt install zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev \
|
|
140
|
+
libsqlite3-dev libreadline-dev libffi-dev libbz2-dev -y
|
|
141
|
+
sudo apt -y install wget libtool m4 automake
|
|
130
142
|
```
|
|
131
143
|
|
|
132
|
-
|
|
144
|
+
#### Ubuntu
|
|
133
145
|
|
|
134
|
-
To install library prerequisites
|
|
146
|
+
To install library prerequisites using `apt`:
|
|
135
147
|
|
|
136
148
|
```bash
|
|
137
|
-
sudo apt
|
|
149
|
+
sudo apt install g++ libssl libssl-dev zlib1g-dev
|
|
138
150
|
```
|
|
139
151
|
|
|
140
|
-
###
|
|
152
|
+
### macOS (Intel)
|
|
141
153
|
|
|
142
|
-
Before starting with the Aerospike Nodejs Client,
|
|
154
|
+
Before starting with the Aerospike Nodejs Client, verify that you have the following prerequisites:
|
|
143
155
|
|
|
144
|
-
-
|
|
156
|
+
- macOS 10.8 or greater.
|
|
145
157
|
- Xcode 5 or greater.
|
|
146
158
|
|
|
147
|
-
###
|
|
159
|
+
### macOS (M1 Chip)
|
|
148
160
|
|
|
149
|
-
Currently C library does not support M1, so you
|
|
150
|
-
As a workaround, you can build your app inside of Docker
|
|
151
|
-
Example of working docker-compose.yaml file
|
|
161
|
+
Currently the C library does not support M1, so you cannot install Aerospike Nodejs Client directly on your mac, see [Issue](https://github.com/aerospike/aerospike-client-nodejs/issues/430).
|
|
162
|
+
As a workaround, you can build your app inside of Docker before using `--platform` [option](https://docs.docker.com/engine/reference/commandline/build/).
|
|
163
|
+
Example of a working docker-compose.yaml file looks similar to this:
|
|
152
164
|
```
|
|
153
165
|
version: '2.4'
|
|
154
166
|
services:
|
|
@@ -157,135 +169,98 @@ services:
|
|
|
157
169
|
platform: linux/amd64
|
|
158
170
|
```
|
|
159
171
|
|
|
160
|
-
|
|
172
|
+
**Openssl Library**
|
|
173
|
+
|
|
174
|
+
The below example shows how to install the Openssl library.
|
|
161
175
|
|
|
162
176
|
```bash
|
|
163
|
-
$ brew install openssl
|
|
164
|
-
$ brew link openssl
|
|
177
|
+
$ brew install openssl
|
|
178
|
+
$ brew link openssl --force
|
|
165
179
|
$ unlink /usr/local/opt/openssl
|
|
166
|
-
$
|
|
180
|
+
$ # Change the below linking based on openssl version and installation path
|
|
181
|
+
$ ln -s /usr/local/Cellar/openssl@x/y.z/ /usr/local/opt/openssl
|
|
167
182
|
```
|
|
183
|
+
For 4x client support, install openssl@1.1 version.
|
|
168
184
|
|
|
169
|
-
|
|
185
|
+
**LIBUV Library**
|
|
170
186
|
|
|
171
|
-
|
|
187
|
+
The example below shows how to install the LIBUV library.
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
$ brew install libuv
|
|
191
|
+
$ brew link libuv --force
|
|
192
|
+
$ unlink /usr/local/opt/libuv
|
|
193
|
+
$ # Change the below linking based on libuv version and installation path
|
|
194
|
+
$ ln -s /usr/local/Cellar/libuv/1.44.1_1/ /usr/local/opt/libuv
|
|
195
|
+
```
|
|
172
196
|
|
|
173
|
-
<a name="Installation"></a>
|
|
174
197
|
## Installation
|
|
175
198
|
|
|
176
|
-
The Aerospike Node.js client is
|
|
177
|
-
C client. The installation will attempt to install the pre-built binaries.
|
|
199
|
+
The Aerospike Node.js client is an add-on module that uses the Aerospike C client. The installation will attempt to install the pre-built binaries including dependent C client.
|
|
178
200
|
|
|
179
|
-
|
|
180
|
-
we provided the following information for those not so familiar with Node.js modules.
|
|
201
|
+
You can install the Aerospike Node.js client like any other Node.js module.
|
|
181
202
|
|
|
182
|
-
<a name="Primer-on-Node.js-Modules"></a>
|
|
183
203
|
### Primer on Node.js Modules
|
|
184
204
|
|
|
185
205
|
Node.js modules are containers of JavaScript code and a `package.json`, which defines
|
|
186
206
|
the module, its dependencies and requirements. Modules are usually installed as
|
|
187
|
-
dependencies of
|
|
207
|
+
dependencies of other Node.js applications or modules. The modules are installed in
|
|
188
208
|
the application's `node_modules` directory, and can be utilized within the program
|
|
189
209
|
by requiring the module by name.
|
|
190
210
|
|
|
191
|
-
|
|
192
|
-
is usually reserved for modules that are not directly depended on by an application,
|
|
193
|
-
but may have executables which you want to be able to call regardless of the
|
|
194
|
-
application. This is usually the case for tools like tools like `npm` and `mocha`.
|
|
195
|
-
|
|
196
|
-
<a name="Installing-via-npm-Registry"></a>
|
|
197
|
-
### Installing via npm Registry
|
|
198
|
-
|
|
199
|
-
Installing via npm Registry is pretty simple and most common install method, as
|
|
200
|
-
it only involves a single step.
|
|
211
|
+
### npm Registry Installations
|
|
201
212
|
|
|
202
|
-
|
|
203
|
-
local installs.
|
|
213
|
+
To install `aerospike` as a dependency of your project, in your project directory run:
|
|
204
214
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
$ npm install aerospike
|
|
215
|
+
```bash
|
|
216
|
+
$ npm install aerospike
|
|
217
|
+
```
|
|
209
218
|
|
|
210
|
-
|
|
211
|
-
its `package.json`.
|
|
219
|
+
To add `aerospike` as a dependency in _package.json_, run:
|
|
212
220
|
|
|
213
|
-
|
|
221
|
+
```bash
|
|
222
|
+
$ npm install aerospike --save-dev
|
|
223
|
+
```
|
|
214
224
|
|
|
215
|
-
|
|
225
|
+
To require the module in your application:
|
|
226
|
+
```bash
|
|
227
|
+
const Aerospike = require('aerospike')
|
|
228
|
+
```
|
|
216
229
|
|
|
217
|
-
|
|
218
|
-
### Installing via Git Repository
|
|
230
|
+
### Git Repository Installations
|
|
219
231
|
|
|
220
|
-
|
|
221
|
-
to install it as a dependency of their application.
|
|
232
|
+
When using a cloned repository, install `aerospike` as a dependency of your application. Instead of referencing the module by name, you reference it by path.
|
|
222
233
|
|
|
223
234
|
To clone the repository use the following command:
|
|
224
235
|
|
|
225
236
|
$ git clone --recursive git@github.com:aerospike/aerospike-client-nodejs.git
|
|
226
237
|
|
|
227
|
-
|
|
228
|
-
registry, in that you will be referencing the module by path, rather than name.
|
|
229
|
-
|
|
230
|
-
Although the module may be installed globally or locally, we recommend performing
|
|
231
|
-
local installs.
|
|
232
|
-
|
|
233
|
-
#### Building dependancy c client
|
|
238
|
+
#### Building dependancy C client
|
|
234
239
|
|
|
235
|
-
Make sure to build
|
|
236
|
-
Run the following commands to build
|
|
240
|
+
Make sure to build the C client before doing npm install variants
|
|
241
|
+
Run the following commands to build the C client:
|
|
237
242
|
|
|
238
243
|
$ ./scripts/build-c-client.sh
|
|
239
244
|
|
|
240
|
-
####
|
|
241
|
-
|
|
242
|
-
This option required root permissions. This will download the Aerospike C client
|
|
243
|
-
only once, which will improve the experience of using the module for many users.
|
|
244
|
-
However, you will need to first install the package globally using root permissions.
|
|
245
|
-
|
|
246
|
-
Run the following as a user with root permission or using the sudo command:
|
|
247
|
-
|
|
248
|
-
$ npm install -g <PATH> --unsafe-perm --build-from-source
|
|
249
|
-
|
|
250
|
-
Where `<PATH>` is the path to the Aerospike Node.js client's Git respository is
|
|
251
|
-
located. This will install the module in a globally accessible location.
|
|
252
|
-
|
|
253
|
-
To install the module as a dependency of your application, run the following
|
|
254
|
-
from your application's directory:
|
|
255
|
-
|
|
256
|
-
$ npm link aerospike
|
|
245
|
+
#### Building and installing Node.js client
|
|
257
246
|
|
|
258
|
-
|
|
247
|
+
To install the module as a dependency of your application, run the following in the application directory:
|
|
259
248
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
#### Installing Locally
|
|
265
|
-
|
|
266
|
-
This option does not require root permissions to install the module as a
|
|
267
|
-
dependency of an application. However, it will require resolving the Aerospike
|
|
268
|
-
C client each time you install the dependency, as it will need to exist local
|
|
269
|
-
to the application.
|
|
270
|
-
|
|
271
|
-
To install the module as a dependency of your application, run the following
|
|
272
|
-
from your application's directory:
|
|
273
|
-
|
|
274
|
-
$ npm install <PATH> --unsafe-perm --build-from-source
|
|
275
|
-
|
|
276
|
-
Where `<PATH>` is the path to the Aerospike Node.js client's Git respository is
|
|
277
|
-
located.
|
|
249
|
+
```bash
|
|
250
|
+
$ npm install --unsafe-perm --build-from-source
|
|
251
|
+
```
|
|
278
252
|
|
|
279
|
-
|
|
253
|
+
To require it in the application:
|
|
280
254
|
|
|
281
|
-
|
|
255
|
+
```bash
|
|
256
|
+
const Aerospike = require('aerospike')
|
|
257
|
+
```
|
|
282
258
|
|
|
283
|
-
<a name="Documentation"></a>
|
|
284
259
|
## Documentation
|
|
285
260
|
|
|
286
|
-
|
|
287
|
-
[
|
|
288
|
-
This documentation is
|
|
261
|
+
Access the client API documentation at:
|
|
262
|
+
[https://docs.aerospike.com/apidocs/nodejs](https://docs.aerospike.com/apidocs/nodejs).
|
|
263
|
+
This documentation is built from the client's source using [JSDocs
|
|
289
264
|
v3](http://usejsdoc.org/index.html) for every release.
|
|
290
265
|
|
|
291
266
|
The API docs also contain a few basic tutorials:
|
|
@@ -297,23 +272,22 @@ The API docs also contain a few basic tutorials:
|
|
|
297
272
|
A variety of additional example applications are provided in the
|
|
298
273
|
[`examples`](examples) directory of this repository.
|
|
299
274
|
|
|
300
|
-
|
|
301
|
-
https://
|
|
275
|
+
Access backward incompatible API changes by a release at:
|
|
276
|
+
https://developer.aerospike.com/client/nodejs/usage/incompatible.
|
|
302
277
|
|
|
303
278
|
### API Versioning
|
|
304
279
|
|
|
305
280
|
The Aerospike Node.js client library follows [semantic versioning](http://semver.org/).
|
|
306
|
-
|
|
307
|
-
the major version number.
|
|
308
|
-
|
|
281
|
+
By Aerospike versioning guidelines, changes which may break backwards compatibility are
|
|
282
|
+
indicated by an increase in the major version number.
|
|
283
|
+
Minor, or patch releases, which are incremented only the
|
|
284
|
+
second and third version number, are always backwards compatible.
|
|
309
285
|
|
|
310
286
|
|
|
311
|
-
<a name="Tests"></a>
|
|
312
287
|
## Tests
|
|
313
288
|
|
|
314
289
|
The client includes a comprehensive test suite using
|
|
315
|
-
[Mocha](http://mochajs.org). The tests can be found in the
|
|
316
|
-
directory.
|
|
290
|
+
[Mocha](http://mochajs.org). The tests can be found in the repository under test directory.
|
|
317
291
|
|
|
318
292
|
Before running the tests, you need to update the dependencies:
|
|
319
293
|
|
|
@@ -323,22 +297,21 @@ To run all the test cases:
|
|
|
323
297
|
|
|
324
298
|
$ npm test
|
|
325
299
|
|
|
300
|
+
Note: make sure your server has TTL enabled for the `test` namespace ([Namespace Retention Configuration](https://docs.aerospike.com/server/operations/configure/namespace/retention)) to allow all tests to run correctly.
|
|
301
|
+
|
|
326
302
|
To run the tests and also report on test coverage:
|
|
327
303
|
|
|
328
304
|
$ npm run coverage
|
|
329
305
|
|
|
330
|
-
<a name="Benchmarks"></a>
|
|
331
306
|
## Benchmarks
|
|
332
307
|
|
|
333
|
-
Benchmark
|
|
334
|
-
See the [`benchmarks/README.md`](benchmarks/README.md) for details.
|
|
335
|
-
|
|
308
|
+
Benchmark utilities are provided in the repository under benchmarks directory. See the benchmarks/README.md for details.
|
|
336
309
|
|
|
337
310
|
## License
|
|
338
311
|
|
|
339
312
|
The Aerospike Node.js Client is made available under the terms of the Apache
|
|
340
|
-
License, Version 2, as stated in the file
|
|
313
|
+
License, Version 2, as stated in the LICENSE file.
|
|
341
314
|
|
|
342
315
|
Individual files may be made available under their own specific license, all
|
|
343
|
-
compatible with Apache License, Version 2.
|
|
316
|
+
compatible with Apache License, Version 2. Refer to individual files for
|
|
344
317
|
details.
|
package/binding.gyp
CHANGED
|
@@ -71,7 +71,6 @@
|
|
|
71
71
|
'src/main/query.cc',
|
|
72
72
|
'src/main/scan.cc',
|
|
73
73
|
'src/main/expressions.cc',
|
|
74
|
-
'src/main/predexp.cc',
|
|
75
74
|
'src/main/async.cc',
|
|
76
75
|
'src/main/command.cc',
|
|
77
76
|
'src/main/commands/apply_async.cc',
|
|
@@ -79,6 +78,9 @@
|
|
|
79
78
|
'src/main/commands/batch_get.cc',
|
|
80
79
|
'src/main/commands/batch_select.cc',
|
|
81
80
|
'src/main/commands/batch_read_async.cc',
|
|
81
|
+
'src/main/commands/batch_remove.cc',
|
|
82
|
+
'src/main/commands/batch_apply.cc',
|
|
83
|
+
'src/main/commands/batch_write_async.cc',
|
|
82
84
|
'src/main/commands/exists_async.cc',
|
|
83
85
|
'src/main/commands/get_async.cc',
|
|
84
86
|
'src/main/commands/info_any.cc',
|
|
@@ -114,8 +116,10 @@
|
|
|
114
116
|
'src/main/enums/ttl.cc',
|
|
115
117
|
'src/main/enums/config_enum.cc',
|
|
116
118
|
'src/main/enums/exp_enum.cc',
|
|
119
|
+
'src/main/enums/batch_type.cc',
|
|
117
120
|
'src/main/stats.cc',
|
|
118
121
|
'src/main/util/conversions.cc',
|
|
122
|
+
'src/main/util/conversions_batch.cc',
|
|
119
123
|
'src/main/util/log.cc'
|
|
120
124
|
],
|
|
121
125
|
'configurations': {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# This Dockerfile demonstrates how to build the Aerospike Node.js client on
|
|
2
|
+
# Alpine Linux. Since there is no pre-build package for the Aerospike C Client
|
|
3
|
+
# SDK for Alpine Linux, this Dockerfile first builds the C Client SDK from source
|
|
4
|
+
# (a submodule for the Node.js client), then builds the Node.js client using it.
|
|
5
|
+
# Stage 2 install the Node.js client into the final Docker image, to keep the size of
|
|
6
|
+
# that image minimal (i.e. no build dependencies).
|
|
7
|
+
#
|
|
8
|
+
# Note: The AS_NODEJS_VERSION must use version 4.0.3 and up since this is where the
|
|
9
|
+
# C client submodule was introduced.
|
|
10
|
+
|
|
11
|
+
# Stage 1: Build Aerospike C client and Node.js client
|
|
12
|
+
FROM node:lts-alpine as as-node-builder
|
|
13
|
+
WORKDIR /src
|
|
14
|
+
|
|
15
|
+
ENV AS_NODEJS_VERSION v5.0.1
|
|
16
|
+
|
|
17
|
+
RUN apk update
|
|
18
|
+
RUN apk add --no-cache \
|
|
19
|
+
build-base \
|
|
20
|
+
linux-headers \
|
|
21
|
+
bash \
|
|
22
|
+
libuv-dev \
|
|
23
|
+
openssl-dev \
|
|
24
|
+
lua5.1-dev \
|
|
25
|
+
zlib-dev \
|
|
26
|
+
git \
|
|
27
|
+
python3
|
|
28
|
+
|
|
29
|
+
RUN git clone --branch ${AS_NODEJS_VERSION} --recursive https://github.com/aerospike/aerospike-client-nodejs
|
|
30
|
+
# TODO: build-command.sh might be broken for alpine in some versions, use latest version when it's in git
|
|
31
|
+
COPY build-commands.sh /src/aerospike-client-nodejs/scripts/build-commands.sh
|
|
32
|
+
|
|
33
|
+
RUN cd /src/aerospike-client-nodejs \
|
|
34
|
+
&& /src/aerospike-client-nodejs/scripts/build-c-client.sh \
|
|
35
|
+
&& npm install /src/aerospike-client-nodejs --unsafe-perm --build-from-source
|
|
36
|
+
|
|
37
|
+
# Stage 2: Deploy Aerospike Node.js Runtime only
|
|
38
|
+
FROM node:lts-alpine
|
|
39
|
+
WORKDIR /src
|
|
40
|
+
|
|
41
|
+
RUN apk add --no-cache \
|
|
42
|
+
zlib \
|
|
43
|
+
openssl
|
|
44
|
+
|
|
45
|
+
COPY --from=as-node-builder /src/aerospike-client-nodejs/ aerospike-client-nodejs/
|
|
46
|
+
|
|
47
|
+
RUN npm install /src/aerospike-client-nodejs
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# This Dockerfile demonstrates how to use the Aerospike Node.js client on
|
|
2
|
+
# bullseye-slim (Debian 11) using the pre-built package and minimal prerequirements.
|
|
3
|
+
#
|
|
4
|
+
# Note: The AS_NODEJS_VERSION must use version 4.0.3 and up since this is where
|
|
5
|
+
# the C client submodule was introduced.
|
|
6
|
+
|
|
7
|
+
# Stage 1: Install Node.js Client Dependencies
|
|
8
|
+
FROM node:lts-bullseye-slim as installer
|
|
9
|
+
WORKDIR /src
|
|
10
|
+
|
|
11
|
+
ENV AS_NODEJS_VERSION v5.0.1
|
|
12
|
+
|
|
13
|
+
RUN apt update -y
|
|
14
|
+
RUN apt install -y \
|
|
15
|
+
openssl \
|
|
16
|
+
zlib1g
|
|
17
|
+
|
|
18
|
+
RUN npm install aerospike@${AS_NODEJS_VERSION}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# This Dockerfile demonstrates how to build the Aerospike Node.js client on
|
|
2
|
+
# Amazon Linux 2 for AWS Lambda. Since there is no pre-built package for the
|
|
3
|
+
# Aerospike C Client SDK for Amazon Linux 2, this Dockerfile uses a multi-stage
|
|
4
|
+
# approach to building the client to minimize the final image size.
|
|
5
|
+
#
|
|
6
|
+
# Note: The AS_NODEJS_VERSION must use version 4.0.3 and up since this is where
|
|
7
|
+
# the C client submodule was introduced.
|
|
8
|
+
|
|
9
|
+
# Stage 1: Build Aerospike C Client & Node.js Client
|
|
10
|
+
FROM public.ecr.aws/lambda/nodejs:16 as builder
|
|
11
|
+
WORKDIR /src
|
|
12
|
+
|
|
13
|
+
ENV AS_NODEJS_VERSION v5.0.1
|
|
14
|
+
|
|
15
|
+
RUN yum update -y
|
|
16
|
+
RUN yum install -y \
|
|
17
|
+
gcc-c++ \
|
|
18
|
+
linux-headers \
|
|
19
|
+
libuv-devel \
|
|
20
|
+
lua5.1-devel \
|
|
21
|
+
openssl11-devel \
|
|
22
|
+
zlib-devel \
|
|
23
|
+
python3 \
|
|
24
|
+
make \
|
|
25
|
+
wget \
|
|
26
|
+
tar \
|
|
27
|
+
git
|
|
28
|
+
|
|
29
|
+
RUN git clone --branch ${AS_NODEJS_VERSION} --recursive https://github.com/aerospike/aerospike-client-nodejs aerospike
|
|
30
|
+
RUN cd /src/aerospike \
|
|
31
|
+
&& /src/aerospike/scripts/build-c-client.sh \
|
|
32
|
+
&& npm install /src/aerospike --unsafe-perm --build-from-source
|
|
33
|
+
|
|
34
|
+
# Stage 2: Install Node.js Client Dependencies
|
|
35
|
+
FROM public.ecr.aws/lambda/nodejs:16 as installer
|
|
36
|
+
WORKDIR /src
|
|
37
|
+
|
|
38
|
+
COPY --from=builder /src/aerospike ./aerospike
|
|
39
|
+
|
|
40
|
+
RUN yum update -y
|
|
41
|
+
RUN yum install -y \
|
|
42
|
+
openssl11 \
|
|
43
|
+
zlib
|
|
44
|
+
RUN npm install /src/aerospike
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# This Dockerfile demonstrates how to build the Aerospike Node.js client on
|
|
2
|
+
# Ubuntu 22.04. Since there is no pre-built package for the Aerospike C Client SDK
|
|
3
|
+
# for Ubuntu 22.04 yet, this Dockerfile uses a multi-stage approach to building the
|
|
4
|
+
# client to minimize the final image size.
|
|
5
|
+
#
|
|
6
|
+
# Note: The AS_NODEJS_VERSION must use version 4.0.3 and up since this is where
|
|
7
|
+
# the C client submodule was introduced.
|
|
8
|
+
|
|
9
|
+
# Stage 1: Build Aerospike C Client & Node.js Client
|
|
10
|
+
FROM sitespeedio/node:ubuntu-22.04-nodejs-16.15.0 as builder
|
|
11
|
+
WORKDIR /src
|
|
12
|
+
|
|
13
|
+
ENV AS_NODEJS_VERSION v5.0.1
|
|
14
|
+
|
|
15
|
+
RUN apt update -y
|
|
16
|
+
RUN apt install -y \
|
|
17
|
+
libc6-dev \
|
|
18
|
+
libssl-dev \
|
|
19
|
+
autoconf \
|
|
20
|
+
automake \
|
|
21
|
+
libtool \
|
|
22
|
+
g++ \
|
|
23
|
+
zlib1g-dev \
|
|
24
|
+
liblua5.1-0-dev \
|
|
25
|
+
ncurses-dev \
|
|
26
|
+
python3 \
|
|
27
|
+
wget \
|
|
28
|
+
git \
|
|
29
|
+
make
|
|
30
|
+
|
|
31
|
+
RUN git clone --branch ${AS_NODEJS_VERSION} --recursive https://github.com/aerospike/aerospike-client-nodejs aerospike
|
|
32
|
+
RUN cd /src/aerospike \
|
|
33
|
+
&& /src/aerospike/scripts/build-c-client.sh \
|
|
34
|
+
&& npm install /src/aerospike --unsafe-perm --build-from-source
|
|
35
|
+
|
|
36
|
+
# Stage 2: Install Node.js Client Dependencies
|
|
37
|
+
FROM sitespeedio/node:ubuntu-22.04-nodejs-16.15.0 as installer
|
|
38
|
+
WORKDIR /src
|
|
39
|
+
|
|
40
|
+
COPY --from=builder /src/aerospike ./aerospike
|
|
41
|
+
|
|
42
|
+
RUN apt update -y
|
|
43
|
+
RUN apt install -y \
|
|
44
|
+
zlib1g
|
|
45
|
+
RUN npm install /src/aerospike
|
package/examples/batch.js
CHANGED
package/examples/put.js
CHANGED
|
@@ -52,7 +52,7 @@ function buildPolicy (argv) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
exports.command = 'put <key> <bins...>'
|
|
55
|
-
exports.describe = 'Write a record to the database
|
|
55
|
+
exports.describe = 'Write a record to the database.\n bins format is a key value pair as "<bin_name>=<bin_value>"'
|
|
56
56
|
exports.handler = shared.run(put)
|
|
57
57
|
exports.builder = {
|
|
58
58
|
'time-to-live': {
|
package/examples/shared/cli.js
CHANGED
|
@@ -23,7 +23,7 @@ function str2num (value) {
|
|
|
23
23
|
// @param { String[] } binStrs - list of "<name>=<value>" pairs
|
|
24
24
|
exports.parseBins = function (binStrs) {
|
|
25
25
|
return binStrs.reduce((bins, current) => {
|
|
26
|
-
const [name, value] = current.split('=')
|
|
26
|
+
const [name, value] = current.toString().split('=')
|
|
27
27
|
bins[name] = str2num(value)
|
|
28
28
|
return bins
|
|
29
29
|
}, {})
|