-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaerospike.d.ts
2334 lines (2077 loc) · 98.6 KB
/
aerospike.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import { EventEmitter, Stream } from "stream";
declare module "aerospike" {
// type PartialAerospikeRecordValue = null | undefined | boolean | string | number | Double | BigInt | Buffer | GeoJSON;
type AerospikeRecordValue = any;
type AerospikeMapKey = any[] | string | number | Double;
type AerospikeBins = {
[key: string]: AerospikeRecordValue
};
// Commands
class Command {
readonly client: Client;
private args: any[];
protected callback(...args: any[]): any;
readonly captureStackTraces: boolean;
public key?: IKey;
public ensureConnected: boolean;
constructor(client: Client, args: any[], callback?: AddonCallback);
private captureStackTrace(): void;
private connected(): boolean;
private convertError(): AerospikeError;
protected convertResult(...args): any;
protected convertResponse(err, ...args): [AerospikeError | null, any];
private execute(): Promise<any> | void;
private executeWithCallback(callback: AddonCallback): void;
private executeAndReturnPromise(): Promise<any>;
private expectsPromise(): boolean;
private asCommand(): string;
private process(cb: AddonCallback): void;
private sendError(message: string): void;
}
interface IBatchResult<T extends AerospikeBins> {
status: Status;
record: AerospikeRecord<T>;
}
class BatchCommand extends Command {
protected convertResult<T extends AerospikeBins = AerospikeBins>(results: AerospikeRecord<T>[]): IBatchResult<T>[];
}
class ConnectCommandBase extends Command {
constructor(client: Client, callback: AddonCallback);
}
class ExistsCommandBase extends Command {
constructor(client: Client, key: IKey, args: any[], callback?: AddonCallback);
protected convertResult(metadata: IRecordMetadata): AerospikeRecord<null>
protected convertResponse(error: AerospikeError, bins: AerospikeBins, metadata: IRecordMetadata): [AerospikeError | null, boolean | AerospikeRecord<null>];
}
class ReadRecordCommand extends Command {
constructor(client: Client, key: IKey, args: any[]);
public convertResult<T extends AerospikeBins = AerospikeBins>(bins: AerospikeBins, metadata: IRecordMetadata): AerospikeRecord<T>;
}
class StreamCommand extends Command {
public stream: RecordStream;
constructor(stream: RecordStream, args: any[]);
protected callback<T extends AerospikeBins = AerospikeBins>(error: Error, record: AerospikeRecord<T>): boolean;
protected convertResult<T extends AerospikeBins = AerospikeBins>(bins: AerospikeBins, meta: IRecordMetadata, asKey: IKey): AerospikeRecord<T> | { state: IRecordMetadata };
}
class WriteRecordCommand extends Command {
constructor(client: Client, key: IKey, args: any[], callback: AddOperation);
protected convertResult(): IKey;
}
class QueryBackgroundBaseCommand extends Command {
public queryID: number;
public queryObj: IQueryOptions;
constructor(client: Client, ns: string, set: string, queryObj: IQueryOptions, policy: IQueryPolicyProps, queryID: number, callback: AddonCallback);
public convertResult(): Job;
}
class ApplyCommand extends Command { }
class BatchExistsCommand extends BatchCommand { }
class BatchGetCommand extends BatchCommand { }
class BatchReadCommand extends BatchCommand { }
class BatchWriteCommand extends BatchCommand { }
class BatchApplyCommand extends BatchCommand { }
class BatchRemoveCommand extends BatchCommand { }
class BatchSelectCommand extends BatchCommand { }
class ChangePasswordCommand extends Command { }
class ConnectCommand extends ConnectCommandBase { }
class ExistsCommand extends ExistsCommandBase { }
class GetCommand extends ReadRecordCommand { }
class IndexCreateCommand extends Command { }
class IndexRemoveCommand extends Command { }
class InfoAnyCommand extends Command { }
class InfoForeachCommand extends Command { }
class InfoHostCommand extends Command { }
class InfoNodeCommand extends Command { }
class JobInfoCommand extends Command { }
class OperateCommand extends ReadRecordCommand { }
class PrivilegeGrantCommand extends Command { }
class PrivilegeRevokeCommand extends Command { }
class PutCommand extends WriteRecordCommand { }
class QueryCommand extends StreamCommand { }
class QueryPagesCommand extends StreamCommand { }
class QueryApplyCommand extends Command { }
class QueryBackgroundCommand extends QueryBackgroundBaseCommand { }
class QueryOperateCommand extends QueryBackgroundBaseCommand { }
class QueryForeachCommand extends StreamCommand { }
class QueryRoleCommand extends Command { }
class QueryRolesCommand extends Command { }
class QueryUserCommand extends Command { }
class QueryUsersCommand extends Command { }
class RemoveCommand extends WriteRecordCommand { }
class RoleCreateCommand extends Command { }
class RoleDropCommand extends Command { }
class RoleGrantCommand extends Command { }
class RoleRevokeCommand extends Command { }
class RoleSetWhitelistCommand extends Command { }
class RoleSetQuotasCommand extends Command { }
class ScanCommand extends StreamCommand { }
class ScanPagesCommand extends StreamCommand { }
class ScanBackgroundCommand extends QueryBackgroundBaseCommand { }
class ScanOperateCommand extends QueryBackgroundBaseCommand { }
class SelectCommand extends ReadRecordCommand { }
class TruncateCommand extends Command { }
class UdfRegisterCommand extends Command { }
class UdfRemoveCommand extends Command { }
class UserCreateCommand extends Command { }
class UserDropCommand extends Command { }
// C++ bindings
enum ExpOpcodes {
CMP_EQ = 1,
CMP_NE,
CMP_GT,
CMP_GE,
CMP_LT,
CMP_LE,
CMP_REGEX,
CMP_GEO,
AND = 16,
OR,
NOT,
EXCLUSIVE,
DIGEST_MODULO,
DEVICE_SIZE,
LAST_UPDATE,
SINCE_UPDATE,
VOID_TIME,
TTL,
SET_NAME,
KEY_EXIST,
IS_TOMBSTONE,
MEMORY_SIZE,
KEY = 80,
BIN,
BIN_TYPE,
QUOTE = 126,
CALL,
AS_VAL,
VAL_GEO,
VAL_PK,
VAL_INT,
VAL_UINT,
VAL_FLOAT,
VAL_BOOL,
VAL_STR,
VAL_BYTES,
VAL_RAWSTR,
VAL_RTYPE,
CALL_VOP_START,
CDT_LIST_CRMOD,
CDT_LIST_MOD,
CDT_MAP_CRMOD,
CDT_MAP_CR,
CDT_MAP_MOD,
END_OF_VA_ARGS,
ADD = 20,
SUB,
MUL,
DIV,
POW,
LOG,
MOD,
ABS,
FLOOR,
CEIL,
TO_INT,
TO_FLOAT,
INT_AND,
INT_OR,
INT_XOR,
INT_NOT,
INT_LSHIFT,
INT_RSHIFT,
INT_ARSHIFT,
INT_COUNT,
INT_LSCAN,
INT_RSCAN,
MIN = 50,
MAX,
COND = 123,
VAR,
LET
}
enum ExpSystemTypes {
CALL_CDT,
CALL_BITS,
CALL_HLL,
FLAG_MODIFY_LOCAL = 64
}
enum ExpTypes {
NIL,
// BOOL - no boolean type in src/main/enums/exp_enum.cc#L127
INT = 2,
STR,
LIST,
MAP,
BLOB,
FLOAT,
GEOJSON,
HLL,
AUTO,
ERROR
}
interface IExpOpcodesValues {
ops: ExpOpcodes,
sys: ExpSystemTypes,
type: ExpTypes
}
enum ExpOperations {
WRITE = 1280,
READ
}
enum Predicates {
EQUAL,
RANGE
}
enum IndexDataType {
STRING,
NUMERIC,
GEO2DSPHERE
}
enum IndexType {
DEFAULT,
LIST,
MAPKEYS,
MAPVALUES
}
enum ListOrder {
UNORDERED,
ORDERED
}
enum ListSortFlags {
DEFAULT,
DROP_DUPLICATES
}
enum ListWriteFlags {
DEFAULT,
ADD_UNIQUE,
INSERT_BOUNDED,
NO_FAIL,
PARTIAL
}
enum ListReturnType {
NONE,
INDEX,
REVERSE_INDEX,
RANK,
REVERSE_RANK,
COUNT,
VALUE,
EXISTS,
INVERTED
}
enum MapsOrder {
UNORDERED,
KEY_ORDERED,
KEY_VALUE_ORDERED = 3
}
enum MapsWriteMode {
UPDATE,
UPDATE_ONLY,
CREATE_ONLY
}
enum MapsWriteFlags {
DEFAULT,
CREATE_ONLY,
UPDATE_ONLY,
NO_FAIL,
PARTIAL
}
enum MapReturnType {
NONE,
INDEX,
REVERSE_INDEX,
RANK,
REVERSE_RANK,
COUNT,
KEY,
VALUE,
KEY_VALUE,
EXISTS,
UNORDERED_MAP,
ORDERED_MAP,
INVERTED
}
enum ScalarOperations {
WRITE,
READ,
INCR,
PREPEND,
APPEND,
TOUCH,
DELETE
}
enum PolicyGen {
IGNORE,
EQ,
GT
}
enum PolicyKey {
DIGEST,
SEND
}
enum PolicyExists {
IGNORE,
CREATE,
UPDATE,
REPLACE,
CREATE_OR_REPLACE
}
enum PolicyReplica {
MASTER,
ANY,
SEQUENCE,
PREFER_RACK
}
enum PolicyReadModeAP {
ONE,
ALL
}
enum PolicyReadModeSC {
SESSION,
LINEARIZE,
ALLOW_REPLICA,
ALLOW_UNAVAILABLE
}
enum PolicyCommitLevel {
ALL,
MASTER
}
enum BitwiseWriteFlags {
DEFAULT,
CREATE_ONLY,
UPDATE_ONLY,
NO_FAIL,
PARTIAL = 8
}
enum BitwiseResizeFlags {
DEFAULT,
FROM_FRONT,
GROW_ONLY,
SHRINK_ONLY = 4
}
enum BitwiseOverflow {
FAIL,
SATURATE = 2,
WRAP = 4
}
enum HLLWriteFlags {
DEFAULT,
CREATE_ONLY,
UPDATE_ONLY,
NO_FAIL = 4,
ALLOW_FOLD = 8
}
enum LogLevel {
OFF = -1,
ERROR,
WARN,
INFO,
DEBUG,
TRACE,
DETAIL
}
enum Auth {
INTERNAL,
EXTERNAL,
EXTERNAL_INSECURE,
AUTH_PKI
}
enum Language {
LUA
}
enum Log {
OFF = -1,
ERROR,
WARN,
INFO,
DEBUG,
TRACE,
DETAIL = 4
}
enum TTL {
DONT_UPDATE = -2,
NEVER_EXPIRE,
NAMESPACE_DEFAULT
}
enum JobStatus {
UNDEF,
INPROGRESS,
COMPLETED
}
enum Status {
AEROSPIKE_ERR_ASYNC_QUEUE_FULL = -11,
AEROSPIKE_ERR_CONNECTION,
AEROSPIKE_ERR_TLS_ERROR,
AEROSPIKE_ERR_INVALID_NODE,
AEROSPIKE_ERR_NO_MORE_CONNECTIONS,
AEROSPIKE_ERR_ASYNC_CONNECTION,
AEROSPIKE_ERR_CLIENT_ABORT,
AEROSPIKE_ERR_INVALID_HOST,
AEROSPIKE_NO_MORE_RECORDS,
AEROSPIKE_ERR_PARAM,
AEROSPIKE_ERR_CLIENT,
AEROSPIKE_OK,
AEROSPIKE_ERR_SERVER,
AEROSPIKE_ERR_RECORD_NOT_FOUND,
AEROSPIKE_ERR_RECORD_GENERATION,
AEROSPIKE_ERR_REQUEST_INVALID,
AEROSPIKE_ERR_RECORD_EXISTS,
AEROSPIKE_ERR_BIN_EXISTS,
AEROSPIKE_ERR_CLUSTER_CHANGE,
AEROSPIKE_ERR_SERVER_FULL,
AEROSPIKE_ERR_TIMEOUT,
AEROSPIKE_ERR_ALWAYS_FORBIDDEN,
AEROSPIKE_ERR_CLUSTER,
AEROSPIKE_ERR_BIN_INCOMPATIBLE_TYPE,
AEROSPIKE_ERR_RECORD_TOO_BIG,
AEROSPIKE_ERR_RECORD_BUSY,
AEROSPIKE_ERR_SCAN_ABORTED,
AEROSPIKE_ERR_UNSUPPORTED_FEATURE,
AEROSPIKE_ERR_BIN_NOT_FOUND,
AEROSPIKE_ERR_DEVICE_OVERLOAD,
AEROSPIKE_ERR_RECORD_KEY_MISMATCH,
AEROSPIKE_ERR_NAMESPACE_NOT_FOUND,
AEROSPIKE_ERR_BIN_NAME,
AEROSPIKE_ERR_FAIL_FORBIDDEN,
AEROSPIKE_ERR_FAIL_ELEMENT_NOT_FOUND,
AEROSPIKE_ERR_FAIL_ELEMENT_EXISTS,
AEROSPIKE_ERR_ENTERPRISE_ONLY,
AEROSPIKE_ERR_OP_NOT_APPLICABLE,
AEROSPIKE_FILTERED_OUT,
AEROSPIKE_LOST_CONFLICT,
AEROSPIKE_QUERY_END = 50,
AEROSPIKE_SECURITY_NOT_SUPPORTED,
AEROSPIKE_SECURITY_NOT_ENABLED,
AEROSPIKE_SECURITY_SCHEME_NOT_SUPPORTED,
AEROSPIKE_INVALID_COMMAND,
AEROSPIKE_INVALID_FIELD,
AEROSPIKE_ILLEGAL_STATE,
AEROSPIKE_INVALID_USER = 60,
AEROSPIKE_USER_ALREADY_EXISTS,
AEROSPIKE_INVALID_PASSWORD,
AEROSPIKE_EXPIRED_PASSWORD,
AEROSPIKE_FORBIDDEN_PASSWORD,
AEROSPIKE_INVALID_CREDENTIAL,
AEROSPIKE_EXPIRED_SESSION,
AEROSPIKE_INVALID_ROLE = 70,
AEROSPIKE_ROLE_ALREADY_EXISTS,
AEROSPIKE_INVALID_PRIVILEGE,
AEROSPIKE_INVALID_WHITELIST,
AEROSPIKE_QUOTAS_NOT_ENABLED,
AEROSPIKE_INVALID_QUOTA,
AEROSPIKE_NOT_AUTHENTICATED = 80,
AEROSPIKE_ROLE_VIOLATION,
AEROSPIKE_ERR_UDF = 100,
AEROSPIKE_ERR_BATCH_DISABLED = 150,
AEROSPIKE_ERR_BATCH_MAX_REQUESTS_EXCEEDED,
AEROSPIKE_ERR_BATCH_QUEUES_FULL,
AEROSPIKE_ERR_GEO_INVALID_GEOJSON = 160,
AEROSPIKE_ERR_INDEX_FOUND = 200,
AEROSPIKE_ERR_INDEX_NOT_FOUND,
AEROSPIKE_ERR_INDEX_OOM,
AEROSPIKE_ERR_INDEX_NOT_READABLE,
AEROSPIKE_ERR_INDEX,
AEROSPIKE_ERR_INDEX_NAME_MAXLEN,
AEROSPIKE_ERR_INDEX_MAXCOUNT,
AEROSPIKE_ERR_QUERY_ABORTED = 210,
AEROSPIKE_ERR_QUERY_QUEUE_FULL,
AEROSPIKE_ERR_QUERY_TIMEOUT,
AEROSPIKE_ERR_QUERY,
AEROSPIKE_ERR_UDF_NOT_FOUND = 1301,
AEROSPIKE_ERR_LUA_FILE_NOT_FOUND,
AEROSPIKE_BATCH_FAILED,
AEROSPIKE_NO_RESPONSE,
AEROSPIKE_MAX_ERROR_RATE,
AEROSPIKE_USE_NORMAL_RETRY,
AEROSPIKE_ERR_MAX_RETRIES_EXCEEDED
}
enum PrivilegeCode {
USER_ADMIN = 0,
SYS_ADMIN = 1,
DATA_ADMIN = 2,
UDF_ADMIN = 3,
SINDEX_ADMIN = 4,
READ = 10,
READ_WRITE = 11,
READ_WRITE_UDF = 12,
WRITE = 13,
TRUNCATE = 14
}
interface IAddonUDF {
module: string;
funcname: string;
args: AerospikeRecordValue[];
}
interface IAddonNode {
name: string;
address: string;
}
interface IEventLoopStats {
inFlight: number;
queued: number;
}
interface IAddonConnectionStats {
inPool: number;
inUse: number;
opened: number;
closed: number;
}
interface IAddonNodeStats {
name: string;
syncConnections: IAddonConnectionStats;
asyncConnections: IAddonConnectionStats;
}
interface IAddonStats {
commands: IEventLoopStats;
nodes: IAddonNodeStats[];
}
interface IAddonQueryOptions {
filters: SindexFilterPredicate[];
selected: string[];
nobins: boolean;
udf: IAddonUDF;
ops: Operation[]
}
interface IAddonScanOptions {
selected: string[];
nobins: boolean;
concurrent: boolean;
udf: IAddonUDF;
ops: Operation[]
}
interface IAddonEvent {
name: string;
[key: string]: any;
}
type AddonCallback = (error: Error | undefined, result: any) => void;
type AddonEventCallback = (event: IAddonEvent) => void;
class AddonAerospikeClient {
public addSeedHost(hostname: string, port: number): void;
public applyAsync(key: IKey, udf: IAddonUDF, policy: BasePolicy, callback: AddonCallback): void;
public batchExists(keys: IKey[], policy: BasePolicy, callback: AddonCallback): void;
public batchGet(keys: IKey[], policy: BasePolicy, callback: AddonCallback): void;
public batchRead<T extends AerospikeBins = AerospikeBins>(records: AerospikeRecord<T>[], policy: BasePolicy, callback: AddonCallback): void;
public batchSelect(keys: IKey[], bins: string[], policy: BasePolicy, callback: AddonCallback): void;
public contextFromBase64(context: { context: string }): [number, number][];
public contextToBase64(context: { context: CdtContext }): string;
public close(): void;
public connect(callback: AddonCallback): void;
public existsAsync(key: IKey, policy: BasePolicy, callback: AddonCallback): void;
public getAsync(key: IKey, policy: BasePolicy, callback: AddonCallback): void;
public getNodes(): IAddonNode[];
public getStats(): IAddonStats;
public hasPendingAsyncCommands(): boolean;
public indexCreate(ns: string, set: string, bin: string, indexName: string, indexType: IndexType, indexDataType: IndexDataType, context: CdtContext, policy: IInfoPolicyProps, callback: AddonCallback): void;
public indexRemove(ns: string, indexName: string, policy: IInfoPolicyProps, callback: AddonCallback): void;
public infoAny(request: string, policy: IInfoPolicyProps, callback: AddonCallback): void;
public infoForeach(request: string, policy: IInfoPolicyProps, callback: AddonCallback): void;
public infoHost(request: string, host: IHost, policy: IInfoPolicyProps, callback: AddonCallback): void;
public infoNode(request: string, node: string, policy: IInfoPolicyProps, callback: AddonCallback): void;
public isConnected(): boolean;
public jobInfo(jobID: number, module: string, policy: IInfoPolicyProps, callback: AddonCallback): void;
public operateAsync(key: IKey, operations: Operation[], meta: IRecordMetadata, policy: IOperatePolicyProps, callback: AddonCallback): void;
public putAsync<T extends AerospikeBins = AerospikeBins>(key: IKey, record: AerospikeRecord<T>, meta: IRecordMetadata, policy: IWritePolicyProps, callback: AddonCallback): void;
public queryApply(ns: string, set: string, options: IAddonQueryOptions, policy: IQueryPolicyProps, callback: AddonCallback): void;
public queryAsync(ns: string, set: string, options: IAddonQueryOptions, policy: IQueryPolicyProps, callback: AddonCallback): void;
public queryBackground(ns: string, set: string, options: IAddonQueryOptions, policy: IQueryPolicyProps, queryID: number, callback: AddonCallback);
public queryForeach(ns: string, set: string, options: IAddonQueryOptions, policy: IQueryPolicyProps, callback: AddonCallback): void;
public removeAsync(key: IKey, policy: IRemovePolicyProps, callback: AddonCallback): void;
public removeSeedHost(hostname: string, port: number): void;
public scanAsync(ns: string, set: string, options: IAddonScanOptions, policy: IScanPolicyProps, scanID: number, callback: AddonCallback): void;
public scanBackground(ns: string, set: string, options: IAddonScanOptions, policy: IScanPolicyProps, scanID: number, callback: AddonCallback): void;
public selectAsync(key: string, bins: string[], policy: IReadPolicyProps, callback: AddonCallback): void;
public setupEventCb(callback: AddonEventCallback): void;
public truncate(ns: string, set: string, beforeNanos: number, policy: IInfoPolicyProps, callback: AddonCallback): void;
public udfRegister(filename: string, type: Language, policy: IInfoPolicyProps, callback: AddonCallback): void;
public udfRemove(module: string, policy: IInfoPolicyProps, callback: AddonCallback): void;
public updateLogging(log: ILogInfo): AddonAerospikeClient;
}
// bin.js
export class Bin {
constructor(name: string, value: AerospikeRecordValue | Map<AerospikeMapKey, any>, mapOrder?: MapsOrder);
public name: string;
public value: AerospikeRecordValue | Map<AerospikeMapKey, any>;
}
// filter.js
class SindexFilterPredicate {
public constructor (
predicate: Predicates,
bin: string,
dataType: IndexDataType,
indexType: IndexType,
context: CdtContext,
props?: Record<string, any>
);
public predicate: Predicates;
public bin: string;
public datatype: IndexDataType;
public context: CdtContext;
public type: IndexType;
}
class EqualPredicate extends SindexFilterPredicate {
constructor(bin: string, value: string | number, dataType: IndexDataType, indexType: IndexType, context: CdtContext);
public val: string | number;
}
class RangePredicate extends SindexFilterPredicate {
constructor(bin: string, min: number, max: number, dataType: IndexDataType, indexType: IndexType, context: CdtContext);
public min: number;
public max: number;
}
class GeoPredicate extends SindexFilterPredicate {
constructor (bin: string, value: GeoJSON, indexType: IndexType, context: CdtContext);
public val: GeoJSON;
}
// query.js
interface IQueryOptions {
udf?: IAddonUDF; // query.js#581 Why udf with caps?
filters?: SindexFilterPredicate[];
select?: string[];
nobins?: boolean;
paginate?: boolean;
maxRecords?: number;
ttl?: number;
}
export class Query {
public client: Client;
public ns: string;
public set: string;
public filters: SindexFilterPredicate[] | undefined;
public selected: string[] | undefined;
public nobins: boolean | undefined;
public ops: Operation[] | undefined;
public udf: IAddonUDF | undefined;
private pfEnabled: boolean;
public paginate: boolean | undefined;
public maxRecords: number | undefined;
public queryState: number | null | undefined /* ??? */;
public ttl: number | undefined;
constructor(client: Client, ns: string, set: string, options?: IQueryOptions);
public nextPage(state: number): void;
public hasNextPage(): boolean;
public select(bins: string[]): void;
public select(...bins: string[]): void;
public where(indexFilter: SindexFilterPredicate): void;
public setSindexFilter(sindexFilter: SindexFilterPredicate): void;
public setUdf(udfModule: string, udfFunction: string, udfArgs?: any[]): void;
public foreach<T extends AerospikeBins = AerospikeBins>(policy?: IQueryPolicyProps, dataCb?: (data: AerospikeRecord<T>) => void, errorCb?: (error: Error) => void, endCb?: (queryState?: number) => void): RecordStream;
public results<T extends AerospikeBins = AerospikeBins>(policy?: IQueryPolicyProps): Promise<AerospikeRecord<T>[]>;
public apply(udfModule: string, udfFunction: string, udfArgs?: any[], policy?: IQueryPolicyProps): Promise<AerospikeRecordValue>;
public apply(udfModule: string, udfFunction: string, callback: TypedCallback<AerospikeRecordValue>): void;
public apply(udfModule: string, udfFunction: string, udfArgs: any[], callback: TypedCallback<AerospikeRecordValue>): void;
public apply(udfModule: string, udfFunction: string, udfArgs: any[], policy: IQueryPolicyProps, callback: TypedCallback<AerospikeRecordValue>): void;
public background(udfModule: string, udfFunction: string, udfArgs?: any[], policy?: IWritePolicyProps, queryID?: number): Promise<Job>;
public background(udfModule: string, udfFunction: string, callback: TypedCallback<Job>): void;
public background(udfModule: string, udfFunction: string, udfArgs: any[], callback: TypedCallback<Job>): void;
public background(udfModule: string, udfFunction: string, udfArgs: any[], callback: TypedCallback<Job>): void;
public background(udfModule: string, udfFunction: string, udfArgs: any[], policy: IWritePolicyProps, callback: TypedCallback<Job>): void;
public background(udfModule: string, udfFunction: string, udfArgs: any[], policy: IWritePolicyProps, queryID: number, callback: TypedCallback<Job>): void;
public operate(operations: Operation[], policy?: IQueryPolicyProps, queryID?: number): Promise<Job>;
public operate(operations: Operation[], callback: TypedCallback<Job>): void;
public operate(operations: Operation[], policy: IQueryPolicyProps, callback: TypedCallback<Job>): void;
public operate(operations: Operation[], policy: IQueryPolicyProps, queryID: number, callback: TypedCallback<Job>): void;
}
// cdt_context.js
enum CdtItemTypes {
LIST_INDEX = 0x10,
LIST_RANK,
LIST_VALUE = 0x13,
MAP_INDEX = 0x20,
MAP_RANK,
MAP_KEY,
MAP_VALUE
}
class CdtItems extends Array {
public push(v: [number, CdtContext]);
}
class CdtContext {
public items: CdtItems;
private add(type: CdtItemTypes, value: CdtContext): CdtContext;
public addListIndex(index: number): CdtContext;
public addListRank(rank: number): CdtContext;
public addListValue(value: AerospikeRecordValue): CdtContext;
public addMapIndex(index: number): CdtContext;
public addMapRank(rank: number): CdtContext;
public addMapKey(key: string): CdtContext;
public addMapValue(value: AerospikeRecordValue): CdtContext;
static getContextType(ctx: CdtContext, type: CdtItemTypes): ExpTypes | CdtItemTypes;
}
// operations.js
class Operation {
public op: ScalarOperations;
public bin: string;
constructor(op: ScalarOperations, bin: string, props?: Record<string, any>);
}
class WriteOperation extends Operation {
public value: any;
}
class AddOperation extends Operation {
public value: number | Double;
}
class AppendOperation extends Operation {
public value: string | Buffer;
}
class PrependOperation extends Operation {
public value: string | Buffer;
}
class TouchOperation extends Operation {
public ttl: number;
}
class ListOperation extends Operation {
public andReturn(returnType: ListReturnType): ListOperation;
public withContext(contextOrFunction: CdtContext | Function): ListOperation;
public invertSelection(): void;
}
class InvertibleListOp extends ListOperation {
public inverted: boolean;
public invertSelection(): InvertibleListOp;
}
class MapOperation extends Operation {
andReturn(returnType: MapReturnType): MapOperation;
public withContext(contextOrFunction: CdtContext | Function): MapOperation;
}
class BitwiseOperation extends Operation {
withPolicy(policy: IBitwisePolicyProps): BitwiseOperation;
}
class OverflowableBitwiseOp extends BitwiseOperation {
public overflowAction: BitwiseOverflow;
public onOverflow(action: BitwiseOverflow): OverflowableBitwiseOp;
}
// exp_operations.js
class ExpOperation extends Operation {
public exp: AerospikeExp;
public flags: number;
constructor(op: ExpOperations, bin: string, exp: AerospikeExp, flags: number, props?: Record<string, any>);
}
type AnyOperation = Operation | ExpOperation;
// policies
enum QueryDuration {
LONG,
SHORT,
LONG_RELAX_AP
}
interface IBasePolicyProps {
socketTimeout?: number;
totalTimeout?: number;
timeout?: number;
maxRetries?: number;
compress?: boolean;
filterExpression?: AerospikeExp;
}
export class BasePolicy implements IBasePolicyProps {
public socketTimeout?: number;
public totalTimeout?: number;
public maxRetries?: number;
public filterExpression?: AerospikeExp;
public compress?: boolean;
constructor(props?: IBasePolicyProps);
}
interface IApplyPolicyProps extends IBasePolicyProps {
key?: PolicyKey;
commitLevel?: PolicyCommitLevel;
ttl?: number;
durableDelete?: boolean;
}
export class ApplyPolicy extends BasePolicy implements IApplyPolicyProps {
public key?: PolicyKey;
public commitLevel?: PolicyCommitLevel;
public ttl?: number;
public durableDelete?: boolean;
constructor(props?: IApplyPolicyProps);
}
interface IBatchPolicyProps extends IBasePolicyProps {
deserialize?: boolean;
allowInline?: boolean;
sendSetName?: boolean;
readModeAP?: PolicyReadModeAP;
readModeSC?: PolicyReadModeSC;
readTouchTtlPercent?: number
}
export class BatchPolicy extends BasePolicy implements IBatchPolicyProps {
public deserialize?: boolean;
public allowInline?: boolean;
public sendSetName?: boolean;
public readModeAP?: PolicyReadModeAP;
public readModeSC?: PolicyReadModeSC;
constructor(props?: IBatchPolicyProps)
}
interface IBitwisePolicyProps extends IBatchPolicyProps {
writeFlags?: BitwiseWriteFlags
}
class BitwisePolicy extends BasePolicy implements IBitwisePolicyProps {
public writeFlags?: BitwiseWriteFlags;
constructor(props?: IBitwisePolicyProps);
}
interface ICommandQueuePolicyProps extends IBasePolicyProps {
maxCommandsInProcess?: number;
maxCommandsInQueue?: number;
queueInitialCapacity?: number;
}
export class CommandQueuePolicy extends BasePolicy implements ICommandQueuePolicyProps {
public maxCommandsInProcess?: number;
public maxCommandsInQueue?: number;
public queueInitialCapacity?: number;
constructor(props?: ICommandQueuePolicyProps);
}
interface IHLLPolicyProps extends IBasePolicyProps {
writeFlags?: HLLWriteFlags;
}
class HLLPolicy extends BasePolicy implements IHLLPolicyProps {
public writeFlags?: HLLWriteFlags;
constructor(props?: IHLLPolicyProps);
}
interface IInfoPolicyProps extends IBasePolicyProps {
sendAsIs?: boolean;
checkBounds?: boolean;
}
export class InfoPolicy extends BasePolicy implements IInfoPolicyProps {
public sendAsIs?: boolean;
public checkBounds?: boolean;
constructor(props?: IInfoPolicyProps);
}
interface IAdminPolicyProps {
timeout?: number;
}
export class AdminPolicy implements IAdminPolicyProps {
public timeout?: number;
constructor(props?: IAdminPolicyProps);
}
interface IListPolicyProps extends IBasePolicyProps {