1 | import { Cluster } from './cluster';
|
2 | import { Collection } from './collection';
|
3 | import { NodeCallback } from './utilities';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export declare class QueryIndex {
|
10 | |
11 |
|
12 |
|
13 | name: string;
|
14 | |
15 |
|
16 |
|
17 | isPrimary: boolean;
|
18 | |
19 |
|
20 |
|
21 | type: string;
|
22 | |
23 |
|
24 |
|
25 | state: string;
|
26 | |
27 |
|
28 |
|
29 | indexKey: string[];
|
30 | |
31 |
|
32 |
|
33 | condition?: string;
|
34 | |
35 |
|
36 |
|
37 | partition?: string;
|
38 | |
39 |
|
40 |
|
41 | collectionName?: string;
|
42 | |
43 |
|
44 |
|
45 | scopeName?: string;
|
46 | |
47 |
|
48 |
|
49 | bucketName?: string;
|
50 | |
51 |
|
52 |
|
53 | constructor(data: QueryIndex);
|
54 | }
|
55 | /**
|
56 | * @category Management
|
57 | */
|
58 | export interface CreateQueryIndexOptions {
|
59 | |
60 |
|
61 |
|
62 |
|
63 |
|
64 | collectionName?: string;
|
65 | |
66 |
|
67 |
|
68 |
|
69 |
|
70 | scopeName?: string;
|
71 | |
72 |
|
73 |
|
74 |
|
75 | ignoreIfExists?: boolean;
|
76 | |
77 |
|
78 |
|
79 | numReplicas?: number;
|
80 | |
81 |
|
82 |
|
83 |
|
84 | deferred?: boolean;
|
85 | |
86 |
|
87 |
|
88 | timeout?: number;
|
89 | }
|
90 |
|
91 |
|
92 |
|
93 | export interface CreatePrimaryQueryIndexOptions {
|
94 | |
95 |
|
96 |
|
97 |
|
98 |
|
99 | collectionName?: string;
|
100 | |
101 |
|
102 |
|
103 |
|
104 |
|
105 | scopeName?: string;
|
106 | |
107 |
|
108 |
|
109 | name?: string;
|
110 | |
111 |
|
112 |
|
113 |
|
114 | ignoreIfExists?: boolean;
|
115 | |
116 |
|
117 |
|
118 | numReplicas?: number;
|
119 | |
120 |
|
121 |
|
122 |
|
123 | deferred?: boolean;
|
124 | |
125 |
|
126 |
|
127 | timeout?: number;
|
128 | }
|
129 |
|
130 |
|
131 |
|
132 | export interface DropQueryIndexOptions {
|
133 | |
134 |
|
135 |
|
136 |
|
137 |
|
138 | collectionName?: string;
|
139 | |
140 |
|
141 |
|
142 |
|
143 |
|
144 | scopeName?: string;
|
145 | |
146 |
|
147 |
|
148 |
|
149 | ignoreIfNotExists?: boolean;
|
150 | |
151 |
|
152 |
|
153 | timeout?: number;
|
154 | }
|
155 |
|
156 |
|
157 |
|
158 | export interface DropPrimaryQueryIndexOptions {
|
159 | |
160 |
|
161 |
|
162 |
|
163 |
|
164 | collectionName?: string;
|
165 | |
166 |
|
167 |
|
168 |
|
169 |
|
170 | scopeName?: string;
|
171 | |
172 |
|
173 |
|
174 | name?: string;
|
175 | |
176 |
|
177 |
|
178 |
|
179 | ignoreIfNotExists?: boolean;
|
180 | |
181 |
|
182 |
|
183 | timeout?: number;
|
184 | }
|
185 |
|
186 |
|
187 |
|
188 | export interface GetAllQueryIndexesOptions {
|
189 | |
190 |
|
191 |
|
192 |
|
193 |
|
194 | collectionName?: string;
|
195 | |
196 |
|
197 |
|
198 |
|
199 |
|
200 | scopeName?: string;
|
201 | |
202 |
|
203 |
|
204 | timeout?: number;
|
205 | }
|
206 |
|
207 |
|
208 |
|
209 | export interface BuildQueryIndexOptions {
|
210 | |
211 |
|
212 |
|
213 |
|
214 |
|
215 | collectionName?: string;
|
216 | |
217 |
|
218 |
|
219 |
|
220 |
|
221 | scopeName?: string;
|
222 | |
223 |
|
224 |
|
225 | timeout?: number;
|
226 | }
|
227 |
|
228 |
|
229 |
|
230 | export interface WatchQueryIndexOptions {
|
231 | |
232 |
|
233 |
|
234 |
|
235 |
|
236 | collectionName?: string;
|
237 | |
238 |
|
239 |
|
240 |
|
241 |
|
242 | scopeName?: string;
|
243 | |
244 |
|
245 |
|
246 | watchPrimary?: boolean;
|
247 | }
|
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 | export declare class CollectionQueryIndexManager {
|
255 | private _bucketName;
|
256 | private _collectionName;
|
257 | private _manager;
|
258 | private _scopeName;
|
259 | |
260 |
|
261 |
|
262 | constructor(collection: Collection);
|
263 | /**
|
264 | * Creates a new query index.
|
265 | *
|
266 | * @param indexName The name of the new index.
|
267 | * @param keys The keys which this index should cover.
|
268 | * @param options Optional parameters for this operation.
|
269 | * @param callback A node-style callback to be invoked after execution.
|
270 | */
|
271 | createIndex(indexName: string, keys: string[], options?: CreateQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
272 | /**
|
273 | * Creates a new primary query index.
|
274 | *
|
275 | * @param options Optional parameters for this operation.
|
276 | * @param callback A node-style callback to be invoked after execution.
|
277 | */
|
278 | createPrimaryIndex(options?: CreatePrimaryQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
279 | /**
|
280 | * Drops an existing query index.
|
281 | *
|
282 | * @param indexName The name of the index to drop.
|
283 | * @param options Optional parameters for this operation.
|
284 | * @param callback A node-style callback to be invoked after execution.
|
285 | */
|
286 | dropIndex(indexName: string, options?: DropQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
287 | /**
|
288 | * Drops an existing primary index.
|
289 | *
|
290 | * @param options Optional parameters for this operation.
|
291 | * @param callback A node-style callback to be invoked after execution.
|
292 | */
|
293 | dropPrimaryIndex(options?: DropPrimaryQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
294 | /**
|
295 | * Returns a list of indexes for a specific bucket.
|
296 | *
|
297 | * @param options Optional parameters for this operation.
|
298 | * @param callback A node-style callback to be invoked after execution.
|
299 | */
|
300 | getAllIndexes(options?: GetAllQueryIndexesOptions, callback?: NodeCallback<QueryIndex[]>): Promise<QueryIndex[]>;
|
301 | /**
|
302 | * Starts building any indexes which were previously created with deferred=true.
|
303 | *
|
304 | * @param options Optional parameters for this operation.
|
305 | * @param callback A node-style callback to be invoked after execution.
|
306 | */
|
307 | buildDeferredIndexes(options?: BuildQueryIndexOptions, callback?: NodeCallback<string[]>): Promise<string[]>;
|
308 | /**
|
309 | * Waits for a number of indexes to finish creation and be ready to use.
|
310 | *
|
311 | * @param indexNames The names of the indexes to watch.
|
312 | * @param timeout The maximum time to wait for the index, expressed in milliseconds.
|
313 | * @param options Optional parameters for this operation.
|
314 | * @param callback A node-style callback to be invoked after execution.
|
315 | */
|
316 | watchIndexes(indexNames: string[], timeout: number, options?: WatchQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
317 | }
|
318 | /**
|
319 | * QueryIndexManager provides an interface for managing the
|
320 | * query indexes on the cluster.
|
321 | *
|
322 | * @category Management
|
323 | */
|
324 | export declare class QueryIndexManager {
|
325 | private _manager;
|
326 | |
327 |
|
328 |
|
329 | constructor(cluster: Cluster);
|
330 | /**
|
331 | * Creates a new query index.
|
332 | *
|
333 | * @param bucketName The name of the bucket this index is for.
|
334 | * @param indexName The name of the new index.
|
335 | * @param keys The keys which this index should cover.
|
336 | * @param options Optional parameters for this operation.
|
337 | * @param callback A node-style callback to be invoked after execution.
|
338 | */
|
339 | createIndex(bucketName: string, indexName: string, keys: string[], options?: CreateQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
340 | /**
|
341 | * Creates a new primary query index.
|
342 | *
|
343 | * @param bucketName The name of the bucket this index is for.
|
344 | * @param options Optional parameters for this operation.
|
345 | * @param callback A node-style callback to be invoked after execution.
|
346 | */
|
347 | createPrimaryIndex(bucketName: string, options?: CreatePrimaryQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
348 | /**
|
349 | * Drops an existing query index.
|
350 | *
|
351 | * @param bucketName The name of the bucket containing the index to drop.
|
352 | * @param indexName The name of the index to drop.
|
353 | * @param options Optional parameters for this operation.
|
354 | * @param callback A node-style callback to be invoked after execution.
|
355 | */
|
356 | dropIndex(bucketName: string, indexName: string, options?: DropQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
357 | /**
|
358 | * Drops an existing primary index.
|
359 | *
|
360 | * @param bucketName The name of the bucket containing the primary index to drop.
|
361 | * @param options Optional parameters for this operation.
|
362 | * @param callback A node-style callback to be invoked after execution.
|
363 | */
|
364 | dropPrimaryIndex(bucketName: string, options?: DropPrimaryQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
365 | /**
|
366 | * Returns a list of indexes for a specific bucket.
|
367 | *
|
368 | * @param bucketName The name of the bucket to fetch indexes for.
|
369 | * @param options Optional parameters for this operation.
|
370 | * @param callback A node-style callback to be invoked after execution.
|
371 | */
|
372 | getAllIndexes(bucketName: string, options?: GetAllQueryIndexesOptions, callback?: NodeCallback<QueryIndex[]>): Promise<QueryIndex[]>;
|
373 | /**
|
374 | * Starts building any indexes which were previously created with deferred=true.
|
375 | *
|
376 | * @param bucketName The name of the bucket to perform the build on.
|
377 | * @param options Optional parameters for this operation.
|
378 | * @param callback A node-style callback to be invoked after execution.
|
379 | */
|
380 | buildDeferredIndexes(bucketName: string, options?: BuildQueryIndexOptions, callback?: NodeCallback<string[]>): Promise<string[]>;
|
381 | /**
|
382 | * Waits for a number of indexes to finish creation and be ready to use.
|
383 | *
|
384 | * @param bucketName The name of the bucket to watch for indexes on.
|
385 | * @param indexNames The names of the indexes to watch.
|
386 | * @param timeout The maximum time to wait for the index, expressed in milliseconds.
|
387 | * @param options Optional parameters for this operation.
|
388 | * @param callback A node-style callback to be invoked after execution.
|
389 | */
|
390 | watchIndexes(bucketName: string, indexNames: string[], timeout: number, options?: WatchQueryIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
391 | }
|