1 | import { CppTopologyCollectionsManifestCollection, CppTopologyCollectionsManifestScope } from './binding';
|
2 | import { Bucket } from './bucket';
|
3 | import { NodeCallback } from './utilities';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export interface ICollectionSpec {
|
10 | |
11 |
|
12 |
|
13 | name: string;
|
14 | |
15 |
|
16 |
|
17 | scopeName: string;
|
18 | |
19 |
|
20 |
|
21 |
|
22 |
|
23 | maxExpiry?: number;
|
24 | |
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 | history?: boolean;
|
31 | }
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | export declare class CollectionSpec {
|
38 | |
39 |
|
40 |
|
41 | name: string;
|
42 | |
43 |
|
44 |
|
45 | scopeName: string;
|
46 | |
47 |
|
48 |
|
49 |
|
50 |
|
51 | maxExpiry: number;
|
52 | |
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 | history?: boolean;
|
59 | |
60 |
|
61 |
|
62 | constructor(data: CollectionSpec);
|
63 | /**
|
64 | * @internal
|
65 | */
|
66 | static _fromCppData(scopeName: string, data: CppTopologyCollectionsManifestCollection): CollectionSpec;
|
67 | }
|
68 | /**
|
69 | * Contains information about a scope.
|
70 | *
|
71 | * @category Management
|
72 | */
|
73 | export declare class ScopeSpec {
|
74 | |
75 |
|
76 |
|
77 | name: string;
|
78 | |
79 |
|
80 |
|
81 | collections: CollectionSpec[];
|
82 | |
83 |
|
84 |
|
85 | constructor(data: ScopeSpec);
|
86 | /**
|
87 | * @internal
|
88 | */
|
89 | static _fromCppData(data: CppTopologyCollectionsManifestScope): ScopeSpec;
|
90 | }
|
91 | /**
|
92 | * The settings to use when creating the collection.
|
93 | *
|
94 | * @category Management
|
95 | */
|
96 | export interface CreateCollectionSettings {
|
97 | |
98 |
|
99 |
|
100 |
|
101 |
|
102 | maxExpiry?: number;
|
103 | |
104 |
|
105 |
|
106 |
|
107 |
|
108 |
|
109 | history?: boolean;
|
110 | }
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 | export interface UpdateCollectionSettings {
|
117 | |
118 |
|
119 |
|
120 |
|
121 |
|
122 | maxExpiry?: number;
|
123 | |
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 | history?: boolean;
|
130 | }
|
131 |
|
132 |
|
133 |
|
134 | export interface CreateCollectionOptions {
|
135 | |
136 |
|
137 |
|
138 | timeout?: number;
|
139 | }
|
140 |
|
141 |
|
142 |
|
143 | export interface GetAllScopesOptions {
|
144 | |
145 |
|
146 |
|
147 | timeout?: number;
|
148 | }
|
149 |
|
150 |
|
151 |
|
152 | export interface DropCollectionOptions {
|
153 | |
154 |
|
155 |
|
156 | timeout?: number;
|
157 | }
|
158 |
|
159 |
|
160 |
|
161 | export interface CreateScopeOptions {
|
162 | |
163 |
|
164 |
|
165 | timeout?: number;
|
166 | }
|
167 |
|
168 |
|
169 |
|
170 | export interface DropScopeOptions {
|
171 | |
172 |
|
173 |
|
174 | timeout?: number;
|
175 | }
|
176 |
|
177 |
|
178 |
|
179 | export interface UpdateCollectionOptions {
|
180 | |
181 |
|
182 |
|
183 | timeout?: number;
|
184 | }
|
185 |
|
186 |
|
187 |
|
188 |
|
189 |
|
190 | export declare class CollectionManager {
|
191 | private _bucket;
|
192 | |
193 |
|
194 |
|
195 | constructor(bucket: Bucket);
|
196 | private get _cluster();
|
197 | /**
|
198 | * Returns all configured scopes along with their collections.
|
199 | *
|
200 | * @param options Optional parameters for this operation.
|
201 | * @param callback A node-style callback to be invoked after execution.
|
202 | */
|
203 | getAllScopes(options?: GetAllScopesOptions, callback?: NodeCallback<ScopeSpec[]>): Promise<ScopeSpec[]>;
|
204 | /**
|
205 | * Creates a collection in a scope.
|
206 | *
|
207 | * @param collectionSpec Specifies the settings for the new collection.
|
208 | * @param options Optional parameters for this operation.
|
209 | * @param callback A node-style callback to be invoked after execution.
|
210 | * @deprecated Use the other overload instead.
|
211 | */
|
212 | createCollection(collectionSpec: ICollectionSpec, options?: CreateCollectionOptions, callback?: NodeCallback<void>): Promise<void>;
|
213 | /**
|
214 | * Creates a collection in a scope.
|
215 | */
|
216 | createCollection(collectionName: string, scopeName: string, options?: CreateCollectionOptions, callback?: NodeCallback<void>): Promise<void>;
|
217 | /**
|
218 | * Creates a collection in a scope.
|
219 | *
|
220 | * @param collectionName The name of the collection.
|
221 | * @param scopeName The name of the scope containing this collection.
|
222 | * @param settings The settings to use on creating the collection.
|
223 | * @param options Optional parameters for this operation.
|
224 | * @param callback A node-style callback to be invoked after execution.
|
225 | */
|
226 | createCollection(collectionName: string, scopeName: string, settings?: CreateCollectionSettings, options?: CreateCollectionOptions, callback?: NodeCallback<void>): Promise<void>;
|
227 | /**
|
228 | * Drops a collection from a scope.
|
229 | *
|
230 | * @param collectionName The name of the collection to drop.
|
231 | * @param scopeName The name of the scope containing the collection to drop.
|
232 | * @param options Optional parameters for this operation.
|
233 | * @param callback A node-style callback to be invoked after execution.
|
234 | */
|
235 | dropCollection(collectionName: string, scopeName: string, options?: DropCollectionOptions, callback?: NodeCallback<void>): Promise<void>;
|
236 | /**
|
237 | * Updates a collection in a scope.
|
238 | *
|
239 | * @param collectionName The name of the collection to update.
|
240 | * @param scopeName The name of the scope containing the collection.
|
241 | * @param settings The settings to update on the collection.
|
242 | * @param options Optional parameters for this operation.
|
243 | * @param callback A node-style callback to be invoked after execution.
|
244 | */
|
245 | updateCollection(collectionName: string, scopeName: string, settings: UpdateCollectionSettings, options?: UpdateCollectionOptions, callback?: NodeCallback<void>): Promise<void>;
|
246 | /**
|
247 | * Creates a new scope.
|
248 | *
|
249 | * @param scopeName The name of the new scope to create.
|
250 | * @param options Optional parameters for this operation.
|
251 | * @param callback A node-style callback to be invoked after execution.
|
252 | */
|
253 | createScope(scopeName: string, options?: CreateScopeOptions, callback?: NodeCallback<void>): Promise<void>;
|
254 | /**
|
255 | * Drops a scope.
|
256 | *
|
257 | * @param scopeName The name of the scope to drop.
|
258 | * @param options Optional parameters for this operation.
|
259 | * @param callback A node-style callback to be invoked after execution.
|
260 | */
|
261 | dropScope(scopeName: string, options?: DropScopeOptions, callback?: NodeCallback<void>): Promise<void>;
|
262 | }
|