infinispan 0.10.0 → 0.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/.eslintrc +25 -0
- package/Jenkinsfile-release +5 -3
- package/documentation/asciidoc/topics/attributes/community-attributes.adoc +1 -0
- package/documentation/asciidoc/topics/code_examples/queries.js +92 -0
- package/documentation/asciidoc/topics/proc_configuring_connections.adoc +1 -1
- package/documentation/asciidoc/topics/ref_client_usage.adoc +12 -0
- package/lib/infinispan.js +61 -57
- package/lib/protostream/query.proto +1 -1
- package/package.json +8 -6
- package/run-servers.sh +16 -1
- package/smoke-tests.sh +1 -0
- package/spec/configs/clean/infinispan.xml +3 -3
- package/spec/configs/infinispan-clustered.xml +2 -2
- package/spec/configs/infinispan-ssl.xml +6 -6
- package/spec/configs/infinispan-xsite-EARTH.xml +3 -7
- package/spec/configs/infinispan-xsite-MOON.xml +3 -7
- package/spec/configs/infinispan.xml +1 -1
- package/spec/infinispan_ssl_spec.js +6 -5
- package/spec/utils/testing.js +23 -51
- package/types/README.md +91 -0
- package/types/index.d.ts +868 -0
- package/.jshintrc +0 -14
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,868 @@
|
|
|
1
|
+
export function client(args: {
|
|
2
|
+
/**
|
|
3
|
+
* - Server host name.
|
|
4
|
+
*/
|
|
5
|
+
host: string;
|
|
6
|
+
/**
|
|
7
|
+
* - Server port.
|
|
8
|
+
*/
|
|
9
|
+
port: number;
|
|
10
|
+
} | {
|
|
11
|
+
/**
|
|
12
|
+
* - Server host name.
|
|
13
|
+
*/
|
|
14
|
+
host: string;
|
|
15
|
+
/**
|
|
16
|
+
* - Server port.
|
|
17
|
+
*/
|
|
18
|
+
port: number;
|
|
19
|
+
}[], options?: {
|
|
20
|
+
/**
|
|
21
|
+
* - Version of client/server protocol.
|
|
22
|
+
*/
|
|
23
|
+
version?: (2.9 | 2.5 | 2.2) | null;
|
|
24
|
+
/**
|
|
25
|
+
* - Optional cache name.
|
|
26
|
+
*/
|
|
27
|
+
cacheName?: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* - Optional number of retries for operation.
|
|
30
|
+
*/
|
|
31
|
+
maxRetries?: number | null;
|
|
32
|
+
/**
|
|
33
|
+
* - TLS/SSL properties.
|
|
34
|
+
*/
|
|
35
|
+
ssl?: any | null;
|
|
36
|
+
/**
|
|
37
|
+
* - Optional flag to enable SSL support.
|
|
38
|
+
*/
|
|
39
|
+
enabled?: boolean | null;
|
|
40
|
+
/**
|
|
41
|
+
* - Optional field with secure protocol in use.
|
|
42
|
+
*/
|
|
43
|
+
secureProtocol?: string | null;
|
|
44
|
+
/**
|
|
45
|
+
* - Optional paths of trusted SSL certificates.
|
|
46
|
+
*/
|
|
47
|
+
trustCerts?: string[] | null;
|
|
48
|
+
/**
|
|
49
|
+
* - Optional path to client authentication key.
|
|
50
|
+
*/
|
|
51
|
+
key?: string | null;
|
|
52
|
+
/**
|
|
53
|
+
* - Optional password for client key.
|
|
54
|
+
*/
|
|
55
|
+
passphrase?: string | null;
|
|
56
|
+
/**
|
|
57
|
+
* - Optional client certificate.
|
|
58
|
+
*/
|
|
59
|
+
cert?: string | null;
|
|
60
|
+
/**
|
|
61
|
+
* - Optional SNI host name.
|
|
62
|
+
*/
|
|
63
|
+
sniHostName?: string | null;
|
|
64
|
+
/**
|
|
65
|
+
* - Optional crypto store path.
|
|
66
|
+
*/
|
|
67
|
+
path?: string | null;
|
|
68
|
+
/**
|
|
69
|
+
* - Authentication properties.
|
|
70
|
+
*/
|
|
71
|
+
authentication?: any | null;
|
|
72
|
+
/**
|
|
73
|
+
* - Select the SASL mechanism to use. Can be one of PLAIN, DIGEST-MD5, SCRAM-SHA-1, SCRAM-SHA-256, SCRAM-SHA-384, SCRAM-SHA-512, EXTERNAL, OAUTHBEARER
|
|
74
|
+
*/
|
|
75
|
+
saslMechanism?: string | null;
|
|
76
|
+
/**
|
|
77
|
+
* - The authentication username. Required by the PLAIN, DIGEST and SCRAM mechanisms.
|
|
78
|
+
*/
|
|
79
|
+
userName?: string | null;
|
|
80
|
+
/**
|
|
81
|
+
* - The authentication password. Required by the PLAIN, DIGEST and SCRAM mechanisms.
|
|
82
|
+
*/
|
|
83
|
+
password?: string | null;
|
|
84
|
+
/**
|
|
85
|
+
* - The OAuth token. Required by the OAUTHBEARER mechanism.
|
|
86
|
+
*/
|
|
87
|
+
token?: string | null;
|
|
88
|
+
/**
|
|
89
|
+
* - The SASL authorization ID.
|
|
90
|
+
*/
|
|
91
|
+
authzid?: string | null;
|
|
92
|
+
/**
|
|
93
|
+
* - Content-type for entry
|
|
94
|
+
*/
|
|
95
|
+
dataFormat?: any | null;
|
|
96
|
+
/**
|
|
97
|
+
* - Content-type for key
|
|
98
|
+
*/
|
|
99
|
+
keyType?: string | null;
|
|
100
|
+
/**
|
|
101
|
+
* - Content-type for value
|
|
102
|
+
*/
|
|
103
|
+
valueType?: string | null;
|
|
104
|
+
/**
|
|
105
|
+
* - Optional flag to controls whether the client deals with topology updates or not.
|
|
106
|
+
*/
|
|
107
|
+
topologyUpdates?: boolean | null;
|
|
108
|
+
/**
|
|
109
|
+
* - Media type of the cache contents.
|
|
110
|
+
*/
|
|
111
|
+
mediaType?: ("text/plain" | "application/json") | null;
|
|
112
|
+
/**
|
|
113
|
+
* - Optional additional clusters for cross-site failovers.
|
|
114
|
+
*/
|
|
115
|
+
clusters?: {
|
|
116
|
+
/**
|
|
117
|
+
* - Cluster name.
|
|
118
|
+
*/
|
|
119
|
+
name: string;
|
|
120
|
+
/**
|
|
121
|
+
* - Cluster servers details.
|
|
122
|
+
*/
|
|
123
|
+
servers: {
|
|
124
|
+
/**
|
|
125
|
+
* - Server host name.
|
|
126
|
+
*/
|
|
127
|
+
host: string;
|
|
128
|
+
/**
|
|
129
|
+
* - Server port.
|
|
130
|
+
*/
|
|
131
|
+
port: number;
|
|
132
|
+
}[];
|
|
133
|
+
}[];
|
|
134
|
+
}): Promise<ReturnType<{
|
|
135
|
+
(addrs: any, clientOpts: any): {
|
|
136
|
+
connect: () => any;
|
|
137
|
+
/**
|
|
138
|
+
* Disconnect client from backend server(s).
|
|
139
|
+
*
|
|
140
|
+
* @returns {Promise<void>}
|
|
141
|
+
* A promise that will be completed once client has
|
|
142
|
+
* completed disconnection from server(s).
|
|
143
|
+
* @memberof Client#
|
|
144
|
+
* @since 0.3
|
|
145
|
+
*/
|
|
146
|
+
disconnect: () => Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Get the value associated with the given key parameter.
|
|
149
|
+
*
|
|
150
|
+
* @param k {(String|Object)} Key to retrieve.
|
|
151
|
+
* @returns {Promise.<?String>}
|
|
152
|
+
* A promise that will be completed with the value associated with
|
|
153
|
+
* the key, or undefined if the value is not present.
|
|
154
|
+
* @memberof Client#
|
|
155
|
+
* @since 0.3
|
|
156
|
+
*/
|
|
157
|
+
get: (k: (string | any)) => Promise<string | null>;
|
|
158
|
+
/**
|
|
159
|
+
* Query the server with the given queryString.
|
|
160
|
+
*
|
|
161
|
+
* @param q {(Object)} query to retrieve.
|
|
162
|
+
* @returns {Promise.<?Object[]>}
|
|
163
|
+
* A promise that will be completed with the array of values associated with
|
|
164
|
+
* the query, or empty array if the no values matches the query.
|
|
165
|
+
* @memberof Client#
|
|
166
|
+
* @since 1.3
|
|
167
|
+
*/
|
|
168
|
+
query: (q: (any)) => Promise<any[] | null>;
|
|
169
|
+
/**
|
|
170
|
+
* Check whether the given key is present.
|
|
171
|
+
*
|
|
172
|
+
* @param k {(String|Object)} Key to check for presence.
|
|
173
|
+
* @returns {Promise.<boolean>}
|
|
174
|
+
* A promise that will be completed with true if there is a value
|
|
175
|
+
* associated with the key, or false otherwise.
|
|
176
|
+
* @memberof Client#
|
|
177
|
+
* @since 0.3
|
|
178
|
+
*/
|
|
179
|
+
containsKey: (k: (string | any)) => Promise<boolean>;
|
|
180
|
+
/**
|
|
181
|
+
* Metadata value.
|
|
182
|
+
*
|
|
183
|
+
* @typedef {Object} MetadataValue
|
|
184
|
+
* @property {(String|Object)} value - Value associated with the key
|
|
185
|
+
* @property {Buffer} version - Version of the value as a byte buffer.
|
|
186
|
+
* @property {Number} lifespan - Lifespan of entry, defined in seconds.
|
|
187
|
+
* If the entry is immortal, it would be -1.
|
|
188
|
+
* @property {Number} maxIdle - Max idle time of entry, defined in seconds.
|
|
189
|
+
* If the entry is no transient, it would be -1.
|
|
190
|
+
* @since 0.3
|
|
191
|
+
*/
|
|
192
|
+
/**
|
|
193
|
+
* Get the value and metadata associated with the given key parameter.
|
|
194
|
+
*
|
|
195
|
+
* @param k {(String|Object)} Key to retrieve.
|
|
196
|
+
* @returns {Promise.<?MetadataValue>}
|
|
197
|
+
* A promise that will be completed with the value and metadata
|
|
198
|
+
* associated with the key, or undefined if the value is not present.
|
|
199
|
+
* @memberof Client#
|
|
200
|
+
* @since 0.3
|
|
201
|
+
*/
|
|
202
|
+
getWithMetadata: (k: (string | any)) => Promise<{
|
|
203
|
+
/**
|
|
204
|
+
* - Value associated with the key
|
|
205
|
+
*/
|
|
206
|
+
value: (string | any);
|
|
207
|
+
/**
|
|
208
|
+
* - Version of the value as a byte buffer.
|
|
209
|
+
*/
|
|
210
|
+
version: Buffer;
|
|
211
|
+
/**
|
|
212
|
+
* - Lifespan of entry, defined in seconds.
|
|
213
|
+
* If the entry is immortal, it would be -1.
|
|
214
|
+
*/
|
|
215
|
+
lifespan: number;
|
|
216
|
+
/**
|
|
217
|
+
* - Max idle time of entry, defined in seconds.
|
|
218
|
+
* If the entry is no transient, it would be -1.
|
|
219
|
+
*/
|
|
220
|
+
maxIdle: number;
|
|
221
|
+
}>;
|
|
222
|
+
/**
|
|
223
|
+
* A String formatted to specify duration unit information.
|
|
224
|
+
* Duration unit is formed of two elements, the first is the number of
|
|
225
|
+
* units, and the second is the unit itself: 's' for seconds, 'ms' for
|
|
226
|
+
* milliseconds, 'ns' for nanoseconds, 'μs' for microseconds, 'm' for
|
|
227
|
+
* minutes, 'h' for hours and 'd' for days.
|
|
228
|
+
* So, for example: '1s' would be one second, '5h' five hours...etc.
|
|
229
|
+
*
|
|
230
|
+
* @typedef {String} DurationUnit
|
|
231
|
+
* @since 0.3
|
|
232
|
+
*/
|
|
233
|
+
/**
|
|
234
|
+
* Store options defines a set of optional parameters that can be
|
|
235
|
+
* passed when storing data.
|
|
236
|
+
*
|
|
237
|
+
* @typedef {Object} StoreOptions
|
|
238
|
+
* @property {Boolean} previous - Indicates whether previous value
|
|
239
|
+
* should be returned. If no previous value exists, it would return
|
|
240
|
+
* undefined.
|
|
241
|
+
* @property {DurationUnit} lifespan -
|
|
242
|
+
* Lifespan for the stored entry.
|
|
243
|
+
* @property {DurationUnit} maxIdle -
|
|
244
|
+
* Max idle time for the stored entry.
|
|
245
|
+
* @since 0.3
|
|
246
|
+
*/
|
|
247
|
+
/**
|
|
248
|
+
* Associates the specified value with the given key.
|
|
249
|
+
*
|
|
250
|
+
* @param k {(String|Object)} Key with which the specified value is to be associated.
|
|
251
|
+
* @param v {(String|Object)} Value to be associated with the specified key.
|
|
252
|
+
* @param opts {StoreOptions=} Optional store options.
|
|
253
|
+
* @returns {Promise.<?(String|Object)>}
|
|
254
|
+
* A promise that will be completed with undefined unless 'previous'
|
|
255
|
+
* option has been enabled and a previous value exists, in which case it
|
|
256
|
+
* would return the previous value.
|
|
257
|
+
* @memberof Client#
|
|
258
|
+
* @since 0.3
|
|
259
|
+
*/
|
|
260
|
+
put: (k: (string | any), v: (string | any), opts?: {
|
|
261
|
+
/**
|
|
262
|
+
* - Indicates whether previous value
|
|
263
|
+
* should be returned. If no previous value exists, it would return
|
|
264
|
+
* undefined.
|
|
265
|
+
*/
|
|
266
|
+
previous: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* -
|
|
269
|
+
* Lifespan for the stored entry.
|
|
270
|
+
*/
|
|
271
|
+
lifespan: string;
|
|
272
|
+
/**
|
|
273
|
+
* -
|
|
274
|
+
* Max idle time for the stored entry.
|
|
275
|
+
*/
|
|
276
|
+
maxIdle: string;
|
|
277
|
+
}) => Promise<(string | any) | null>;
|
|
278
|
+
/**
|
|
279
|
+
* Remove options defines a set of optional parameters that can be
|
|
280
|
+
* passed when removing data.
|
|
281
|
+
*
|
|
282
|
+
* @typedef {Object} RemoveOptions
|
|
283
|
+
* @property {Boolean} previous - Indicates whether previous value
|
|
284
|
+
* should be returned. If no previous value exists, it would return
|
|
285
|
+
* undefined.
|
|
286
|
+
* @since 0.3
|
|
287
|
+
*/
|
|
288
|
+
/**
|
|
289
|
+
* Removes the mapping for a key if it is present.
|
|
290
|
+
*
|
|
291
|
+
* @param k {(String|Object)} Key whose mapping is to be removed.
|
|
292
|
+
* @param opts {RemoveOptions=} Optional remove options.
|
|
293
|
+
* @returns {Promise.<(Boolean|String|Object)>}
|
|
294
|
+
* A promise that will be completed with true if the mapping was removed,
|
|
295
|
+
* or false if the key did not exist.
|
|
296
|
+
* If the 'previous' option is enabled, it returns the value
|
|
297
|
+
* before removal or undefined if the key did not exist.
|
|
298
|
+
* @memberof Client#
|
|
299
|
+
* @since 0.3
|
|
300
|
+
*/
|
|
301
|
+
remove: (k: (string | any), opts?: {
|
|
302
|
+
/**
|
|
303
|
+
* - Indicates whether previous value
|
|
304
|
+
* should be returned. If no previous value exists, it would return
|
|
305
|
+
* undefined.
|
|
306
|
+
*/
|
|
307
|
+
previous: boolean;
|
|
308
|
+
}) => Promise<(boolean | string | any)>;
|
|
309
|
+
/**
|
|
310
|
+
* Conditional store operation that associates the key with the given
|
|
311
|
+
* value if the specified key is not already associated with a value.
|
|
312
|
+
*
|
|
313
|
+
* @param k {(String|Object)} Key with which the specified value is to be associated.
|
|
314
|
+
* @param v {(String|Object)} Value to be associated with the specified key.
|
|
315
|
+
* @param opts {StoreOptions=} Optional store options.
|
|
316
|
+
* @returns {Promise.<(Boolean|String|Object)>}
|
|
317
|
+
* A promise that will be completed with true if the mapping was stored,
|
|
318
|
+
* or false if the key is already present.
|
|
319
|
+
* If the 'previous' option is enabled, it returns the existing value
|
|
320
|
+
* or undefined if the key does not exist.
|
|
321
|
+
* @memberof Client#
|
|
322
|
+
* @since 0.3
|
|
323
|
+
*/
|
|
324
|
+
putIfAbsent: (k: (string | any), v: (string | any), opts?: {
|
|
325
|
+
/**
|
|
326
|
+
* - Indicates whether previous value
|
|
327
|
+
* should be returned. If no previous value exists, it would return
|
|
328
|
+
* undefined.
|
|
329
|
+
*/
|
|
330
|
+
previous: boolean;
|
|
331
|
+
/**
|
|
332
|
+
* -
|
|
333
|
+
* Lifespan for the stored entry.
|
|
334
|
+
*/
|
|
335
|
+
lifespan: string;
|
|
336
|
+
/**
|
|
337
|
+
* -
|
|
338
|
+
* Max idle time for the stored entry.
|
|
339
|
+
*/
|
|
340
|
+
maxIdle: string;
|
|
341
|
+
}) => Promise<(boolean | string | any)>;
|
|
342
|
+
/**
|
|
343
|
+
* Conditional store operation that replaces the entry for a key only
|
|
344
|
+
* if currently mapped to a given value.
|
|
345
|
+
*
|
|
346
|
+
* @param k {(String|Object)} Key with which the specified value is associated.
|
|
347
|
+
* @param v {(String|Object)} Value expected to be associated with the specified key.
|
|
348
|
+
* @param opts {StoreOptions=} Optional store options.
|
|
349
|
+
* @returns {Promise.<(Boolean|String|Object)>}
|
|
350
|
+
* A promise that will be completed with true if the mapping was replaced,
|
|
351
|
+
* or false if the key does not exist.
|
|
352
|
+
* If the 'previous' option is enabled, it returns the value that was
|
|
353
|
+
* replaced or undefined if the key did not exist.
|
|
354
|
+
* @memberof Client#
|
|
355
|
+
* @since 0.3
|
|
356
|
+
*/
|
|
357
|
+
replace: (k: (string | any), v: (string | any), opts?: {
|
|
358
|
+
/**
|
|
359
|
+
* - Indicates whether previous value
|
|
360
|
+
* should be returned. If no previous value exists, it would return
|
|
361
|
+
* undefined.
|
|
362
|
+
*/
|
|
363
|
+
previous: boolean;
|
|
364
|
+
/**
|
|
365
|
+
* -
|
|
366
|
+
* Lifespan for the stored entry.
|
|
367
|
+
*/
|
|
368
|
+
lifespan: string;
|
|
369
|
+
/**
|
|
370
|
+
* -
|
|
371
|
+
* Max idle time for the stored entry.
|
|
372
|
+
*/
|
|
373
|
+
maxIdle: string;
|
|
374
|
+
}) => Promise<(boolean | string | any)>;
|
|
375
|
+
/**
|
|
376
|
+
* Replaces the given value only if its version matches the supplied
|
|
377
|
+
* version.
|
|
378
|
+
*
|
|
379
|
+
* @param k {(String|Object)} Key with which the specified value is associated.
|
|
380
|
+
* @param v {(String|Object)} Value expected to be associated with the specified key.
|
|
381
|
+
* @param version {Buffer} binary buffer version that should match the
|
|
382
|
+
* one in the server for the operation to succeed. Version information
|
|
383
|
+
* can be retrieved with getWithMetadata method.
|
|
384
|
+
* @param opts {StoreOptions=} Optional store options.
|
|
385
|
+
* @returns {Promise.<(Boolean|String|Object)>}
|
|
386
|
+
* A promise that will be completed with true if the version matches
|
|
387
|
+
* and the mapping was replaced, otherwise it returns false if not
|
|
388
|
+
* replaced because key does not exist or version sent does not match
|
|
389
|
+
* server-side version.
|
|
390
|
+
* If the 'previous' option is enabled, it returns the value that was
|
|
391
|
+
* replaced if the version matches. If the version does not match, the
|
|
392
|
+
* current value is returned. Fianlly if the key did not exist it
|
|
393
|
+
* returns undefined.
|
|
394
|
+
* @memberof Client#
|
|
395
|
+
* @since 0.3
|
|
396
|
+
*/
|
|
397
|
+
replaceWithVersion: (k: (string | any), v: (string | any), version: Buffer, opts?: {
|
|
398
|
+
/**
|
|
399
|
+
* - Indicates whether previous value
|
|
400
|
+
* should be returned. If no previous value exists, it would return
|
|
401
|
+
* undefined.
|
|
402
|
+
*/
|
|
403
|
+
previous: boolean;
|
|
404
|
+
/**
|
|
405
|
+
* -
|
|
406
|
+
* Lifespan for the stored entry.
|
|
407
|
+
*/
|
|
408
|
+
lifespan: string;
|
|
409
|
+
/**
|
|
410
|
+
* -
|
|
411
|
+
* Max idle time for the stored entry.
|
|
412
|
+
*/
|
|
413
|
+
maxIdle: string;
|
|
414
|
+
}) => Promise<(boolean | string | any)>;
|
|
415
|
+
/**
|
|
416
|
+
* Removes the given entry only if its version matches the
|
|
417
|
+
* supplied version.
|
|
418
|
+
*
|
|
419
|
+
* @param k {(String|Object)} Key whose mapping is to be removed.
|
|
420
|
+
* @param version {Buffer} binary buffer version that should match the
|
|
421
|
+
* one in the server for the operation to succeed. Version information
|
|
422
|
+
* can be retrieved with getWithMetadata method.
|
|
423
|
+
* @param opts {RemoveOptions=} Optional remove options.
|
|
424
|
+
* @returns {Promise.<(Boolean|String|Object)>}
|
|
425
|
+
* A promise that will be completed with true if the version matches
|
|
426
|
+
* and the mapping was removed, otherwise it returns false if not
|
|
427
|
+
* removed because key does not exist or version sent does not match
|
|
428
|
+
* server-side version.
|
|
429
|
+
* If the 'previous' option is enabled, it returns the value that was
|
|
430
|
+
* removed if the version matches. If the version does not match, the
|
|
431
|
+
* current value is returned. Fianlly if the key did not exist it
|
|
432
|
+
* returns undefined.
|
|
433
|
+
* @memberof Client#
|
|
434
|
+
* @since 0.3
|
|
435
|
+
*/
|
|
436
|
+
removeWithVersion: (k: (string | any), version: Buffer, opts?: {
|
|
437
|
+
/**
|
|
438
|
+
* - Indicates whether previous value
|
|
439
|
+
* should be returned. If no previous value exists, it would return
|
|
440
|
+
* undefined.
|
|
441
|
+
*/
|
|
442
|
+
previous: boolean;
|
|
443
|
+
}) => Promise<(boolean | string | any)>;
|
|
444
|
+
/**
|
|
445
|
+
* Key/value entry.
|
|
446
|
+
*
|
|
447
|
+
* @typedef {Object} Entry
|
|
448
|
+
* @property {(String|Object)} key - Entry's key.
|
|
449
|
+
* @property {(String|Object)} value - Entry's value.
|
|
450
|
+
* @since 0.3
|
|
451
|
+
*/
|
|
452
|
+
/**
|
|
453
|
+
* Retrieves all of the entries for the provided keys.
|
|
454
|
+
*
|
|
455
|
+
* @param keys {(String[]|Object[])} Keys to find values for.
|
|
456
|
+
* @returns {Promise.<Entry[]>}
|
|
457
|
+
* A promise that will be completed with an array of entries for all
|
|
458
|
+
* keys found. If a key does not exist, there won't be an entry for that
|
|
459
|
+
* key in the returned array.
|
|
460
|
+
* @memberof Client#
|
|
461
|
+
* @since 0.3
|
|
462
|
+
*/
|
|
463
|
+
getAll: (keys: (string[] | any[])) => Promise<{
|
|
464
|
+
/**
|
|
465
|
+
* - Entry's key.
|
|
466
|
+
*/
|
|
467
|
+
key: (string | any);
|
|
468
|
+
/**
|
|
469
|
+
* - Entry's value.
|
|
470
|
+
*/
|
|
471
|
+
value: (string | any);
|
|
472
|
+
}[]>;
|
|
473
|
+
/**
|
|
474
|
+
* Multi store options defines a set of optional parameters that can be
|
|
475
|
+
* passed when storing multiple entries.
|
|
476
|
+
*
|
|
477
|
+
* @typedef {Object} MultiStoreOptions
|
|
478
|
+
* @property {DurationUnit} lifespan -
|
|
479
|
+
* Lifespan for the stored entry.
|
|
480
|
+
* @property {DurationUnit} maxIdle -
|
|
481
|
+
* Max idle time for the stored entry.
|
|
482
|
+
* @since 0.3
|
|
483
|
+
*/
|
|
484
|
+
/**
|
|
485
|
+
* Stores all of the mappings from the specified entry array.
|
|
486
|
+
*
|
|
487
|
+
* @param pairs {Entry[]} key/value pair mappings to be stored
|
|
488
|
+
* @param opts {MultiStoreOptions=}
|
|
489
|
+
* Optional storage options to apply to all entries.
|
|
490
|
+
* @returns {Promise}
|
|
491
|
+
* A promise that will be completed when all entries have been stored.
|
|
492
|
+
* @memberof Client#
|
|
493
|
+
* @since 0.3
|
|
494
|
+
*/
|
|
495
|
+
putAll: (pairs: {
|
|
496
|
+
/**
|
|
497
|
+
* - Entry's key.
|
|
498
|
+
*/
|
|
499
|
+
key: (string | any);
|
|
500
|
+
/**
|
|
501
|
+
* - Entry's value.
|
|
502
|
+
*/
|
|
503
|
+
value: (string | any);
|
|
504
|
+
}[], opts?: {
|
|
505
|
+
/**
|
|
506
|
+
* -
|
|
507
|
+
* Lifespan for the stored entry.
|
|
508
|
+
*/
|
|
509
|
+
lifespan: string;
|
|
510
|
+
/**
|
|
511
|
+
* -
|
|
512
|
+
* Max idle time for the stored entry.
|
|
513
|
+
*/
|
|
514
|
+
maxIdle: string;
|
|
515
|
+
}) => Promise<any>;
|
|
516
|
+
/**
|
|
517
|
+
* Iterator options defines a set of optional parameters that
|
|
518
|
+
* control how iteration occurs and the data that's iterated over.
|
|
519
|
+
*
|
|
520
|
+
* @typedef {Object} IteratorOptions
|
|
521
|
+
* @property {Boolean} metadata - Indicates whether entries iterated
|
|
522
|
+
* over also expose metadata information. This option is false by
|
|
523
|
+
* default which means no metadata information is exposed on iteration.
|
|
524
|
+
* @since 0.3
|
|
525
|
+
*/
|
|
526
|
+
/**
|
|
527
|
+
* Iterate over the entries stored in server(s).
|
|
528
|
+
*
|
|
529
|
+
* @param batchSize {Number}
|
|
530
|
+
* The number of entries transferred from the server at a time.
|
|
531
|
+
* @param opts {IteratorOptions=} Optional iteration settings.
|
|
532
|
+
* @return {Promise.<Iterator>}
|
|
533
|
+
* A promise that will be completed with an iterator that can be used
|
|
534
|
+
* to retrieve stored elements.
|
|
535
|
+
* @memberof Client#
|
|
536
|
+
* @since 0.3
|
|
537
|
+
*/
|
|
538
|
+
iterator: (batchSize: number, opts?: {
|
|
539
|
+
/**
|
|
540
|
+
* - Indicates whether entries iterated
|
|
541
|
+
* over also expose metadata information. This option is false by
|
|
542
|
+
* default which means no metadata information is exposed on iteration.
|
|
543
|
+
*/
|
|
544
|
+
metadata: boolean;
|
|
545
|
+
}) => Promise<Iterator<any, any, undefined>>;
|
|
546
|
+
/**
|
|
547
|
+
* Count of entries in the server(s).
|
|
548
|
+
*
|
|
549
|
+
* @returns {Promise.<Number>}
|
|
550
|
+
* A promise that will be completed with the number of entries stored.
|
|
551
|
+
* @memberof Client#
|
|
552
|
+
* @since 0.3
|
|
553
|
+
*/
|
|
554
|
+
size: () => Promise<number>;
|
|
555
|
+
/**
|
|
556
|
+
* Clear all entries stored in server(s).
|
|
557
|
+
*
|
|
558
|
+
* @returns {Promise}
|
|
559
|
+
* A promise that will be completed when the clear has been completed.
|
|
560
|
+
* @memberof Client#
|
|
561
|
+
* @since 0.3
|
|
562
|
+
*/
|
|
563
|
+
clear: () => Promise<any>;
|
|
564
|
+
/**
|
|
565
|
+
* Pings the server(s).
|
|
566
|
+
*
|
|
567
|
+
* @returns {Promise}
|
|
568
|
+
* A promise that will be completed when ping response was received.
|
|
569
|
+
* @memberof Client#
|
|
570
|
+
* @since 0.3
|
|
571
|
+
*/
|
|
572
|
+
ping: () => Promise<any>;
|
|
573
|
+
/**
|
|
574
|
+
* Statistic item.
|
|
575
|
+
*
|
|
576
|
+
* @typedef {Object} StatsItem
|
|
577
|
+
* @property {String} STAT_NAME -
|
|
578
|
+
* Name of the statistic.
|
|
579
|
+
* @property {String} STAT_VALUE -
|
|
580
|
+
* Value of the statistic.
|
|
581
|
+
* @since 0.3
|
|
582
|
+
*/
|
|
583
|
+
/**
|
|
584
|
+
* Retrieve various statistics from server(s).
|
|
585
|
+
*
|
|
586
|
+
* @returns {Promise<StatsItem[]>}
|
|
587
|
+
* A promise that will be completed with an array of statistics, where
|
|
588
|
+
* each element will have a single property. This single property will
|
|
589
|
+
* have the statistic name as property name and statistic value as
|
|
590
|
+
* property value.
|
|
591
|
+
* @memberof Client#
|
|
592
|
+
* @since 0.3
|
|
593
|
+
*/
|
|
594
|
+
stats: () => Promise<{
|
|
595
|
+
/**
|
|
596
|
+
* -
|
|
597
|
+
* Name of the statistic.
|
|
598
|
+
*/
|
|
599
|
+
STAT_NAME: string;
|
|
600
|
+
/**
|
|
601
|
+
* -
|
|
602
|
+
* Value of the statistic.
|
|
603
|
+
*/
|
|
604
|
+
STAT_VALUE: string;
|
|
605
|
+
}[]>;
|
|
606
|
+
/**
|
|
607
|
+
* Listener options.
|
|
608
|
+
*
|
|
609
|
+
* @typedef {Object} ListenOptions
|
|
610
|
+
* @property {String} listenerId - Listener identifier can be passed
|
|
611
|
+
* in as parameter to register multiple event callback functions for
|
|
612
|
+
* the same listener.
|
|
613
|
+
* @since 0.3
|
|
614
|
+
*/
|
|
615
|
+
/**
|
|
616
|
+
* Add an event listener.
|
|
617
|
+
*
|
|
618
|
+
* @param {String} event
|
|
619
|
+
* Event to add listener to. Possible values are:
|
|
620
|
+
* 'create', 'modify', 'remove' and 'expiry'.
|
|
621
|
+
* @param {Function} listener
|
|
622
|
+
* Function to invoke when the listener event is received.
|
|
623
|
+
* 'create' and 'modify' events callback the function with key,
|
|
624
|
+
* entry version and listener id.
|
|
625
|
+
* 'remove' and 'expiry' events callback the function with key
|
|
626
|
+
* and listener id.
|
|
627
|
+
* @param opts {ListenOptions=} Options for adding listener.
|
|
628
|
+
* @returns {Promise<String>}
|
|
629
|
+
* A promise that will be completed with the identifier of the listener.
|
|
630
|
+
* This identifier can be used to register multiple callbacks with the
|
|
631
|
+
* same listener, or to remove the listener.
|
|
632
|
+
* @memberof Client#
|
|
633
|
+
* @since 0.3
|
|
634
|
+
*/
|
|
635
|
+
addListener: (event: string, listener: Function, opts?: {
|
|
636
|
+
/**
|
|
637
|
+
* - Listener identifier can be passed
|
|
638
|
+
* in as parameter to register multiple event callback functions for
|
|
639
|
+
* the same listener.
|
|
640
|
+
*/
|
|
641
|
+
listenerId: string;
|
|
642
|
+
}) => Promise<string>;
|
|
643
|
+
/**
|
|
644
|
+
* Remove an event listener.
|
|
645
|
+
*
|
|
646
|
+
* @param {String} listenerId
|
|
647
|
+
* Listener identifier to identify listener to remove.
|
|
648
|
+
* @return {Promise}
|
|
649
|
+
* A promise that will be completed when the listener has been removed.
|
|
650
|
+
* @memberof Client#
|
|
651
|
+
* @since 0.3
|
|
652
|
+
*/
|
|
653
|
+
removeListener: (listenerId: string) => Promise<any>;
|
|
654
|
+
/**
|
|
655
|
+
* Add script to server(s).
|
|
656
|
+
*
|
|
657
|
+
* @param {String} scriptName Name of the script to store.
|
|
658
|
+
* @param {String} script Script to store in server.
|
|
659
|
+
* @return {Promise}
|
|
660
|
+
* A promise that will be completed when the script has been stored.
|
|
661
|
+
* @memberof Client#
|
|
662
|
+
* @since 0.3
|
|
663
|
+
*/
|
|
664
|
+
addScript: (scriptName: string, script: string) => Promise<any>;
|
|
665
|
+
/**
|
|
666
|
+
* Script execution parameters.
|
|
667
|
+
*
|
|
668
|
+
* @typedef {Object} ExecParams
|
|
669
|
+
* @property {String} PARAM_NAME -
|
|
670
|
+
* Name of the parameter.
|
|
671
|
+
* @property {String} PARAM_VALUE -
|
|
672
|
+
* Value of the parameter.
|
|
673
|
+
* @since 0.3
|
|
674
|
+
*/
|
|
675
|
+
/**
|
|
676
|
+
* Execute the named script passing in optional parameters.
|
|
677
|
+
*
|
|
678
|
+
* @param {String} scriptName Name of the script to execute.
|
|
679
|
+
* @param {ExecParams[]} [params]
|
|
680
|
+
* Optional array of named parameters to pass to script in server.
|
|
681
|
+
* @returns {Promise<String|String[]>}
|
|
682
|
+
* A promise that will be completed with either the value returned by the
|
|
683
|
+
* script after execution for local scripts, or an array of values
|
|
684
|
+
* returned by the script when executed in multiple servers for
|
|
685
|
+
* distributed scripts.
|
|
686
|
+
* @memberof Client#
|
|
687
|
+
* @since 0.3
|
|
688
|
+
*/
|
|
689
|
+
execute: (scriptName: string, params?: {
|
|
690
|
+
/**
|
|
691
|
+
* -
|
|
692
|
+
* Name of the parameter.
|
|
693
|
+
*/
|
|
694
|
+
PARAM_NAME: string;
|
|
695
|
+
/**
|
|
696
|
+
* -
|
|
697
|
+
* Value of the parameter.
|
|
698
|
+
*/
|
|
699
|
+
PARAM_VALUE: string;
|
|
700
|
+
}[]) => Promise<string | string[]>;
|
|
701
|
+
/**
|
|
702
|
+
* Get server topology related information.
|
|
703
|
+
*
|
|
704
|
+
* @returns {TopologyInfo}
|
|
705
|
+
* An object instance that can be used to query diverse information
|
|
706
|
+
* related to the server topology information.
|
|
707
|
+
* @memberof Client#
|
|
708
|
+
* @since 0.3
|
|
709
|
+
*/
|
|
710
|
+
getTopologyInfo: () => (transport: any) => {
|
|
711
|
+
/**
|
|
712
|
+
* Get the server topology identifier.
|
|
713
|
+
*
|
|
714
|
+
* @returns {Number} Topology identifier.
|
|
715
|
+
* @memberof Topology#
|
|
716
|
+
* @since 0.3
|
|
717
|
+
*/
|
|
718
|
+
getTopologyId: () => number;
|
|
719
|
+
/**
|
|
720
|
+
* Get the list of servers that the client is currently connected to.
|
|
721
|
+
*
|
|
722
|
+
* @return {ServerAddress[]} An array of server addresses.
|
|
723
|
+
* @memberof Topology#
|
|
724
|
+
* @since 0.3
|
|
725
|
+
*/
|
|
726
|
+
getMembers: () => {
|
|
727
|
+
/**
|
|
728
|
+
* - Server host name.
|
|
729
|
+
*/
|
|
730
|
+
host: string;
|
|
731
|
+
/**
|
|
732
|
+
* - Server port.
|
|
733
|
+
*/
|
|
734
|
+
port: number;
|
|
735
|
+
}[];
|
|
736
|
+
/**
|
|
737
|
+
* Find the list of server addresses that are owners for a given key.
|
|
738
|
+
*
|
|
739
|
+
* @param {(String|Object)} k Key to find owners for.
|
|
740
|
+
* @return {ServerAddress[]}
|
|
741
|
+
* An array of server addresses that are owners for the given key.
|
|
742
|
+
* @memberof Topology#
|
|
743
|
+
* @since 0.3
|
|
744
|
+
*/
|
|
745
|
+
findOwners: (k: (string | any)) => {
|
|
746
|
+
/**
|
|
747
|
+
* - Server host name.
|
|
748
|
+
*/
|
|
749
|
+
host: string;
|
|
750
|
+
/**
|
|
751
|
+
* - Server port.
|
|
752
|
+
*/
|
|
753
|
+
port: number;
|
|
754
|
+
}[];
|
|
755
|
+
/**
|
|
756
|
+
* Switch remote cache manager to a different cluster,
|
|
757
|
+
* previously declared via configuration.
|
|
758
|
+
*
|
|
759
|
+
* @param clusterName name of the cluster to which to switch to
|
|
760
|
+
* @return {Promise<Boolean>}
|
|
761
|
+
* A promise encapsulating a Boolean that indicates {@code true} if the
|
|
762
|
+
* switch happened, or {@code false} otherwise.
|
|
763
|
+
* @memberof Topology#
|
|
764
|
+
* @since 0.4
|
|
765
|
+
*/
|
|
766
|
+
switchToCluster: (clusterName: any) => Promise<boolean>;
|
|
767
|
+
/**
|
|
768
|
+
* Switch remote cache manager to the default cluster,
|
|
769
|
+
* previously declared via configuration.
|
|
770
|
+
*
|
|
771
|
+
* @return {Promise<Boolean>}
|
|
772
|
+
* A promise encapsulating a Boolean that indicates {@code true} if the
|
|
773
|
+
* switch happened, or {@code false} otherwise.
|
|
774
|
+
* @memberof Topology#
|
|
775
|
+
* @since 0.4
|
|
776
|
+
*/
|
|
777
|
+
switchToDefaultCluster: () => Promise<boolean>;
|
|
778
|
+
};
|
|
779
|
+
/**
|
|
780
|
+
* Get client information represented as a string.
|
|
781
|
+
* @memberof Client#
|
|
782
|
+
* @since 0.4
|
|
783
|
+
*/
|
|
784
|
+
toString: () => string;
|
|
785
|
+
registerProtostreamType: (typeName: any, descriptorId: any) => any;
|
|
786
|
+
registerProtostreamRoot: (root: any) => any;
|
|
787
|
+
};
|
|
788
|
+
/**
|
|
789
|
+
* Cluster information.
|
|
790
|
+
*
|
|
791
|
+
* @typedef {Object} Cluster
|
|
792
|
+
* @property {String} name - Cluster name.
|
|
793
|
+
* @property {ServerAddress[]} servers - Cluster servers details.
|
|
794
|
+
* @since 0.3
|
|
795
|
+
*/
|
|
796
|
+
/**
|
|
797
|
+
* Client configuration settings. Object instances that override
|
|
798
|
+
* these configuration options can be used on client construction to tweak
|
|
799
|
+
* its behaviour.
|
|
800
|
+
*
|
|
801
|
+
* @static
|
|
802
|
+
* @typedef {Object} ClientOptions
|
|
803
|
+
* @property {?(2.9|2.5|2.2)} [version=2.9] - Version of client/server protocol.
|
|
804
|
+
* @property {?String} [cacheName] - Optional cache name.
|
|
805
|
+
* @property {?Number} [maxRetries=3] - Optional number of retries for operation.
|
|
806
|
+
* @property {?Object} [ssl] - TLS/SSL properties.
|
|
807
|
+
* @property {?boolean} [ssl.enabled=false] - Optional flag to enable SSL support.
|
|
808
|
+
* @property {?String} [ssl.secureProtocol=TLSv1_2_method] - Optional field with secure protocol in use.
|
|
809
|
+
* @property {?String[]} [ssl.trustCerts] - Optional paths of trusted SSL certificates.
|
|
810
|
+
* @property {?String} [ssl.clientAuth.key] - Optional path to client authentication key.
|
|
811
|
+
* @property {?String} [ssl.clientAuth.passphrase] - Optional password for client key.
|
|
812
|
+
* @property {?String} [ssl.clientAuth.cert] - Optional client certificate.
|
|
813
|
+
* @property {?String} [ssl.sniHostName] - Optional SNI host name.
|
|
814
|
+
* @property {?String} [ssl.cryptoStore.path] - Optional crypto store path.
|
|
815
|
+
* @property {?String} [ssl.cryptoStore.passphrase] - Optional password for crypto store.
|
|
816
|
+
* @property {?Object} [authentication]- Authentication properties.
|
|
817
|
+
* @property {?boolean} [authentication.enabled]- Enable authentication.
|
|
818
|
+
* @property {?String} [authentication.saslMechanism] - Select the SASL mechanism to use. Can be one of PLAIN, DIGEST-MD5, SCRAM-SHA-1, SCRAM-SHA-256, SCRAM-SHA-384, SCRAM-SHA-512, EXTERNAL, OAUTHBEARER
|
|
819
|
+
* @property {?String} [authentication.userName] - The authentication username. Required by the PLAIN, DIGEST and SCRAM mechanisms.
|
|
820
|
+
* @property {?String} [authentication.password] - The authentication password. Required by the PLAIN, DIGEST and SCRAM mechanisms.
|
|
821
|
+
* @property {?String} [authentication.token] - The OAuth token. Required by the OAUTHBEARER mechanism.
|
|
822
|
+
* @property {?String} [authentication.authzid] - The SASL authorization ID.
|
|
823
|
+
* @property {?String} [authentication.authzid] - The SASL authorization ID.
|
|
824
|
+
* @property {?Object} [dataFormat] - Content-type for entry
|
|
825
|
+
* @property {?String} [dataFormat.keyType] - Content-type for key
|
|
826
|
+
* @property {?String} [dataFormat.valueType] - Content-type for value
|
|
827
|
+
* @property {?boolean} [topologyUpdates=true] - Optional flag to controls whether the client deals with topology updates or not.
|
|
828
|
+
* @property {?("text/plain"|"application/json")} [mediaType="text/plain"] - Media type of the cache contents.
|
|
829
|
+
* @property {?Cluster[]} [clusters] - Optional additional clusters for cross-site failovers.
|
|
830
|
+
* @since 0.3
|
|
831
|
+
*/
|
|
832
|
+
config: {
|
|
833
|
+
version: string;
|
|
834
|
+
cacheName: any;
|
|
835
|
+
maxRetries: number;
|
|
836
|
+
authentication: {
|
|
837
|
+
enabled: boolean;
|
|
838
|
+
serverName: string;
|
|
839
|
+
saslProperties: {};
|
|
840
|
+
saslMechanism: string;
|
|
841
|
+
userName: string;
|
|
842
|
+
password: any[];
|
|
843
|
+
realm: string;
|
|
844
|
+
token: string;
|
|
845
|
+
};
|
|
846
|
+
ssl: {
|
|
847
|
+
enabled: boolean;
|
|
848
|
+
secureProtocol: string;
|
|
849
|
+
trustCerts: any[];
|
|
850
|
+
clientAuth: {
|
|
851
|
+
key: any;
|
|
852
|
+
passphrase: any;
|
|
853
|
+
cert: any;
|
|
854
|
+
};
|
|
855
|
+
sniHostName: any;
|
|
856
|
+
cryptoStore: {
|
|
857
|
+
path: any;
|
|
858
|
+
passphrase: any;
|
|
859
|
+
};
|
|
860
|
+
};
|
|
861
|
+
dataFormat: {
|
|
862
|
+
keyType: string;
|
|
863
|
+
valueType: string;
|
|
864
|
+
};
|
|
865
|
+
topologyUpdates: boolean;
|
|
866
|
+
clusters: any[];
|
|
867
|
+
};
|
|
868
|
+
}>>;
|