@zilliz/milvus2-sdk-node 2.2.3 → 2.2.5
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 +4 -21
- package/dist/milvus/BaseClient.d.ts +17 -0
- package/dist/milvus/BaseClient.js +58 -0
- package/dist/milvus/BaseClient.js.map +1 -0
- package/dist/milvus/Collection.d.ts +263 -171
- package/dist/milvus/Collection.js +328 -233
- package/dist/milvus/Collection.js.map +1 -1
- package/dist/milvus/Data.d.ts +142 -142
- package/dist/milvus/Data.js +211 -216
- package/dist/milvus/Data.js.map +1 -1
- package/dist/milvus/MilvusClient.d.ts +17 -0
- package/dist/milvus/MilvusClient.js +163 -0
- package/dist/milvus/MilvusClient.js.map +1 -0
- package/dist/milvus/MilvusIndex.d.ts +64 -60
- package/dist/milvus/MilvusIndex.js +74 -69
- package/dist/milvus/MilvusIndex.js.map +1 -1
- package/dist/milvus/Partition.d.ts +95 -88
- package/dist/milvus/Partition.js +108 -101
- package/dist/milvus/Partition.js.map +1 -1
- package/dist/milvus/Resource.d.ts +172 -0
- package/dist/milvus/Resource.js +356 -0
- package/dist/milvus/Resource.js.map +1 -0
- package/dist/milvus/User.d.ts +136 -110
- package/dist/milvus/User.js +171 -140
- package/dist/milvus/User.js.map +1 -1
- package/dist/milvus/Utils.d.ts +1 -1
- package/dist/milvus/Utils.js +1 -1
- package/dist/milvus/Utils.js.map +1 -1
- package/dist/milvus/const/Milvus.d.ts +270 -0
- package/dist/milvus/const/Milvus.js +370 -1
- package/dist/milvus/const/Milvus.js.map +1 -1
- package/dist/milvus/index.d.ts +11 -46
- package/dist/milvus/index.js +16 -186
- package/dist/milvus/index.js.map +1 -1
- package/dist/milvus/types/Collection.d.ts +88 -8
- package/dist/milvus/types/Collection.js +1 -9
- package/dist/milvus/types/Collection.js.map +1 -1
- package/dist/milvus/types/Common.d.ts +11 -267
- package/dist/milvus/types/Common.js +1 -369
- package/dist/milvus/types/Common.js.map +1 -1
- package/dist/milvus/types/Data.d.ts +154 -1
- package/dist/milvus/types/Index.d.ts +20 -1
- package/dist/milvus/types/Partition.d.ts +8 -1
- package/dist/milvus/types/Resource.d.ts +44 -0
- package/dist/milvus/types/{Search.js → Resource.js} +1 -1
- package/dist/milvus/types/Resource.js.map +1 -0
- package/dist/milvus/types/Response.d.ts +0 -246
- package/dist/milvus/types/Response.js.map +1 -1
- package/dist/milvus/types/User.d.ts +54 -2
- package/dist/milvus/types.d.ts +8 -7
- package/dist/milvus/types.js +2 -1
- package/dist/milvus/types.js.map +1 -1
- package/dist/proto/proto/common.proto +23 -2
- package/dist/proto/proto/feder.proto +40 -0
- package/dist/proto/proto/google/protobuf/descriptor.proto +31 -1
- package/dist/proto/proto/milvus.proto +101 -0
- package/dist/proto/proto/msg.proto +107 -0
- package/dist/proto/proto/schema.proto +18 -23
- package/dist/sdk.json +1 -1
- package/dist/utils/Blob.js.map +1 -0
- package/dist/{milvus/utils → utils}/Format.d.ts +12 -11
- package/dist/{milvus/utils → utils}/Format.js +18 -17
- package/dist/utils/Format.js.map +1 -0
- package/dist/utils/Function.d.ts +4 -0
- package/dist/utils/Function.js +33 -0
- package/dist/utils/Function.js.map +1 -0
- package/dist/utils/Grpc.d.ts +19 -0
- package/dist/utils/Grpc.js +64 -0
- package/dist/utils/Grpc.js.map +1 -0
- package/dist/utils/Validate.d.ts +21 -0
- package/dist/{milvus/utils → utils}/Validate.js +28 -6
- package/dist/utils/Validate.js.map +1 -0
- package/dist/utils/index.d.ts +5 -7
- package/dist/utils/index.js +17 -52
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/test.d.ts +14 -0
- package/dist/utils/test.js +68 -0
- package/dist/utils/test.js.map +1 -0
- package/package.json +7 -12
- package/dist/milvus/Client.d.ts +0 -12
- package/dist/milvus/Client.js +0 -28
- package/dist/milvus/Client.js.map +0 -1
- package/dist/milvus/types/Search.d.ts +0 -81
- package/dist/milvus/types/Search.js.map +0 -1
- package/dist/milvus/utils/Blob.js.map +0 -1
- package/dist/milvus/utils/Format.js.map +0 -1
- package/dist/milvus/utils/Validate.d.ts +0 -9
- package/dist/milvus/utils/Validate.js.map +0 -1
- package/dist/milvus/utils/index.d.ts +0 -3
- package/dist/milvus/utils/index.js +0 -10
- package/dist/milvus/utils/index.js.map +0 -1
- /package/dist/{milvus/utils → utils}/Blob.d.ts +0 -0
- /package/dist/{milvus/utils → utils}/Blob.js +0 -0
|
@@ -40,7 +40,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
40
40
|
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
41
41
|
function step(op) {
|
|
42
42
|
if (f) throw new TypeError("Generator is already executing.");
|
|
43
|
-
while (_) try {
|
|
43
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
44
44
|
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
45
45
|
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
46
46
|
switch (op[0]) {
|
|
@@ -61,53 +61,41 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
61
61
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
65
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
66
|
-
};
|
|
67
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
68
65
|
exports.Collection = void 0;
|
|
69
|
-
var protobufjs_1 = __importDefault(require("protobufjs"));
|
|
70
66
|
var utils_1 = require("../utils");
|
|
71
|
-
var
|
|
72
|
-
var
|
|
73
|
-
var Response_1 = require("./types/Response");
|
|
74
|
-
var Validate_1 = require("./utils/Validate");
|
|
75
|
-
var path_1 = __importDefault(require("path"));
|
|
76
|
-
var Format_1 = require("./utils/Format");
|
|
77
|
-
var Client_1 = require("./Client");
|
|
78
|
-
var schemaPath = path_1.default.resolve(__dirname, '../proto/proto/schema.proto');
|
|
67
|
+
var BaseClient_1 = require("./BaseClient");
|
|
68
|
+
var _1 = require(".");
|
|
79
69
|
/**
|
|
80
|
-
*
|
|
70
|
+
* @see [collection operation examples](https://github.com/milvus-io/milvus-sdk-node/blob/main/example/Collection.ts)
|
|
81
71
|
*/
|
|
82
72
|
var Collection = /** @class */ (function (_super) {
|
|
83
73
|
__extends(Collection, _super);
|
|
84
|
-
function Collection(
|
|
85
|
-
|
|
86
|
-
_this._protoRoot = protobufjs_1.default.loadSync(schemaPath);
|
|
87
|
-
return _this;
|
|
74
|
+
function Collection() {
|
|
75
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
88
76
|
}
|
|
89
77
|
/**
|
|
90
78
|
* Create a collection in Milvus.
|
|
91
79
|
*
|
|
92
80
|
* @param data
|
|
93
|
-
* | Property
|
|
94
|
-
* |
|
|
95
|
-
* | collection_name
|
|
96
|
-
* | description
|
|
97
|
-
* | consistency_level
|
|
98
|
-
* | fields
|
|
99
|
-
* | timeout
|
|
100
|
-
*
|
|
101
|
-
* @
|
|
81
|
+
* | Property | Type | Description |
|
|
82
|
+
* | :-- | :-- | :-- |
|
|
83
|
+
* | collection_name | String | Collection name |
|
|
84
|
+
* | description | String | Collection description |
|
|
85
|
+
* | consistency_level | String | "Strong"(Milvus default) | "Session" | "Bounded"| "Eventually" | "Customized"; |
|
|
86
|
+
* | fields | <a href="https://github.com/milvus-io/milvus-sdk-node/blob/main/milvus/types/Collection.ts#L8" target="_blank">FieldType</a> | Field data |
|
|
87
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
88
|
+
*
|
|
89
|
+
* @returns
|
|
102
90
|
* | Property | Description |
|
|
103
|
-
* |
|
|
91
|
+
* | :-- | :-- |
|
|
104
92
|
* | error_code | Error code number |
|
|
105
93
|
* | reason | Error cause |
|
|
106
94
|
*
|
|
107
95
|
* #### Example
|
|
108
96
|
*
|
|
109
97
|
* ```
|
|
110
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
98
|
+
* new milvusClient(MILUVS_ADDRESS).createCollection({
|
|
111
99
|
* collection_name: 'my_collection',
|
|
112
100
|
* fields: [
|
|
113
101
|
* {
|
|
@@ -131,37 +119,34 @@ var Collection = /** @class */ (function (_super) {
|
|
|
131
119
|
*/
|
|
132
120
|
Collection.prototype.createCollection = function (data) {
|
|
133
121
|
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
-
var _a, fields, collection_name, description, _b, consistency_level,
|
|
122
|
+
var _a, fields, collection_name, description, _b, consistency_level, CollectionSchema, FieldSchema, payload, collectionParams, schemaBtyes, level, promise;
|
|
135
123
|
return __generator(this, function (_c) {
|
|
136
124
|
switch (_c.label) {
|
|
137
125
|
case 0:
|
|
138
126
|
_a = data || {}, fields = _a.fields, collection_name = _a.collection_name, description = _a.description, _b = _a.consistency_level, consistency_level = _b === void 0 ? 'Bounded' : _b;
|
|
139
127
|
if (!fields || !fields.length || !collection_name) {
|
|
140
|
-
throw new Error(
|
|
128
|
+
throw new Error(_1.ERROR_REASONS.CREATE_COLLECTION_CHECK_PARAMS);
|
|
141
129
|
}
|
|
142
|
-
(0,
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
root = _c.sent();
|
|
146
|
-
CollectionSchema = this._protoRoot.lookupType('milvus.proto.schema.CollectionSchema');
|
|
147
|
-
FieldSchema = this._protoRoot.lookupType('milvus.proto.schema.FieldSchema');
|
|
130
|
+
(0, utils_1.checkCollectionFields)(fields);
|
|
131
|
+
CollectionSchema = this.schemaProto.lookupType('milvus.proto.schema.CollectionSchema');
|
|
132
|
+
FieldSchema = this.schemaProto.lookupType('milvus.proto.schema.FieldSchema');
|
|
148
133
|
payload = {
|
|
149
134
|
name: collection_name,
|
|
150
135
|
description: description || '',
|
|
151
136
|
fields: [],
|
|
152
137
|
};
|
|
153
138
|
data.fields.forEach(function (field) {
|
|
154
|
-
var value = __assign(__assign({}, field), { typeParams: (0,
|
|
139
|
+
var value = __assign(__assign({}, field), { typeParams: (0, utils_1.parseToKeyValue)(field.type_params), dataType: field.data_type, isPrimaryKey: field.is_primary_key });
|
|
155
140
|
var fieldParams = FieldSchema.create(value);
|
|
156
141
|
payload.fields.push(fieldParams);
|
|
157
142
|
});
|
|
158
143
|
collectionParams = CollectionSchema.create(payload);
|
|
159
144
|
schemaBtyes = CollectionSchema.encode(collectionParams).finish();
|
|
160
|
-
level = Object.keys(
|
|
161
|
-
?
|
|
162
|
-
:
|
|
163
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
164
|
-
case
|
|
145
|
+
level = Object.keys(_1.ConsistencyLevelEnum).includes(consistency_level)
|
|
146
|
+
? _1.ConsistencyLevelEnum[consistency_level]
|
|
147
|
+
: _1.ConsistencyLevelEnum['Bounded'];
|
|
148
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'CreateCollection', __assign(__assign({}, data), { schema: schemaBtyes, consistency_level: level }), data.timeout)];
|
|
149
|
+
case 1:
|
|
165
150
|
promise = _c.sent();
|
|
166
151
|
return [2 /*return*/, promise];
|
|
167
152
|
}
|
|
@@ -169,37 +154,37 @@ var Collection = /** @class */ (function (_super) {
|
|
|
169
154
|
});
|
|
170
155
|
};
|
|
171
156
|
/**
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
157
|
+
* Check if a collection exists.
|
|
158
|
+
*
|
|
159
|
+
* @param data
|
|
160
|
+
* | Property | Type | Description |
|
|
161
|
+
* | :-- | :-- | :-- |
|
|
162
|
+
* | collection_name | String | Collection name |
|
|
163
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
164
|
+
*
|
|
165
|
+
* @returns
|
|
166
|
+
* | Property | Description |
|
|
167
|
+
* | :-- | :-- |
|
|
168
|
+
* | status | { error_code: number, reason: string } |
|
|
169
|
+
* | value | `true` or `false` |
|
|
170
|
+
|
|
171
|
+
*
|
|
172
|
+
* #### Example
|
|
173
|
+
*
|
|
174
|
+
* ```
|
|
175
|
+
* new milvusClient(MILUVS_ADDRESS).hasCollection({
|
|
176
|
+
* collection_name: 'my_collection',
|
|
177
|
+
* });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
195
180
|
Collection.prototype.hasCollection = function (data) {
|
|
196
181
|
return __awaiter(this, void 0, void 0, function () {
|
|
197
182
|
var promise;
|
|
198
183
|
return __generator(this, function (_a) {
|
|
199
184
|
switch (_a.label) {
|
|
200
185
|
case 0:
|
|
201
|
-
|
|
202
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
186
|
+
(0, utils_1.checkCollectionName)(data);
|
|
187
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'HasCollection', data, data.timeout)];
|
|
203
188
|
case 1:
|
|
204
189
|
promise = _a.sent();
|
|
205
190
|
return [2 /*return*/, promise];
|
|
@@ -208,35 +193,36 @@ var Collection = /** @class */ (function (_super) {
|
|
|
208
193
|
});
|
|
209
194
|
};
|
|
210
195
|
/**
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
196
|
+
* List all collections or get collection loading status.
|
|
197
|
+
*
|
|
198
|
+
* @param data
|
|
199
|
+
* | Property | Type | Description |
|
|
200
|
+
* | :-- | :-- | :-- |
|
|
201
|
+
* | type(optional) | enum | All -> 0, Loaded -> 1 |
|
|
202
|
+
* | collection_names(optional) | String[] | If `type = Loaded`, Milvus will return `collection_names inMemory_percentages` |
|
|
203
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
204
|
+
|
|
205
|
+
*
|
|
206
|
+
* @returns
|
|
207
|
+
* | Property | Description |
|
|
208
|
+
* | :-- | :-- |
|
|
209
|
+
* | status | { error_code: number, reason: string } |
|
|
210
|
+
* | data | Contains collection name, ID , timestamp (UTC created time), and loadedPercentage (100 means loaded) |
|
|
211
|
+
*
|
|
212
|
+
*
|
|
213
|
+
* #### Example
|
|
214
|
+
*
|
|
215
|
+
* ```
|
|
216
|
+
* new milvusClient(MILUVS_ADDRESS).showCollections();
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
233
219
|
Collection.prototype.showCollections = function (data) {
|
|
234
220
|
return __awaiter(this, void 0, void 0, function () {
|
|
235
221
|
var promise, result;
|
|
236
222
|
return __generator(this, function (_a) {
|
|
237
223
|
switch (_a.label) {
|
|
238
|
-
case 0: return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
239
|
-
type: data ? data.type :
|
|
224
|
+
case 0: return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'ShowCollections', {
|
|
225
|
+
type: data ? data.type : _1.ShowCollectionsType.All,
|
|
240
226
|
collection_names: (data === null || data === void 0 ? void 0 : data.collection_names) || [],
|
|
241
227
|
}, data === null || data === void 0 ? void 0 : data.timeout)];
|
|
242
228
|
case 1:
|
|
@@ -260,23 +246,23 @@ var Collection = /** @class */ (function (_super) {
|
|
|
260
246
|
* Show the details of a collection, e.g. name, schema.
|
|
261
247
|
*
|
|
262
248
|
* @param data
|
|
263
|
-
* | Property
|
|
264
|
-
* |
|
|
265
|
-
* | collection_name
|
|
266
|
-
* | timeout
|
|
249
|
+
* | Property | Type | Description |
|
|
250
|
+
* | :-- | :-- | :-- |
|
|
251
|
+
* | collection_name | String | Collection name |
|
|
252
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
267
253
|
*
|
|
268
|
-
* @
|
|
269
|
-
*
|
|
270
|
-
* |
|
|
271
|
-
* | status
|
|
272
|
-
* | schema
|
|
273
|
-
* | collectionID |
|
|
254
|
+
* @returns
|
|
255
|
+
* | Property | Description |
|
|
256
|
+
* | :-- | :-- |
|
|
257
|
+
* | status | { error_code: number, reason: string } |
|
|
258
|
+
* | schema | Information of all fields in this collection |
|
|
259
|
+
* | collectionID | Collection ID |
|
|
274
260
|
*
|
|
275
261
|
*
|
|
276
262
|
* #### Example
|
|
277
263
|
*
|
|
278
264
|
* ```
|
|
279
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
265
|
+
* new milvusClient(MILUVS_ADDRESS).describeCollection({
|
|
280
266
|
* collection_name: 'my_collection',
|
|
281
267
|
* });
|
|
282
268
|
* ```
|
|
@@ -287,8 +273,8 @@ var Collection = /** @class */ (function (_super) {
|
|
|
287
273
|
return __generator(this, function (_a) {
|
|
288
274
|
switch (_a.label) {
|
|
289
275
|
case 0:
|
|
290
|
-
|
|
291
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
276
|
+
(0, utils_1.checkCollectionName)(data);
|
|
277
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'DescribeCollection', data, data.timeout)];
|
|
292
278
|
case 1:
|
|
293
279
|
promise = _a.sent();
|
|
294
280
|
return [2 /*return*/, promise];
|
|
@@ -300,23 +286,23 @@ var Collection = /** @class */ (function (_super) {
|
|
|
300
286
|
* Show the statistics information of a collection.
|
|
301
287
|
*
|
|
302
288
|
* @param data
|
|
303
|
-
* | Property
|
|
304
|
-
* |
|
|
305
|
-
* | collection_name
|
|
306
|
-
* | timeout
|
|
289
|
+
* | Property | Type | Description |
|
|
290
|
+
* | :-- | :-- | :-- |
|
|
291
|
+
* | collection_name | String | Collection name |
|
|
292
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
307
293
|
*
|
|
308
|
-
* @
|
|
309
|
-
*
|
|
310
|
-
* |
|
|
311
|
-
* | status
|
|
312
|
-
* | stats
|
|
313
|
-
* | data
|
|
294
|
+
* @returns
|
|
295
|
+
* | Property | Description |
|
|
296
|
+
* | :-- | :-- |
|
|
297
|
+
* | status | { error_code: number, reason: string } |
|
|
298
|
+
* | stats | [{key: string, value: string}] |
|
|
299
|
+
* | data | Transform **stats** to { row_count: 0 } |
|
|
314
300
|
*
|
|
315
301
|
*
|
|
316
302
|
* #### Example
|
|
317
303
|
*
|
|
318
304
|
* ```
|
|
319
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
305
|
+
* new milvusClient(MILUVS_ADDRESS).getCollectionStatistics({
|
|
320
306
|
* collection_name: 'my_collection',
|
|
321
307
|
* });
|
|
322
308
|
* ```
|
|
@@ -327,11 +313,11 @@ var Collection = /** @class */ (function (_super) {
|
|
|
327
313
|
return __generator(this, function (_a) {
|
|
328
314
|
switch (_a.label) {
|
|
329
315
|
case 0:
|
|
330
|
-
|
|
331
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
316
|
+
(0, utils_1.checkCollectionName)(data);
|
|
317
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'GetCollectionStatistics', data, data.timeout)];
|
|
332
318
|
case 1:
|
|
333
319
|
promise = _a.sent();
|
|
334
|
-
promise.data = (0,
|
|
320
|
+
promise.data = (0, utils_1.formatKeyValueData)(promise.stats, ['row_count']);
|
|
335
321
|
return [2 /*return*/, promise];
|
|
336
322
|
}
|
|
337
323
|
});
|
|
@@ -342,22 +328,23 @@ var Collection = /** @class */ (function (_super) {
|
|
|
342
328
|
* It's async function, but we can use showCollections to check loading status.
|
|
343
329
|
*
|
|
344
330
|
* @param data
|
|
345
|
-
* | Property
|
|
346
|
-
* |
|
|
347
|
-
* | collection_name | String |
|
|
348
|
-
* | replica_number?
|
|
349
|
-
* |
|
|
350
|
-
*
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* |
|
|
354
|
-
* |
|
|
355
|
-
* |
|
|
331
|
+
* | Property | Type | Description |
|
|
332
|
+
* | :--- | :-- | :-- |
|
|
333
|
+
* | collection_name | String | Collection name |
|
|
334
|
+
* | replica_number? | number | replica number |
|
|
335
|
+
* | resource_groups? | String[] | resource group names |
|
|
336
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
337
|
+
*
|
|
338
|
+
* @returns
|
|
339
|
+
* | Property | Description |
|
|
340
|
+
* | :-- | :-- |
|
|
341
|
+
* | error_code | Error code number |
|
|
342
|
+
* | reason | Error cause |
|
|
356
343
|
*
|
|
357
344
|
* #### Example
|
|
358
345
|
*
|
|
359
346
|
* ```
|
|
360
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
347
|
+
* new milvusClient(MILUVS_ADDRESS).loadCollection({
|
|
361
348
|
* collection_name: 'my_collection',
|
|
362
349
|
* });
|
|
363
350
|
* ```
|
|
@@ -368,8 +355,8 @@ var Collection = /** @class */ (function (_super) {
|
|
|
368
355
|
return __generator(this, function (_a) {
|
|
369
356
|
switch (_a.label) {
|
|
370
357
|
case 0:
|
|
371
|
-
|
|
372
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
358
|
+
(0, utils_1.checkCollectionName)(data);
|
|
359
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'LoadCollection', data, data.timeout)];
|
|
373
360
|
case 1:
|
|
374
361
|
promise = _a.sent();
|
|
375
362
|
return [2 /*return*/, promise];
|
|
@@ -382,21 +369,23 @@ var Collection = /** @class */ (function (_super) {
|
|
|
382
369
|
* Help to ensure this collection is loaded.
|
|
383
370
|
*
|
|
384
371
|
* @param data
|
|
385
|
-
* | Property
|
|
386
|
-
* |
|
|
387
|
-
* | collection_name
|
|
388
|
-
* |
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
* |
|
|
394
|
-
* |
|
|
372
|
+
* | Property | Type | Description |
|
|
373
|
+
* | :--- | :-- | :-- |
|
|
374
|
+
* | collection_name | String | Collection name |
|
|
375
|
+
* | replica_number? | number | replica number |
|
|
376
|
+
* | resource_groups? | String[] | resource group |
|
|
377
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
378
|
+
*
|
|
379
|
+
* @returns
|
|
380
|
+
* | Property | Description |
|
|
381
|
+
* | :-- | :-- |
|
|
382
|
+
* | error_code | Error code number |
|
|
383
|
+
* | reason | Error cause |
|
|
395
384
|
*
|
|
396
385
|
* #### Example
|
|
397
386
|
*
|
|
398
387
|
* ```
|
|
399
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
388
|
+
* new milvusClient(MILUVS_ADDRESS).loadCollectionSync({
|
|
400
389
|
* collection_name: 'my_collection',
|
|
401
390
|
* });
|
|
402
391
|
* ```
|
|
@@ -407,11 +396,11 @@ var Collection = /** @class */ (function (_super) {
|
|
|
407
396
|
return __generator(this, function (_a) {
|
|
408
397
|
switch (_a.label) {
|
|
409
398
|
case 0:
|
|
410
|
-
|
|
411
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
399
|
+
(0, utils_1.checkCollectionName)(data);
|
|
400
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'LoadCollection', data, data.timeout)];
|
|
412
401
|
case 1:
|
|
413
402
|
promise = _a.sent();
|
|
414
|
-
if (promise.error_code !==
|
|
403
|
+
if (promise.error_code !== _1.ErrorCode.SUCCESS) {
|
|
415
404
|
throw new Error("ErrorCode: ".concat(promise.error_code, ". Reason: ").concat(promise.reason));
|
|
416
405
|
}
|
|
417
406
|
loadedPercentage = 0;
|
|
@@ -420,11 +409,11 @@ var Collection = /** @class */ (function (_super) {
|
|
|
420
409
|
if (!(Number(loadedPercentage) < 100)) return [3 /*break*/, 4];
|
|
421
410
|
return [4 /*yield*/, this.showCollections({
|
|
422
411
|
collection_names: [data.collection_name],
|
|
423
|
-
type:
|
|
412
|
+
type: _1.ShowCollectionsType.Loaded,
|
|
424
413
|
})];
|
|
425
414
|
case 3:
|
|
426
415
|
res = _a.sent();
|
|
427
|
-
if (res.status.error_code !==
|
|
416
|
+
if (res.status.error_code !== _1.ErrorCode.SUCCESS) {
|
|
428
417
|
throw new Error("ErrorCode: ".concat(res.status.error_code, ". Reason: ").concat(res.status.reason));
|
|
429
418
|
}
|
|
430
419
|
// Because we pass collection_names in showCollections, so it will only this collection in result.
|
|
@@ -440,21 +429,21 @@ var Collection = /** @class */ (function (_super) {
|
|
|
440
429
|
* Note that you cannot search while the corresponding collection is unloaded.
|
|
441
430
|
*
|
|
442
431
|
* @param data
|
|
443
|
-
* | Property
|
|
444
|
-
* |
|
|
445
|
-
* | collection_name
|
|
446
|
-
* | timeout
|
|
432
|
+
* | Property | Type | Description |
|
|
433
|
+
* | :-- | :-- | :-- |
|
|
434
|
+
* | collection_name | String | Collection name |
|
|
435
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
447
436
|
*
|
|
448
|
-
* @
|
|
449
|
-
* | Property
|
|
450
|
-
* |
|
|
451
|
-
* | error_code
|
|
452
|
-
* | reason
|
|
437
|
+
* @returns
|
|
438
|
+
* | Property | Description |
|
|
439
|
+
* | :-- | :-- |
|
|
440
|
+
* | error_code | Error code number |
|
|
441
|
+
* | reason | Error cause |
|
|
453
442
|
*
|
|
454
443
|
* #### Example
|
|
455
444
|
*
|
|
456
445
|
* ```
|
|
457
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
446
|
+
* new milvusClient(MILUVS_ADDRESS).releaseCollection({
|
|
458
447
|
* collection_name: 'my_collection',
|
|
459
448
|
* });
|
|
460
449
|
* ```
|
|
@@ -465,8 +454,49 @@ var Collection = /** @class */ (function (_super) {
|
|
|
465
454
|
return __generator(this, function (_a) {
|
|
466
455
|
switch (_a.label) {
|
|
467
456
|
case 0:
|
|
468
|
-
|
|
469
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
457
|
+
(0, utils_1.checkCollectionName)(data);
|
|
458
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'ReleaseCollection', data, data.timeout)];
|
|
459
|
+
case 1:
|
|
460
|
+
promise = _a.sent();
|
|
461
|
+
return [2 /*return*/, promise];
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Rename a collection
|
|
468
|
+
*
|
|
469
|
+
* @param data
|
|
470
|
+
* | Property | Type | Description |
|
|
471
|
+
* | :-- | :-- | :-- |
|
|
472
|
+
* | collection_name | String | old collection name |
|
|
473
|
+
* | new_collection_name | String | new collection name |
|
|
474
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
475
|
+
*
|
|
476
|
+
* @returns
|
|
477
|
+
* | Property | Description |
|
|
478
|
+
* | :-- | :-- |
|
|
479
|
+
* | error_code | Error code number |
|
|
480
|
+
* | reason | Error cause |
|
|
481
|
+
*
|
|
482
|
+
* #### Example
|
|
483
|
+
*
|
|
484
|
+
* ```
|
|
485
|
+
* new milvusClient(MILUVS_ADDRESS).renameCollection({
|
|
486
|
+
* collection_name: 'my_collection',
|
|
487
|
+
* new_collection_name: 'my_new_collection'
|
|
488
|
+
* });
|
|
489
|
+
* ```
|
|
490
|
+
*/
|
|
491
|
+
Collection.prototype.renameCollection = function (data) {
|
|
492
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
493
|
+
var promise;
|
|
494
|
+
return __generator(this, function (_a) {
|
|
495
|
+
switch (_a.label) {
|
|
496
|
+
case 0: return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'RenameCollection', {
|
|
497
|
+
oldName: data.collection_name,
|
|
498
|
+
newName: data.new_collection_name,
|
|
499
|
+
}, data.timeout)];
|
|
470
500
|
case 1:
|
|
471
501
|
promise = _a.sent();
|
|
472
502
|
return [2 /*return*/, promise];
|
|
@@ -478,21 +508,21 @@ var Collection = /** @class */ (function (_super) {
|
|
|
478
508
|
* Drop a collection. Note that this drops all data in the collection.
|
|
479
509
|
*
|
|
480
510
|
* @param data
|
|
481
|
-
* | Property
|
|
482
|
-
* |
|
|
483
|
-
* | collection_name
|
|
484
|
-
* | timeout
|
|
511
|
+
* | Property | Type | Description |
|
|
512
|
+
* | :-- | :-- | :-- |
|
|
513
|
+
* | collection_name | String | Collection name |
|
|
514
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined. |
|
|
485
515
|
*
|
|
486
|
-
* @
|
|
487
|
-
* | Property
|
|
488
|
-
* |
|
|
489
|
-
* | error_code
|
|
490
|
-
* | reason
|
|
516
|
+
* @returns
|
|
517
|
+
* | Property | Description |
|
|
518
|
+
* | :-- | :-- |
|
|
519
|
+
* | error_code | Error code number |
|
|
520
|
+
* | reason | Error cause |
|
|
491
521
|
*
|
|
492
522
|
* #### Example
|
|
493
523
|
*
|
|
494
524
|
* ```
|
|
495
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
525
|
+
* new milvusClient(MILUVS_ADDRESS).dropCollection({
|
|
496
526
|
* collection_name: 'my_collection',
|
|
497
527
|
* });
|
|
498
528
|
* ```
|
|
@@ -503,8 +533,8 @@ var Collection = /** @class */ (function (_super) {
|
|
|
503
533
|
return __generator(this, function (_a) {
|
|
504
534
|
switch (_a.label) {
|
|
505
535
|
case 0:
|
|
506
|
-
|
|
507
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
536
|
+
(0, utils_1.checkCollectionName)(data);
|
|
537
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'DropCollection', data, data.timeout)];
|
|
508
538
|
case 1:
|
|
509
539
|
promise = _a.sent();
|
|
510
540
|
return [2 /*return*/, promise];
|
|
@@ -513,9 +543,30 @@ var Collection = /** @class */ (function (_super) {
|
|
|
513
543
|
});
|
|
514
544
|
};
|
|
515
545
|
/**
|
|
516
|
-
* @ignore
|
|
517
546
|
* Create collection alias, then you can use alias instead of collection_name when you do vector search
|
|
547
|
+
*
|
|
518
548
|
* @param data
|
|
549
|
+
* | Property | Type | Description |
|
|
550
|
+
* | :-- | :-- | :-- |
|
|
551
|
+
* | alias | String | alias name |
|
|
552
|
+
* | collection_name | String | Collection name |
|
|
553
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined. |
|
|
554
|
+
*
|
|
555
|
+
* @returns
|
|
556
|
+
* | Property | Description |
|
|
557
|
+
* | :-- | :-- |
|
|
558
|
+
* | error_code | Error code number |
|
|
559
|
+
* | reason | Error cause |
|
|
560
|
+
*
|
|
561
|
+
*
|
|
562
|
+
* #### Example
|
|
563
|
+
*
|
|
564
|
+
* ```
|
|
565
|
+
* new milvusClient(MILUVS_ADDRESS).createAlias({
|
|
566
|
+
* alias: 'my_collection_alis',
|
|
567
|
+
* collection_name: 'my_collection',
|
|
568
|
+
* });
|
|
569
|
+
* ```
|
|
519
570
|
*/
|
|
520
571
|
Collection.prototype.createAlias = function (data) {
|
|
521
572
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -523,11 +574,11 @@ var Collection = /** @class */ (function (_super) {
|
|
|
523
574
|
return __generator(this, function (_a) {
|
|
524
575
|
switch (_a.label) {
|
|
525
576
|
case 0:
|
|
526
|
-
|
|
577
|
+
(0, utils_1.checkCollectionName)(data);
|
|
527
578
|
if (!data.alias) {
|
|
528
|
-
throw new Error(
|
|
579
|
+
throw new Error(_1.ERROR_REASONS.ALIAS_NAME_IS_REQUIRED);
|
|
529
580
|
}
|
|
530
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
581
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'CreateAlias', data, data.timeout)];
|
|
531
582
|
case 1:
|
|
532
583
|
promise = _a.sent();
|
|
533
584
|
return [2 /*return*/, promise];
|
|
@@ -536,8 +587,30 @@ var Collection = /** @class */ (function (_super) {
|
|
|
536
587
|
});
|
|
537
588
|
};
|
|
538
589
|
/**
|
|
539
|
-
*
|
|
590
|
+
* Drop a collection alias
|
|
591
|
+
*
|
|
540
592
|
* @param data
|
|
593
|
+
* | Property | Type | Description |
|
|
594
|
+
* | :-- | :-- | :-- |
|
|
595
|
+
* | alias | String | alias name |
|
|
596
|
+
* | collection_name | String | Collection name |
|
|
597
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined. |
|
|
598
|
+
*
|
|
599
|
+
* @returns
|
|
600
|
+
* | Property | Description |
|
|
601
|
+
* | :-- | :-- |
|
|
602
|
+
* | error_code | Error code number |
|
|
603
|
+
* | reason | Error cause |
|
|
604
|
+
*
|
|
605
|
+
*
|
|
606
|
+
* #### Example
|
|
607
|
+
*
|
|
608
|
+
* ```
|
|
609
|
+
* new milvusClient(MILUVS_ADDRESS).dropAlias({
|
|
610
|
+
* alias: 'my_collection_alis',
|
|
611
|
+
* collection_name: 'my_collection',
|
|
612
|
+
* });
|
|
613
|
+
* ```
|
|
541
614
|
*/
|
|
542
615
|
Collection.prototype.dropAlias = function (data) {
|
|
543
616
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -546,9 +619,9 @@ var Collection = /** @class */ (function (_super) {
|
|
|
546
619
|
switch (_a.label) {
|
|
547
620
|
case 0:
|
|
548
621
|
if (!data.alias) {
|
|
549
|
-
throw new Error(
|
|
622
|
+
throw new Error(_1.ERROR_REASONS.ALIAS_NAME_IS_REQUIRED);
|
|
550
623
|
}
|
|
551
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
624
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'DropAlias', data, data.timeout)];
|
|
552
625
|
case 1:
|
|
553
626
|
promise = _a.sent();
|
|
554
627
|
return [2 /*return*/, promise];
|
|
@@ -557,8 +630,30 @@ var Collection = /** @class */ (function (_super) {
|
|
|
557
630
|
});
|
|
558
631
|
};
|
|
559
632
|
/**
|
|
560
|
-
*
|
|
633
|
+
* alter a collection alias
|
|
634
|
+
*
|
|
561
635
|
* @param data
|
|
636
|
+
* | Property | Type | Description |
|
|
637
|
+
* | :-- | :-- | :-- |
|
|
638
|
+
* | alias | String | alias name |
|
|
639
|
+
* | collection_name | String | Collection name |
|
|
640
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined. |
|
|
641
|
+
*
|
|
642
|
+
* @returns
|
|
643
|
+
* | Property | Description |
|
|
644
|
+
* | :-- | :-- |
|
|
645
|
+
* | error_code | Error code number |
|
|
646
|
+
* | reason | Error cause |
|
|
647
|
+
*
|
|
648
|
+
*
|
|
649
|
+
* #### Example
|
|
650
|
+
*
|
|
651
|
+
* ```
|
|
652
|
+
* new milvusClient(MILUVS_ADDRESS).alterAlais({
|
|
653
|
+
* alias: 'my_collection_alis',
|
|
654
|
+
* collection_name: 'my_collection',
|
|
655
|
+
* });
|
|
656
|
+
* ```
|
|
562
657
|
*/
|
|
563
658
|
Collection.prototype.alterAlias = function (data) {
|
|
564
659
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -566,11 +661,11 @@ var Collection = /** @class */ (function (_super) {
|
|
|
566
661
|
return __generator(this, function (_a) {
|
|
567
662
|
switch (_a.label) {
|
|
568
663
|
case 0:
|
|
569
|
-
|
|
664
|
+
(0, utils_1.checkCollectionName)(data);
|
|
570
665
|
if (!data.alias) {
|
|
571
|
-
throw new Error(
|
|
666
|
+
throw new Error(_1.ERROR_REASONS.ALIAS_NAME_IS_REQUIRED);
|
|
572
667
|
}
|
|
573
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
668
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'AlterAlias', data, data.timeout)];
|
|
574
669
|
case 1:
|
|
575
670
|
promise = _a.sent();
|
|
576
671
|
return [2 /*return*/, promise];
|
|
@@ -582,21 +677,21 @@ var Collection = /** @class */ (function (_super) {
|
|
|
582
677
|
* Do compaction for the collection.
|
|
583
678
|
*
|
|
584
679
|
* @param data
|
|
585
|
-
* | Property
|
|
586
|
-
* |
|
|
587
|
-
* | collection_name
|
|
588
|
-
* | timeout
|
|
680
|
+
* | Property | Type | Description |
|
|
681
|
+
* | :-- | :-- | :-- |
|
|
682
|
+
* | collection_name | String | The collection name to compact |
|
|
683
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
589
684
|
*
|
|
590
|
-
* @
|
|
591
|
-
* | Property
|
|
592
|
-
* |
|
|
593
|
-
* | status
|
|
594
|
-
* | compactionID
|
|
685
|
+
* @returns
|
|
686
|
+
* | Property | Description |
|
|
687
|
+
* | :-- | :-- |
|
|
688
|
+
* | status | { error_code: number, reason: string } |
|
|
689
|
+
* | compactionID | compaction ID |
|
|
595
690
|
*
|
|
596
691
|
* #### Example
|
|
597
692
|
*
|
|
598
693
|
* ```
|
|
599
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
694
|
+
* new milvusClient(MILUVS_ADDRESS).compact({
|
|
600
695
|
* collection_name: 'my_collection',
|
|
601
696
|
* });
|
|
602
697
|
* ```
|
|
@@ -607,11 +702,11 @@ var Collection = /** @class */ (function (_super) {
|
|
|
607
702
|
return __generator(this, function (_a) {
|
|
608
703
|
switch (_a.label) {
|
|
609
704
|
case 0:
|
|
610
|
-
|
|
705
|
+
(0, utils_1.checkCollectionName)(data);
|
|
611
706
|
return [4 /*yield*/, this.describeCollection(data)];
|
|
612
707
|
case 1:
|
|
613
708
|
collectionInfo = _a.sent();
|
|
614
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
709
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'ManualCompaction', {
|
|
615
710
|
collectionID: collectionInfo.collectionID,
|
|
616
711
|
}, data.timeout)];
|
|
617
712
|
case 2:
|
|
@@ -625,21 +720,21 @@ var Collection = /** @class */ (function (_super) {
|
|
|
625
720
|
* Get compaction states of a targeted compaction id
|
|
626
721
|
*
|
|
627
722
|
* @param data
|
|
628
|
-
* | Property
|
|
629
|
-
* |
|
|
630
|
-
* | compactionID
|
|
631
|
-
* | timeout
|
|
723
|
+
* | Property | Type | Description |
|
|
724
|
+
* | :-- | :-- | :-- |
|
|
725
|
+
* | compactionID | number or string | the id returned by compact |
|
|
726
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
632
727
|
*
|
|
633
|
-
* @
|
|
634
|
-
* | Property
|
|
635
|
-
* |
|
|
636
|
-
* | status
|
|
637
|
-
* | state
|
|
728
|
+
* @returns
|
|
729
|
+
* | Property | Description |
|
|
730
|
+
* | :-- | :-- |
|
|
731
|
+
* | status | { error_code: number, reason: string } |
|
|
732
|
+
* | state | the state of the compaction |
|
|
638
733
|
*
|
|
639
734
|
* #### Example
|
|
640
735
|
*
|
|
641
736
|
* ```
|
|
642
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
737
|
+
* new milvusClient(MILUVS_ADDRESS).getCompactionState({
|
|
643
738
|
* compactionID: compactionID,
|
|
644
739
|
* });
|
|
645
740
|
* ```
|
|
@@ -651,9 +746,9 @@ var Collection = /** @class */ (function (_super) {
|
|
|
651
746
|
switch (_a.label) {
|
|
652
747
|
case 0:
|
|
653
748
|
if (!data || !data.compactionID) {
|
|
654
|
-
throw new Error(
|
|
749
|
+
throw new Error(_1.ERROR_REASONS.COMPACTIONID_IS_REQUIRED);
|
|
655
750
|
}
|
|
656
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
751
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'GetCompactionState', data, data.timeout)];
|
|
657
752
|
case 1:
|
|
658
753
|
res = _a.sent();
|
|
659
754
|
return [2 /*return*/, res];
|
|
@@ -665,21 +760,21 @@ var Collection = /** @class */ (function (_super) {
|
|
|
665
760
|
* Get compaction states of a targeted compaction id
|
|
666
761
|
*
|
|
667
762
|
* @param data
|
|
668
|
-
* | Property
|
|
669
|
-
* |
|
|
670
|
-
* | compactionID
|
|
671
|
-
* | timeout
|
|
763
|
+
* | Property | Type | Description |
|
|
764
|
+
* | :-- | :-- | :-- |
|
|
765
|
+
* | compactionID | number or string | the id returned by compact |
|
|
766
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
672
767
|
*
|
|
673
|
-
* @
|
|
674
|
-
* | Property
|
|
675
|
-
* |
|
|
676
|
-
* | status
|
|
677
|
-
* | state
|
|
768
|
+
* @returns
|
|
769
|
+
* | Property | Description |
|
|
770
|
+
* | :-- | :-- |
|
|
771
|
+
* | status | { error_code: number, reason: string } |
|
|
772
|
+
* | state | the state of the compaction |
|
|
678
773
|
*
|
|
679
774
|
* #### Example
|
|
680
775
|
*
|
|
681
776
|
* ```
|
|
682
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
777
|
+
* new milvusClient(MILUVS_ADDRESS).getCompactionStateWithPlans({
|
|
683
778
|
* compactionID: compactionID,
|
|
684
779
|
* });
|
|
685
780
|
* ```
|
|
@@ -691,9 +786,9 @@ var Collection = /** @class */ (function (_super) {
|
|
|
691
786
|
switch (_a.label) {
|
|
692
787
|
case 0:
|
|
693
788
|
if (!data || !data.compactionID) {
|
|
694
|
-
throw new Error(
|
|
789
|
+
throw new Error(_1.ERROR_REASONS.COMPACTIONID_IS_REQUIRED);
|
|
695
790
|
}
|
|
696
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
791
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'GetCompactionStateWithPlans', data, data.timeout)];
|
|
697
792
|
case 1:
|
|
698
793
|
res = _a.sent();
|
|
699
794
|
return [2 /*return*/, res];
|
|
@@ -705,21 +800,21 @@ var Collection = /** @class */ (function (_super) {
|
|
|
705
800
|
* Get replicas
|
|
706
801
|
*
|
|
707
802
|
* @param data
|
|
708
|
-
* | Property
|
|
709
|
-
* |
|
|
710
|
-
* | collectionID
|
|
711
|
-
* | timeout
|
|
712
|
-
*
|
|
713
|
-
* @
|
|
714
|
-
* | Property
|
|
715
|
-
* |
|
|
716
|
-
* | status
|
|
803
|
+
* | Property | Type | Description |
|
|
804
|
+
* | :-- | :-- | :-- |
|
|
805
|
+
* | collectionID | number or string | the id returned by compact |
|
|
806
|
+
* | timeout? | number | An optional duration of time in millisecond to allow for the RPC. If it is set to undefined, the client keeps waiting until the server responds or error occurs. Default is undefined |
|
|
807
|
+
*
|
|
808
|
+
* @returns
|
|
809
|
+
* | Property | Description |
|
|
810
|
+
* | :-- | :-- |
|
|
811
|
+
* | status | { error_code: number, reason: string } |
|
|
717
812
|
* | ReplicaInfo[] | replica info array |
|
|
718
813
|
*
|
|
719
814
|
* #### Example
|
|
720
815
|
*
|
|
721
816
|
* ```
|
|
722
|
-
* new milvusClient(MILUVS_ADDRESS).
|
|
817
|
+
* new milvusClient(MILUVS_ADDRESS).getReplicas({
|
|
723
818
|
* collectionID: collectionID,
|
|
724
819
|
* });
|
|
725
820
|
*
|
|
@@ -748,9 +843,9 @@ var Collection = /** @class */ (function (_super) {
|
|
|
748
843
|
switch (_a.label) {
|
|
749
844
|
case 0:
|
|
750
845
|
if (!data || !data.collectionID) {
|
|
751
|
-
throw new Error(
|
|
846
|
+
throw new Error(_1.ERROR_REASONS.COLLECTION_ID_IS_REQUIRED);
|
|
752
847
|
}
|
|
753
|
-
return [4 /*yield*/, (0, utils_1.promisify)(this.
|
|
848
|
+
return [4 /*yield*/, (0, utils_1.promisify)(this.grpcClient, 'GetReplicas', data, data.timeout)];
|
|
754
849
|
case 1:
|
|
755
850
|
res = _a.sent();
|
|
756
851
|
return [2 /*return*/, res];
|
|
@@ -759,6 +854,6 @@ var Collection = /** @class */ (function (_super) {
|
|
|
759
854
|
});
|
|
760
855
|
};
|
|
761
856
|
return Collection;
|
|
762
|
-
}(
|
|
857
|
+
}(BaseClient_1.BaseClient));
|
|
763
858
|
exports.Collection = Collection;
|
|
764
859
|
//# sourceMappingURL=Collection.js.map
|