@zilliz/milvus2-sdk-node 1.0.17 → 1.1.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/README.md +1 -1
- package/dist/grpc-proto/common.proto +35 -0
- package/dist/grpc-proto/milvus.proto +315 -52
- package/dist/milvus/Client.d.ts +2 -0
- package/dist/milvus/Client.js +11 -0
- package/dist/milvus/Client.js.map +1 -1
- package/dist/milvus/Collection.d.ts +114 -4
- package/dist/milvus/Collection.js +267 -19
- package/dist/milvus/Collection.js.map +1 -1
- package/dist/milvus/Data.d.ts +141 -6
- package/dist/milvus/Data.js +304 -21
- package/dist/milvus/Data.js.map +1 -1
- package/dist/milvus/MilvusIndex.js +15 -3
- package/dist/milvus/MilvusIndex.js.map +1 -1
- package/dist/milvus/Partition.js +28 -7
- package/dist/milvus/Partition.js.map +1 -1
- package/dist/milvus/Utils.d.ts +1 -0
- package/dist/milvus/Utils.js +8 -0
- package/dist/milvus/Utils.js.map +1 -0
- package/dist/milvus/const/ErrorReason.d.ts +18 -3
- package/dist/milvus/const/ErrorReason.js +17 -2
- package/dist/milvus/const/ErrorReason.js.map +1 -1
- package/dist/milvus/index.d.ts +12 -1
- package/dist/milvus/index.js +77 -4
- package/dist/milvus/index.js.map +1 -1
- package/dist/milvus/types/Collection.d.ts +27 -10
- package/dist/milvus/types/Common.d.ts +13 -0
- package/dist/milvus/types/Common.js +16 -1
- package/dist/milvus/types/Common.js.map +1 -1
- package/dist/milvus/types/Data.d.ts +42 -0
- package/dist/milvus/types/{Insert.js → Data.js} +1 -1
- package/dist/milvus/types/Data.js.map +1 -0
- package/dist/milvus/types/Response.d.ts +47 -7
- package/dist/milvus/types/Response.js +1 -1
- package/dist/milvus/types/Response.js.map +1 -1
- package/dist/milvus/types/Search.d.ts +4 -3
- package/dist/milvus/types.d.ts +3 -3
- package/dist/milvus/utils/Format.d.ts +76 -0
- package/dist/milvus/utils/Format.js +126 -3
- package/dist/milvus/utils/Format.js.map +1 -1
- package/dist/milvus/utils/Validate.js +9 -1
- package/dist/milvus/utils/Validate.js.map +1 -1
- package/dist/milvus/utils/index.d.ts +1 -0
- package/dist/milvus/utils/index.js +5 -1
- package/dist/milvus/utils/index.js.map +1 -1
- package/dist/sdk.json +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +4 -2
- package/dist/utils/index.js.map +1 -1
- package/package.json +7 -4
- package/dist/milvus/types/Insert.d.ts +0 -18
- package/dist/milvus/types/Insert.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CreateCollectionReq, DescribeCollectionReq, DropCollectionReq, GetCollectionStatisticsReq, LoadCollectionReq, ReleaseLoadCollectionReq, ShowCollectionsReq, HasCollectionReq } from "./types/Collection";
|
|
2
|
-
import { BoolResponse, DescribeCollectionResponse, ResStatus, ShowCollectionsResponse, StatisticsResponse } from "./types/Response";
|
|
1
|
+
import { CreateCollectionReq, DescribeCollectionReq, DropCollectionReq, GetCollectionStatisticsReq, LoadCollectionReq, ReleaseLoadCollectionReq, ShowCollectionsReq, HasCollectionReq, CreateAliasReq, DropAliasReq, AlterAliasReq, CompactReq, GetCompactionStateReq, GetCompactionPlansReq } from "./types/Collection";
|
|
2
|
+
import { BoolResponse, CompactionResponse, DescribeCollectionResponse, GetCompactionPlansResponse, GetCompactionStateResponse, ResStatus, ShowCollectionsResponse, StatisticsResponse } from "./types/Response";
|
|
3
3
|
import { Client } from "./Client";
|
|
4
4
|
/**
|
|
5
5
|
* See all [collection operation examples](https://github.com/milvus-io/milvus-sdk-node/blob/main/example/Collection.ts).
|
|
@@ -11,7 +11,7 @@ export declare class Collection extends Client {
|
|
|
11
11
|
* @param data
|
|
12
12
|
* | Property | Type | Description |
|
|
13
13
|
* | :---------------------- | :---- | :------------------------------- |
|
|
14
|
-
* |
|
|
14
|
+
* | collection_name | String | Collection name |
|
|
15
15
|
* | description | String | Collection description |
|
|
16
16
|
* | fields | <a href="https://github.com/milvus-io/milvus-sdk-node/blob/main/milvus/types/Collection.ts#L8" target="_blank">FieldType</a> | Field data |
|
|
17
17
|
*
|
|
@@ -145,7 +145,8 @@ export declare class Collection extends Client {
|
|
|
145
145
|
*/
|
|
146
146
|
getCollectionStatistics(data: GetCollectionStatisticsReq): Promise<StatisticsResponse>;
|
|
147
147
|
/**
|
|
148
|
-
* Load collection
|
|
148
|
+
* Load collection data into query nodes, then you can do vector search on this collection.
|
|
149
|
+
* It's async function, but we can use showCollections to check loading status.
|
|
149
150
|
*
|
|
150
151
|
* @param data
|
|
151
152
|
* | Property | Type | Description |
|
|
@@ -167,6 +168,30 @@ export declare class Collection extends Client {
|
|
|
167
168
|
* ```
|
|
168
169
|
*/
|
|
169
170
|
loadCollection(data: LoadCollectionReq): Promise<ResStatus>;
|
|
171
|
+
/**
|
|
172
|
+
* Same function with loadCollection, but it's sync function.
|
|
173
|
+
* Help to ensure this collection is loaded.
|
|
174
|
+
*
|
|
175
|
+
* @param data
|
|
176
|
+
* | Property | Type | Description |
|
|
177
|
+
* | :----------------- | :---- | :------------------------------- |
|
|
178
|
+
* | collection_name | String | Collection name |
|
|
179
|
+
*
|
|
180
|
+
* @return
|
|
181
|
+
* | Property | Description |
|
|
182
|
+
* | :-------------| :-------- |
|
|
183
|
+
* | error_code | Error code number |
|
|
184
|
+
* | reason | Error cause| *
|
|
185
|
+
*
|
|
186
|
+
* #### Example
|
|
187
|
+
*
|
|
188
|
+
* ```
|
|
189
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.loadCollectionSync({
|
|
190
|
+
* collection_name: 'my_collection',
|
|
191
|
+
* });
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
loadCollectionSync(data: LoadCollectionReq): Promise<ResStatus>;
|
|
170
195
|
/**
|
|
171
196
|
* Release a collection from cache to reduce cache usage.
|
|
172
197
|
* Note that you cannot search while the corresponding collection is unloaded.
|
|
@@ -214,4 +239,89 @@ export declare class Collection extends Client {
|
|
|
214
239
|
* ```
|
|
215
240
|
*/
|
|
216
241
|
dropCollection(data: DropCollectionReq): Promise<ResStatus>;
|
|
242
|
+
/**
|
|
243
|
+
* @ignore
|
|
244
|
+
* Create collection alias, then you can use alias instead of collection_name when you do vector search
|
|
245
|
+
* @param data
|
|
246
|
+
*/
|
|
247
|
+
createAlias(data: CreateAliasReq): Promise<ResStatus>;
|
|
248
|
+
/**
|
|
249
|
+
* @ignore
|
|
250
|
+
* @param data
|
|
251
|
+
*/
|
|
252
|
+
dropAlias(data: DropAliasReq): Promise<ResStatus>;
|
|
253
|
+
/**
|
|
254
|
+
* @ignore
|
|
255
|
+
* @param data
|
|
256
|
+
*/
|
|
257
|
+
alterAlias(data: AlterAliasReq): Promise<ResStatus>;
|
|
258
|
+
/**
|
|
259
|
+
* Do compaction for the collection.
|
|
260
|
+
*
|
|
261
|
+
* @param data
|
|
262
|
+
* | Property | Type | Description |
|
|
263
|
+
* | :----------------- | :---- | :------------------------------- |
|
|
264
|
+
* | collection_name | String | The collection name to compact |
|
|
265
|
+
*
|
|
266
|
+
* @return
|
|
267
|
+
* | Property | Description |
|
|
268
|
+
* | :-------------| :-------- |
|
|
269
|
+
* | status | { error_code: number, reason: string }|
|
|
270
|
+
* | compactionID | compaction ID |
|
|
271
|
+
*
|
|
272
|
+
* #### Example
|
|
273
|
+
*
|
|
274
|
+
* ```
|
|
275
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.compact({
|
|
276
|
+
* collection_name: 'my_collection',
|
|
277
|
+
* });
|
|
278
|
+
* ```
|
|
279
|
+
*/
|
|
280
|
+
compact(data: CompactReq): Promise<CompactionResponse>;
|
|
281
|
+
/**
|
|
282
|
+
* Get compaction states of a targeted compaction id
|
|
283
|
+
*
|
|
284
|
+
* @param data
|
|
285
|
+
* | Property | Type | Description |
|
|
286
|
+
* | :----------------- | :---- | :------------------------------- |
|
|
287
|
+
* | compactionID | number or string | the id returned by compact |
|
|
288
|
+
*
|
|
289
|
+
* @return
|
|
290
|
+
* | Property | Description |
|
|
291
|
+
* | :-------------| :-------- |
|
|
292
|
+
* | status | { error_code: number, reason: string }|
|
|
293
|
+
* | state | the state of the compaction |
|
|
294
|
+
*
|
|
295
|
+
* #### Example
|
|
296
|
+
*
|
|
297
|
+
* ```
|
|
298
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.getCompactionState({
|
|
299
|
+
* compactionID: compactionID,
|
|
300
|
+
* });
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
getCompactionState(data: GetCompactionStateReq): Promise<GetCompactionStateResponse>;
|
|
304
|
+
/**
|
|
305
|
+
* Get compaction states of a targeted compaction id
|
|
306
|
+
*
|
|
307
|
+
* @param data
|
|
308
|
+
* | Property | Type | Description |
|
|
309
|
+
* | :----------------- | :---- | :------------------------------- |
|
|
310
|
+
* | compactionID | number or string | the id returned by compact |
|
|
311
|
+
*
|
|
312
|
+
* @return
|
|
313
|
+
* | Property | Description |
|
|
314
|
+
* | :-------------| :-------- |
|
|
315
|
+
* | status | { error_code: number, reason: string }|
|
|
316
|
+
* | state | the state of the compaction |
|
|
317
|
+
*
|
|
318
|
+
* #### Example
|
|
319
|
+
*
|
|
320
|
+
* ```
|
|
321
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.getCompactionStateWithPlans({
|
|
322
|
+
* compactionID: compactionID,
|
|
323
|
+
* });
|
|
324
|
+
* ```
|
|
325
|
+
*/
|
|
326
|
+
getCompactionStateWithPlans(data: GetCompactionPlansReq): Promise<GetCompactionPlansResponse>;
|
|
217
327
|
}
|
|
@@ -70,6 +70,7 @@ var protobufjs_1 = __importDefault(require("protobufjs"));
|
|
|
70
70
|
var utils_1 = require("../utils");
|
|
71
71
|
var ErrorReason_1 = require("./const/ErrorReason");
|
|
72
72
|
var Collection_1 = require("./types/Collection");
|
|
73
|
+
var Response_1 = require("./types/Response");
|
|
73
74
|
var Validate_1 = require("./utils/Validate");
|
|
74
75
|
var path_1 = __importDefault(require("path"));
|
|
75
76
|
var Format_1 = require("./utils/Format");
|
|
@@ -89,7 +90,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
89
90
|
* @param data
|
|
90
91
|
* | Property | Type | Description |
|
|
91
92
|
* | :---------------------- | :---- | :------------------------------- |
|
|
92
|
-
* |
|
|
93
|
+
* | collection_name | String | Collection name |
|
|
93
94
|
* | description | String | Collection description |
|
|
94
95
|
* | fields | <a href="https://github.com/milvus-io/milvus-sdk-node/blob/main/milvus/types/Collection.ts#L8" target="_blank">FieldType</a> | Field data |
|
|
95
96
|
*
|
|
@@ -126,20 +127,18 @@ var Collection = /** @class */ (function (_super) {
|
|
|
126
127
|
*/
|
|
127
128
|
Collection.prototype.createCollection = function (data) {
|
|
128
129
|
return __awaiter(this, void 0, void 0, function () {
|
|
129
|
-
var fields, collection_name, description, root, CollectionSchema, FieldSchema, payload, collectionParams, schemaBtyes, promise;
|
|
130
|
-
return __generator(this, function (
|
|
131
|
-
switch (
|
|
130
|
+
var _a, fields, collection_name, description, root, CollectionSchema, FieldSchema, payload, collectionParams, schemaBtyes, promise;
|
|
131
|
+
return __generator(this, function (_b) {
|
|
132
|
+
switch (_b.label) {
|
|
132
133
|
case 0:
|
|
133
|
-
fields =
|
|
134
|
+
_a = data || {}, fields = _a.fields, collection_name = _a.collection_name, description = _a.description;
|
|
134
135
|
if (!fields || !fields.length || !collection_name) {
|
|
135
|
-
throw new Error(ErrorReason_1.ERROR_REASONS.
|
|
136
|
+
throw new Error(ErrorReason_1.ERROR_REASONS.CREATE_COLLECTION_CHECK_PARAMS);
|
|
136
137
|
}
|
|
137
138
|
Validate_1.checkCollectionFields(fields);
|
|
138
139
|
return [4 /*yield*/, protobufjs_1.default.load(schemaPath)];
|
|
139
140
|
case 1:
|
|
140
|
-
root =
|
|
141
|
-
if (!root)
|
|
142
|
-
throw new Error("Missing proto file");
|
|
141
|
+
root = _b.sent();
|
|
143
142
|
CollectionSchema = root.lookupType("milvus.proto.schema.CollectionSchema");
|
|
144
143
|
FieldSchema = root.lookupType("milvus.proto.schema.FieldSchema");
|
|
145
144
|
payload = {
|
|
@@ -156,7 +155,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
156
155
|
schemaBtyes = CollectionSchema.encode(collectionParams).finish();
|
|
157
156
|
return [4 /*yield*/, utils_1.promisify(this.client, "CreateCollection", __assign(__assign({}, data), { schema: schemaBtyes }))];
|
|
158
157
|
case 2:
|
|
159
|
-
promise =
|
|
158
|
+
promise = _b.sent();
|
|
160
159
|
return [2 /*return*/, promise];
|
|
161
160
|
}
|
|
162
161
|
});
|
|
@@ -190,9 +189,7 @@ var Collection = /** @class */ (function (_super) {
|
|
|
190
189
|
return __generator(this, function (_a) {
|
|
191
190
|
switch (_a.label) {
|
|
192
191
|
case 0:
|
|
193
|
-
|
|
194
|
-
throw new Error(ErrorReason_1.ERROR_REASONS.HAS_COLLECTION_CHECK);
|
|
195
|
-
}
|
|
192
|
+
this.checkCollectionName(data);
|
|
196
193
|
return [4 /*yield*/, utils_1.promisify(this.client, "HasCollection", data)];
|
|
197
194
|
case 1:
|
|
198
195
|
promise = _a.sent();
|
|
@@ -279,7 +276,9 @@ var Collection = /** @class */ (function (_super) {
|
|
|
279
276
|
var promise;
|
|
280
277
|
return __generator(this, function (_a) {
|
|
281
278
|
switch (_a.label) {
|
|
282
|
-
case 0:
|
|
279
|
+
case 0:
|
|
280
|
+
this.checkCollectionName(data);
|
|
281
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "DescribeCollection", data)];
|
|
283
282
|
case 1:
|
|
284
283
|
promise = _a.sent();
|
|
285
284
|
return [2 /*return*/, promise];
|
|
@@ -316,7 +315,9 @@ var Collection = /** @class */ (function (_super) {
|
|
|
316
315
|
var promise;
|
|
317
316
|
return __generator(this, function (_a) {
|
|
318
317
|
switch (_a.label) {
|
|
319
|
-
case 0:
|
|
318
|
+
case 0:
|
|
319
|
+
this.checkCollectionName(data);
|
|
320
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "GetCollectionStatistics", data)];
|
|
320
321
|
case 1:
|
|
321
322
|
promise = _a.sent();
|
|
322
323
|
promise.data = Format_1.formatKeyValueData(promise.stats, ["row_count"]);
|
|
@@ -326,7 +327,8 @@ var Collection = /** @class */ (function (_super) {
|
|
|
326
327
|
});
|
|
327
328
|
};
|
|
328
329
|
/**
|
|
329
|
-
* Load collection
|
|
330
|
+
* Load collection data into query nodes, then you can do vector search on this collection.
|
|
331
|
+
* It's async function, but we can use showCollections to check loading status.
|
|
330
332
|
*
|
|
331
333
|
* @param data
|
|
332
334
|
* | Property | Type | Description |
|
|
@@ -352,7 +354,9 @@ var Collection = /** @class */ (function (_super) {
|
|
|
352
354
|
var promise;
|
|
353
355
|
return __generator(this, function (_a) {
|
|
354
356
|
switch (_a.label) {
|
|
355
|
-
case 0:
|
|
357
|
+
case 0:
|
|
358
|
+
this.checkCollectionName(data);
|
|
359
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "LoadCollection", data)];
|
|
356
360
|
case 1:
|
|
357
361
|
promise = _a.sent();
|
|
358
362
|
return [2 /*return*/, promise];
|
|
@@ -360,6 +364,60 @@ var Collection = /** @class */ (function (_super) {
|
|
|
360
364
|
});
|
|
361
365
|
});
|
|
362
366
|
};
|
|
367
|
+
/**
|
|
368
|
+
* Same function with loadCollection, but it's sync function.
|
|
369
|
+
* Help to ensure this collection is loaded.
|
|
370
|
+
*
|
|
371
|
+
* @param data
|
|
372
|
+
* | Property | Type | Description |
|
|
373
|
+
* | :----------------- | :---- | :------------------------------- |
|
|
374
|
+
* | collection_name | String | Collection name |
|
|
375
|
+
*
|
|
376
|
+
* @return
|
|
377
|
+
* | Property | Description |
|
|
378
|
+
* | :-------------| :-------- |
|
|
379
|
+
* | error_code | Error code number |
|
|
380
|
+
* | reason | Error cause| *
|
|
381
|
+
*
|
|
382
|
+
* #### Example
|
|
383
|
+
*
|
|
384
|
+
* ```
|
|
385
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.loadCollectionSync({
|
|
386
|
+
* collection_name: 'my_collection',
|
|
387
|
+
* });
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
390
|
+
Collection.prototype.loadCollectionSync = function (data) {
|
|
391
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
392
|
+
var promise, loadedPercentage, res;
|
|
393
|
+
return __generator(this, function (_a) {
|
|
394
|
+
switch (_a.label) {
|
|
395
|
+
case 0:
|
|
396
|
+
this.checkCollectionName(data);
|
|
397
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "LoadCollection", data)];
|
|
398
|
+
case 1:
|
|
399
|
+
promise = _a.sent();
|
|
400
|
+
loadedPercentage = 0;
|
|
401
|
+
_a.label = 2;
|
|
402
|
+
case 2:
|
|
403
|
+
if (!(Number(loadedPercentage) < 100)) return [3 /*break*/, 4];
|
|
404
|
+
return [4 /*yield*/, this.showCollections({
|
|
405
|
+
collection_names: [data.collection_name],
|
|
406
|
+
type: Collection_1.ShowCollectionsType.Loaded,
|
|
407
|
+
})];
|
|
408
|
+
case 3:
|
|
409
|
+
res = _a.sent();
|
|
410
|
+
if (res.status.error_code !== Response_1.ErrorCode.SUCCESS) {
|
|
411
|
+
throw new Error("ErrorCode: " + res.status.error_code + ". Reason: " + res.status.reason);
|
|
412
|
+
}
|
|
413
|
+
// Because we pass collection_names in showCollections, so it will only this collection in result.
|
|
414
|
+
loadedPercentage = Number(res.data[0].loadedPercentage);
|
|
415
|
+
return [3 /*break*/, 2];
|
|
416
|
+
case 4: return [2 /*return*/, promise];
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
});
|
|
420
|
+
};
|
|
363
421
|
/**
|
|
364
422
|
* Release a collection from cache to reduce cache usage.
|
|
365
423
|
* Note that you cannot search while the corresponding collection is unloaded.
|
|
@@ -388,7 +446,9 @@ var Collection = /** @class */ (function (_super) {
|
|
|
388
446
|
var promise;
|
|
389
447
|
return __generator(this, function (_a) {
|
|
390
448
|
switch (_a.label) {
|
|
391
|
-
case 0:
|
|
449
|
+
case 0:
|
|
450
|
+
this.checkCollectionName(data);
|
|
451
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "ReleaseCollection", data)];
|
|
392
452
|
case 1:
|
|
393
453
|
promise = _a.sent();
|
|
394
454
|
return [2 /*return*/, promise];
|
|
@@ -423,7 +483,75 @@ var Collection = /** @class */ (function (_super) {
|
|
|
423
483
|
var promise;
|
|
424
484
|
return __generator(this, function (_a) {
|
|
425
485
|
switch (_a.label) {
|
|
426
|
-
case 0:
|
|
486
|
+
case 0:
|
|
487
|
+
this.checkCollectionName(data);
|
|
488
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "DropCollection", data)];
|
|
489
|
+
case 1:
|
|
490
|
+
promise = _a.sent();
|
|
491
|
+
return [2 /*return*/, promise];
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
/**
|
|
497
|
+
* @ignore
|
|
498
|
+
* Create collection alias, then you can use alias instead of collection_name when you do vector search
|
|
499
|
+
* @param data
|
|
500
|
+
*/
|
|
501
|
+
Collection.prototype.createAlias = function (data) {
|
|
502
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
503
|
+
var promise;
|
|
504
|
+
return __generator(this, function (_a) {
|
|
505
|
+
switch (_a.label) {
|
|
506
|
+
case 0:
|
|
507
|
+
this.checkCollectionName(data);
|
|
508
|
+
if (!data.alias) {
|
|
509
|
+
throw new Error(ErrorReason_1.ERROR_REASONS.ALIAS_NAME_IS_REQUIRED);
|
|
510
|
+
}
|
|
511
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "CreateAlias", data)];
|
|
512
|
+
case 1:
|
|
513
|
+
promise = _a.sent();
|
|
514
|
+
return [2 /*return*/, promise];
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
});
|
|
518
|
+
};
|
|
519
|
+
/**
|
|
520
|
+
* @ignore
|
|
521
|
+
* @param data
|
|
522
|
+
*/
|
|
523
|
+
Collection.prototype.dropAlias = function (data) {
|
|
524
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
525
|
+
var promise;
|
|
526
|
+
return __generator(this, function (_a) {
|
|
527
|
+
switch (_a.label) {
|
|
528
|
+
case 0:
|
|
529
|
+
if (!data.alias) {
|
|
530
|
+
throw new Error(ErrorReason_1.ERROR_REASONS.ALIAS_NAME_IS_REQUIRED);
|
|
531
|
+
}
|
|
532
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "DropAlias", data)];
|
|
533
|
+
case 1:
|
|
534
|
+
promise = _a.sent();
|
|
535
|
+
return [2 /*return*/, promise];
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
});
|
|
539
|
+
};
|
|
540
|
+
/**
|
|
541
|
+
* @ignore
|
|
542
|
+
* @param data
|
|
543
|
+
*/
|
|
544
|
+
Collection.prototype.alterAlias = function (data) {
|
|
545
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
546
|
+
var promise;
|
|
547
|
+
return __generator(this, function (_a) {
|
|
548
|
+
switch (_a.label) {
|
|
549
|
+
case 0:
|
|
550
|
+
this.checkCollectionName(data);
|
|
551
|
+
if (!data.alias) {
|
|
552
|
+
throw new Error(ErrorReason_1.ERROR_REASONS.ALIAS_NAME_IS_REQUIRED);
|
|
553
|
+
}
|
|
554
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "AlterAlias", data)];
|
|
427
555
|
case 1:
|
|
428
556
|
promise = _a.sent();
|
|
429
557
|
return [2 /*return*/, promise];
|
|
@@ -431,6 +559,126 @@ var Collection = /** @class */ (function (_super) {
|
|
|
431
559
|
});
|
|
432
560
|
});
|
|
433
561
|
};
|
|
562
|
+
/**
|
|
563
|
+
* Do compaction for the collection.
|
|
564
|
+
*
|
|
565
|
+
* @param data
|
|
566
|
+
* | Property | Type | Description |
|
|
567
|
+
* | :----------------- | :---- | :------------------------------- |
|
|
568
|
+
* | collection_name | String | The collection name to compact |
|
|
569
|
+
*
|
|
570
|
+
* @return
|
|
571
|
+
* | Property | Description |
|
|
572
|
+
* | :-------------| :-------- |
|
|
573
|
+
* | status | { error_code: number, reason: string }|
|
|
574
|
+
* | compactionID | compaction ID |
|
|
575
|
+
*
|
|
576
|
+
* #### Example
|
|
577
|
+
*
|
|
578
|
+
* ```
|
|
579
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.compact({
|
|
580
|
+
* collection_name: 'my_collection',
|
|
581
|
+
* });
|
|
582
|
+
* ```
|
|
583
|
+
*/
|
|
584
|
+
Collection.prototype.compact = function (data) {
|
|
585
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
586
|
+
var collectionInfo, res;
|
|
587
|
+
return __generator(this, function (_a) {
|
|
588
|
+
switch (_a.label) {
|
|
589
|
+
case 0:
|
|
590
|
+
this.checkCollectionName(data);
|
|
591
|
+
return [4 /*yield*/, this.describeCollection(data)];
|
|
592
|
+
case 1:
|
|
593
|
+
collectionInfo = _a.sent();
|
|
594
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "ManualCompaction", {
|
|
595
|
+
collectionID: collectionInfo.collectionID,
|
|
596
|
+
})];
|
|
597
|
+
case 2:
|
|
598
|
+
res = _a.sent();
|
|
599
|
+
return [2 /*return*/, res];
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
});
|
|
603
|
+
};
|
|
604
|
+
/**
|
|
605
|
+
* Get compaction states of a targeted compaction id
|
|
606
|
+
*
|
|
607
|
+
* @param data
|
|
608
|
+
* | Property | Type | Description |
|
|
609
|
+
* | :----------------- | :---- | :------------------------------- |
|
|
610
|
+
* | compactionID | number or string | the id returned by compact |
|
|
611
|
+
*
|
|
612
|
+
* @return
|
|
613
|
+
* | Property | Description |
|
|
614
|
+
* | :-------------| :-------- |
|
|
615
|
+
* | status | { error_code: number, reason: string }|
|
|
616
|
+
* | state | the state of the compaction |
|
|
617
|
+
*
|
|
618
|
+
* #### Example
|
|
619
|
+
*
|
|
620
|
+
* ```
|
|
621
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.getCompactionState({
|
|
622
|
+
* compactionID: compactionID,
|
|
623
|
+
* });
|
|
624
|
+
* ```
|
|
625
|
+
*/
|
|
626
|
+
Collection.prototype.getCompactionState = function (data) {
|
|
627
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
628
|
+
var res;
|
|
629
|
+
return __generator(this, function (_a) {
|
|
630
|
+
switch (_a.label) {
|
|
631
|
+
case 0:
|
|
632
|
+
if (!data || !data.compactionID) {
|
|
633
|
+
throw new Error(ErrorReason_1.ERROR_REASONS.COMPACTIONID_IS_REQUIRED);
|
|
634
|
+
}
|
|
635
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "GetCompactionState", data)];
|
|
636
|
+
case 1:
|
|
637
|
+
res = _a.sent();
|
|
638
|
+
return [2 /*return*/, res];
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
});
|
|
642
|
+
};
|
|
643
|
+
/**
|
|
644
|
+
* Get compaction states of a targeted compaction id
|
|
645
|
+
*
|
|
646
|
+
* @param data
|
|
647
|
+
* | Property | Type | Description |
|
|
648
|
+
* | :----------------- | :---- | :------------------------------- |
|
|
649
|
+
* | compactionID | number or string | the id returned by compact |
|
|
650
|
+
*
|
|
651
|
+
* @return
|
|
652
|
+
* | Property | Description |
|
|
653
|
+
* | :-------------| :-------- |
|
|
654
|
+
* | status | { error_code: number, reason: string }|
|
|
655
|
+
* | state | the state of the compaction |
|
|
656
|
+
*
|
|
657
|
+
* #### Example
|
|
658
|
+
*
|
|
659
|
+
* ```
|
|
660
|
+
* new milvusClient(MILUVS_ADDRESS).collectionManager.getCompactionStateWithPlans({
|
|
661
|
+
* compactionID: compactionID,
|
|
662
|
+
* });
|
|
663
|
+
* ```
|
|
664
|
+
*/
|
|
665
|
+
Collection.prototype.getCompactionStateWithPlans = function (data) {
|
|
666
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
667
|
+
var res;
|
|
668
|
+
return __generator(this, function (_a) {
|
|
669
|
+
switch (_a.label) {
|
|
670
|
+
case 0:
|
|
671
|
+
if (!data || !data.compactionID) {
|
|
672
|
+
throw new Error(ErrorReason_1.ERROR_REASONS.COMPACTIONID_IS_REQUIRED);
|
|
673
|
+
}
|
|
674
|
+
return [4 /*yield*/, utils_1.promisify(this.client, "GetCompactionStateWithPlans", data)];
|
|
675
|
+
case 1:
|
|
676
|
+
res = _a.sent();
|
|
677
|
+
return [2 /*return*/, res];
|
|
678
|
+
}
|
|
679
|
+
});
|
|
680
|
+
});
|
|
681
|
+
};
|
|
434
682
|
return Collection;
|
|
435
683
|
}(Client_1.Client));
|
|
436
684
|
exports.Collection = Collection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Collection.js","sourceRoot":"","sources":["../../milvus/Collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAkC;AAClC,kCAAqC;AACrC,mDAAoD;AACpD,
|
|
1
|
+
{"version":3,"file":"Collection.js","sourceRoot":"","sources":["../../milvus/Collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAAkC;AAClC,kCAAqC;AACrC,mDAAoD;AACpD,iDAgB4B;AAC5B,6CAW0B;AAC1B,6CAAyD;AACzD,8CAAwB;AACxB,yCAAqE;AACrE,mCAAkC;AAElC,IAAM,UAAU,GAAG,cAAI,CAAC,OAAO,CAAC,SAAS,EAAE,4BAA4B,CAAC,CAAC;AAEzE;;GAEG;AACH;IAAgC,8BAAM;IAAtC;;IAqfA,CAAC;IApfC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;IACG,qCAAgB,GAAtB,UAAuB,IAAyB;;;;;;wBACxC,KAA2C,IAAI,IAAI,EAAE,EAAnD,MAAM,YAAA,EAAE,eAAe,qBAAA,EAAE,WAAW,iBAAA,CAAgB;wBAC5D,IAAI,CAAC,MAAM,IAAI,CAAC,MA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