@zilliz/milvus2-sdk-node 2.2.9 → 2.2.11

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.
Files changed (149) hide show
  1. package/README.md +76 -12
  2. package/dist/milvus/MilvusClient.d.ts +21 -2
  3. package/dist/milvus/MilvusClient.js +35 -29
  4. package/dist/milvus/MilvusClient.js.map +1 -1
  5. package/dist/milvus/OrmClient.d.ts +19 -0
  6. package/dist/milvus/OrmClient.js +77 -0
  7. package/dist/milvus/OrmClient.js.map +1 -0
  8. package/dist/milvus/const/ErrorReason.d.ts +36 -31
  9. package/dist/milvus/const/ErrorReason.js +39 -32
  10. package/dist/milvus/const/ErrorReason.js.map +1 -1
  11. package/dist/milvus/const/Milvus.d.ts +2 -9
  12. package/dist/milvus/const/Milvus.js +16 -33
  13. package/dist/milvus/const/Milvus.js.map +1 -1
  14. package/dist/milvus/const/client.d.ts +5 -0
  15. package/dist/milvus/const/client.js +10 -0
  16. package/dist/milvus/const/client.js.map +1 -0
  17. package/dist/milvus/const/defaults.d.ts +11 -0
  18. package/dist/milvus/const/defaults.js +16 -0
  19. package/dist/milvus/const/defaults.js.map +1 -0
  20. package/dist/milvus/const/highLevel.d.ts +23 -0
  21. package/dist/milvus/const/highLevel.js +26 -0
  22. package/dist/milvus/const/highLevel.js.map +1 -0
  23. package/dist/milvus/const/index.d.ts +5 -0
  24. package/dist/milvus/{types.js → const/index.js} +7 -10
  25. package/dist/milvus/const/index.js.map +1 -0
  26. package/dist/milvus/const/limits.d.ts +2 -0
  27. package/dist/milvus/const/limits.js +7 -0
  28. package/dist/milvus/const/limits.js.map +1 -0
  29. package/dist/milvus/{BaseClient.d.ts → grpc/BaseClient.d.ts} +20 -8
  30. package/dist/milvus/grpc/BaseClient.js +83 -0
  31. package/dist/milvus/grpc/BaseClient.js.map +1 -0
  32. package/dist/milvus/{Collection.d.ts → grpc/Collection.d.ts} +32 -3
  33. package/dist/milvus/grpc/Collection.js +786 -0
  34. package/dist/milvus/grpc/Collection.js.map +1 -0
  35. package/dist/milvus/{Data.d.ts → grpc/Data.d.ts} +68 -10
  36. package/dist/milvus/grpc/Data.js +880 -0
  37. package/dist/milvus/grpc/Data.js.map +1 -0
  38. package/dist/milvus/grpc/Database.d.ts +69 -0
  39. package/dist/milvus/grpc/Database.js +98 -0
  40. package/dist/milvus/grpc/Database.js.map +1 -0
  41. package/dist/milvus/grpc/GrpcClient.d.ts +46 -0
  42. package/dist/milvus/grpc/GrpcClient.js +150 -0
  43. package/dist/milvus/grpc/GrpcClient.js.map +1 -0
  44. package/dist/milvus/{MilvusIndex.d.ts → grpc/MilvusIndex.d.ts} +1 -1
  45. package/dist/milvus/grpc/MilvusIndex.js +203 -0
  46. package/dist/milvus/grpc/MilvusIndex.js.map +1 -0
  47. package/dist/milvus/{Partition.d.ts → grpc/Partition.d.ts} +1 -1
  48. package/dist/milvus/grpc/Partition.js +265 -0
  49. package/dist/milvus/grpc/Partition.js.map +1 -0
  50. package/dist/milvus/{Resource.d.ts → grpc/Resource.d.ts} +2 -2
  51. package/dist/milvus/grpc/Resource.js +250 -0
  52. package/dist/milvus/grpc/Resource.js.map +1 -0
  53. package/dist/milvus/{User.d.ts → grpc/User.d.ts} +1 -1
  54. package/dist/milvus/grpc/User.js +619 -0
  55. package/dist/milvus/grpc/User.js.map +1 -0
  56. package/dist/milvus/index.d.ts +4 -13
  57. package/dist/milvus/index.js +6 -14
  58. package/dist/milvus/index.js.map +1 -1
  59. package/dist/milvus/orm/Collection.d.ts +45 -0
  60. package/dist/milvus/orm/Collection.js +172 -0
  61. package/dist/milvus/orm/Collection.js.map +1 -0
  62. package/dist/milvus/orm/index.d.ts +2 -0
  63. package/dist/milvus/orm/index.js +19 -0
  64. package/dist/milvus/orm/index.js.map +1 -0
  65. package/dist/milvus/orm/utils.d.ts +27 -0
  66. package/dist/milvus/orm/utils.js +27 -0
  67. package/dist/milvus/orm/utils.js.map +1 -0
  68. package/dist/milvus/types/Client.d.ts +12 -1
  69. package/dist/milvus/types/Collection.d.ts +18 -4
  70. package/dist/milvus/types/Common.d.ts +1 -1
  71. package/dist/milvus/types/Data.d.ts +41 -5
  72. package/dist/milvus/types/Database.d.ts +12 -0
  73. package/dist/milvus/types/{Index.js → Database.js} +1 -1
  74. package/dist/milvus/types/Database.js.map +1 -0
  75. package/dist/milvus/types/HighLevel.d.ts +13 -0
  76. package/dist/milvus/types/HighLevel.js +3 -0
  77. package/dist/milvus/types/HighLevel.js.map +1 -0
  78. package/dist/milvus/types/{Index.d.ts → MilvusIndex.d.ts} +3 -2
  79. package/dist/milvus/types/MilvusIndex.js +3 -0
  80. package/dist/milvus/types/MilvusIndex.js.map +1 -0
  81. package/dist/milvus/types/Resource.d.ts +1 -1
  82. package/dist/milvus/types/User.d.ts +1 -1
  83. package/dist/milvus/types/index.d.ts +12 -0
  84. package/dist/milvus/types/index.js +30 -0
  85. package/dist/milvus/types/index.js.map +1 -0
  86. package/dist/{utils → milvus/utils}/Blob.js +4 -4
  87. package/dist/milvus/utils/Blob.js.map +1 -0
  88. package/dist/{utils → milvus/utils}/Format.d.ts +66 -2
  89. package/dist/milvus/utils/Format.js +416 -0
  90. package/dist/milvus/utils/Format.js.map +1 -0
  91. package/dist/{utils → milvus/utils}/Function.d.ts +1 -1
  92. package/dist/{utils → milvus/utils}/Function.js +7 -7
  93. package/dist/milvus/utils/Function.js.map +1 -0
  94. package/dist/{utils → milvus/utils}/Grpc.d.ts +9 -8
  95. package/dist/milvus/utils/Grpc.js +190 -0
  96. package/dist/milvus/utils/Grpc.js.map +1 -0
  97. package/dist/{utils → milvus/utils}/Validate.d.ts +7 -1
  98. package/dist/milvus/utils/Validate.js +140 -0
  99. package/dist/milvus/utils/Validate.js.map +1 -0
  100. package/dist/{utils → milvus/utils}/index.d.ts +2 -0
  101. package/dist/{utils → milvus/utils}/index.js +2 -0
  102. package/dist/milvus/utils/index.js.map +1 -0
  103. package/dist/milvus/utils/logger.d.ts +1 -0
  104. package/dist/milvus/utils/logger.js +18 -0
  105. package/dist/milvus/utils/logger.js.map +1 -0
  106. package/dist/proto/proto/common.proto +38 -14
  107. package/dist/proto/proto/google/protobuf/descriptor.proto +8 -4
  108. package/dist/proto/proto/milvus.proto +86 -83
  109. package/dist/proto/proto/schema.proto +5 -0
  110. package/dist/sdk.json +1 -1
  111. package/package.json +14 -11
  112. package/dist/milvus/BaseClient.js +0 -62
  113. package/dist/milvus/BaseClient.js.map +0 -1
  114. package/dist/milvus/Collection.js +0 -960
  115. package/dist/milvus/Collection.js.map +0 -1
  116. package/dist/milvus/Data.js +0 -909
  117. package/dist/milvus/Data.js.map +0 -1
  118. package/dist/milvus/GrpcClient.d.ts +0 -32
  119. package/dist/milvus/GrpcClient.js +0 -236
  120. package/dist/milvus/GrpcClient.js.map +0 -1
  121. package/dist/milvus/MilvusIndex.js +0 -299
  122. package/dist/milvus/MilvusIndex.js.map +0 -1
  123. package/dist/milvus/Partition.js +0 -369
  124. package/dist/milvus/Partition.js.map +0 -1
  125. package/dist/milvus/Resource.js +0 -356
  126. package/dist/milvus/Resource.js.map +0 -1
  127. package/dist/milvus/User.js +0 -806
  128. package/dist/milvus/User.js.map +0 -1
  129. package/dist/milvus/Utils.d.ts +0 -1
  130. package/dist/milvus/Utils.js +0 -8
  131. package/dist/milvus/Utils.js.map +0 -1
  132. package/dist/milvus/types/Index.js.map +0 -1
  133. package/dist/milvus/types.d.ts +0 -9
  134. package/dist/milvus/types.js.map +0 -1
  135. package/dist/proto/proto/feder.proto +0 -40
  136. package/dist/proto/proto/msg.proto +0 -107
  137. package/dist/utils/Blob.js.map +0 -1
  138. package/dist/utils/Format.js +0 -252
  139. package/dist/utils/Format.js.map +0 -1
  140. package/dist/utils/Function.js.map +0 -1
  141. package/dist/utils/Grpc.js +0 -170
  142. package/dist/utils/Grpc.js.map +0 -1
  143. package/dist/utils/Validate.js +0 -124
  144. package/dist/utils/Validate.js.map +0 -1
  145. package/dist/utils/index.js.map +0 -1
  146. package/dist/utils/test.d.ts +0 -15
  147. package/dist/utils/test.js +0 -98
  148. package/dist/utils/test.js.map +0 -1
  149. /package/dist/{utils → milvus/utils}/Blob.d.ts +0 -0
@@ -0,0 +1,265 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Partition = void 0;
13
+ const MilvusIndex_1 = require("./MilvusIndex");
14
+ const __1 = require("../");
15
+ class Partition extends MilvusIndex_1.Index {
16
+ /**
17
+ * Create a partition in a collection.
18
+ *
19
+ * @param data
20
+ * | Property | Type | Description |
21
+ * | :-- | :-- | :-- |
22
+ * | collection_name | String | Collection name |
23
+ * | partition_name | String | Partition name |
24
+ * | 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 |
25
+
26
+ *
27
+ * @returns
28
+ * | Property | Description |
29
+ * | :-- | :-- |
30
+ * | error_code | Error code number |
31
+ * | reason | Error cause |
32
+ *
33
+ * #### Example
34
+ *
35
+ * ```
36
+ * new milvusClient(MILUVS_ADDRESS).createPartition({
37
+ * collection_name: 'my_collection',
38
+ * partition_name: 'my_partition',
39
+ * });
40
+ * ```
41
+ */
42
+ createPartition(data) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ (0, __1.checkCollectionAndPartitionName)(data);
45
+ const promise = yield (0, __1.promisify)(this.client, 'CreatePartition', data, data.timeout || this.timeout);
46
+ return promise;
47
+ });
48
+ }
49
+ /**
50
+ * Check if a partition exists in a collection.
51
+ *
52
+ * @param data
53
+ * | Property | Type | Description |
54
+ * | :-- | :-- | :-- |
55
+ * | collection_name | string | Collection name |
56
+ * | partition_name | string | Parititon name |
57
+ * | 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 |
58
+
59
+ *
60
+ * @returns
61
+ * | Property | Description |
62
+ * | :-- | :-- |
63
+ * | status | { error_code: number,reason:string } |
64
+ * | value | `true` or `false` |
65
+ *
66
+ * #### Example
67
+ *
68
+ * ```
69
+ * new milvusClient(MILUVS_ADDRESS).hasPartition({
70
+ * collection_name: 'my_collection',
71
+ * partition_name: 'my_partition',
72
+ * });
73
+ * ```
74
+ */
75
+ hasPartition(data) {
76
+ return __awaiter(this, void 0, void 0, function* () {
77
+ (0, __1.checkCollectionAndPartitionName)(data);
78
+ const promise = yield (0, __1.promisify)(this.client, 'HasPartition', data, data.timeout || this.timeout);
79
+ return promise;
80
+ });
81
+ }
82
+ /**
83
+ * Show all partitions in a collection.
84
+ *
85
+ * @param data
86
+ * | Property | Type | Description |
87
+ * | :-- | :-- | :-- |
88
+ * | collection_name | String | Collection name |
89
+ * | 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 |
90
+
91
+ *
92
+ * @returns
93
+ * | Property | Description |
94
+ * | :-- | :-- |
95
+ * | status | { error_code: number, reason: string } |
96
+ * | partition_names | Array of partition names |
97
+ * | partitionIDs | Array of partition IDs |
98
+ *
99
+ *
100
+ * #### Example
101
+ *
102
+ * ```
103
+ * new milvusClient(MILUVS_ADDRESS).showPartitions({
104
+ * collection_name: 'my_collection',
105
+ * });
106
+ * ```
107
+ */
108
+ showPartitions(data) {
109
+ return __awaiter(this, void 0, void 0, function* () {
110
+ (0, __1.checkCollectionName)(data);
111
+ const promise = yield (0, __1.promisify)(this.client, 'ShowPartitions', data, data.timeout || this.timeout);
112
+ return promise;
113
+ });
114
+ }
115
+ /**
116
+ * Show the statistics information of a partition.
117
+ *
118
+ * @param data
119
+ * | Property | Type | Description |
120
+ * | :-- | :-- | :-- |
121
+ * | collection_name | String | Collection name |
122
+ * | partition_name | String | Partition name |
123
+ * | 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 |
124
+
125
+ *
126
+ * @returns
127
+ * | Property | Description |
128
+ * | :-- | :-- |
129
+ * | status | { error_code: number, reason: string } |
130
+ * | stats | [{key: string, value: string}] |
131
+ * | data | { row_count: 0 } transformed from **stats** |
132
+ *
133
+ *
134
+ * #### Example
135
+ *
136
+ * ```
137
+ * new milvusClient(MILUVS_ADDRESS).getPartitionStatistics({
138
+ * collection_name: 'my_collection',
139
+ * partition_name: "_default",
140
+ * });
141
+ * ```
142
+ */
143
+ getPartitionStatistics(data) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ (0, __1.checkCollectionAndPartitionName)(data);
146
+ const promise = yield (0, __1.promisify)(this.client, 'GetPartitionStatistics', data, data.timeout || this.timeout);
147
+ promise.data = (0, __1.formatKeyValueData)(promise.stats, ['row_count']);
148
+ return promise;
149
+ });
150
+ }
151
+ /**
152
+ * Load multiple partitions into query nodes.
153
+ *
154
+ * @param data
155
+ * | Property | Type | Description |
156
+ * | :--- | :-- | :-- |
157
+ * | collection_name | String | Collection name |
158
+ * | partition_names | String[] | Array of partition names |
159
+ * | replica_number? | number | replica number |
160
+ * | resource_groups | String[] | resource group names |
161
+ * | 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 |
162
+ *
163
+ * @returns
164
+ * | Property | Description |
165
+ * | :-- | :-- |
166
+ * | error_code | Error code number |
167
+ * | reason | Error cause |
168
+ *
169
+ * #### Example
170
+ *
171
+ * ```
172
+ * new milvusClient(MILUVS_ADDRESS).loadPartitions({
173
+ * collection_name: 'my_collection',
174
+ * partition_names: ['my_partition'],
175
+ * });
176
+ * ```
177
+ */
178
+ loadPartitions(data) {
179
+ return __awaiter(this, void 0, void 0, function* () {
180
+ (0, __1.checkCollectionName)(data);
181
+ if (!Array.isArray(data.partition_names) || !data.partition_names.length) {
182
+ throw new Error(__1.ERROR_REASONS.PARTITION_NAMES_IS_REQUIRED);
183
+ }
184
+ const promise = yield (0, __1.promisify)(this.client, 'LoadPartitions', data, data.timeout || this.timeout);
185
+ return promise;
186
+ });
187
+ }
188
+ /**
189
+ * Release a partition from cache.
190
+ *
191
+ * @param data
192
+ * | Property | Type | Description |
193
+ * | :-- | :-- | :-- |
194
+ * | collection_name | String | Collection name |
195
+ * | partition_names | String[] | Array of partition names |
196
+ * | 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 |
197
+
198
+ *
199
+ * @returns
200
+ * | Property | Description |
201
+ * | :-- | :-- |
202
+ * | error_code | Error code number |
203
+ * | reason | Error cause |
204
+ *
205
+ * #### Example
206
+ *
207
+ * ```
208
+ * new milvusClient(MILUVS_ADDRESS).releasePartitions({
209
+ * collection_name: 'my_collection',
210
+ * partition_names: ['my_partition'],
211
+ * });
212
+ * ```
213
+ */
214
+ releasePartitions(data) {
215
+ return __awaiter(this, void 0, void 0, function* () {
216
+ (0, __1.checkCollectionName)(data);
217
+ if (!Array.isArray(data.partition_names) || !data.partition_names.length) {
218
+ throw new Error(__1.ERROR_REASONS.PARTITION_NAMES_IS_REQUIRED);
219
+ }
220
+ const promise = yield (0, __1.promisify)(this.client, 'ReleasePartitions', data, data.timeout || this.timeout);
221
+ return promise;
222
+ });
223
+ }
224
+ /**
225
+ * Drop a partition. Note that it will drop all data in the partition.
226
+ * Default partition cannot be droped.
227
+ * @param data
228
+ * @returns
229
+ */
230
+ /**
231
+ * To drop a partition will drop all data in this partition and the `_default` partition cannot be dropped.
232
+ *
233
+ * @param data
234
+ * | Property | Type | Description |
235
+ * | :-- | :-- | :-- |
236
+ * | collection_name | String | Collection name |
237
+ * | partition_name | String | Partition name |
238
+ * | 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 |
239
+
240
+ *
241
+ * @returns
242
+ * | Property | Description |
243
+ * | :-- | :-- |
244
+ * | error_code | Error code number |
245
+ * | reason | Error cause |
246
+ *
247
+ * #### Example
248
+ *
249
+ * ```
250
+ * new milvusClient(MILUVS_ADDRESS).dropPartition({
251
+ * collection_name: 'my_collection',
252
+ * partition_name: 'my_partition',
253
+ * });
254
+ * ```
255
+ */
256
+ dropPartition(data) {
257
+ return __awaiter(this, void 0, void 0, function* () {
258
+ (0, __1.checkCollectionAndPartitionName)(data);
259
+ const promise = yield (0, __1.promisify)(this.client, 'DropPartition', data, data.timeout || this.timeout);
260
+ return promise;
261
+ });
262
+ }
263
+ }
264
+ exports.Partition = Partition;
265
+ //# sourceMappingURL=Partition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Partition.js","sourceRoot":"","sources":["../../../milvus/grpc/Partition.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+CAAsC;AACtC,2BAiBa;AAEb,MAAa,SAAU,SAAQ,mBAAK;IAClC;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,eAAe,CAAC,IAAwB;;YAC5C,IAAA,mCAA+B,EAAC,IAAI,CAAC,CAAC;YACtC,MAAM,OAAO,GAAG,MAAM,IAAA,aAAS,EAC7B,IAAI,CAAC,MAAM,EACX,iBAAiB,EACjB,IAAI,EACJ,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAC7B,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,YAAY,CAAC,IAAqB;;YACtC,IAAA,mCAA+B,EAAC,IAAI,CAAC,CAAC;YACtC,MAAM,OAAO,GAAG,MAAM,IAAA,aAAS,EAC7B,IAAI,CA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BAAgB,EAChB,IAAI,EACJ,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAC7B,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,iBAAiB,CAAC,IAA0B;;YAChD,IAAA,uBAAmB,EAAC,IAAI,CAAC,CAAC;YAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE;gBACxE,MAAM,IAAI,KAAK,CAAC,iBAAa,CAAC,2BAA2B,CAAC,CAAC;aAC5D;YACD,MAAM,OAAO,GAAG,MAAM,IAAA,aAAS,EAC7B,IAAI,CAAC,MAAM,EACX,mBAAmB,EACnB,IAAI,EACJ,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAC7B,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;IAED;;;;;OAKG;IACH;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACG,aAAa,CAAC,IAAsB;;YACxC,IAAA,mCAA+B,EAAC,IAAI,CAAC,CAAC;YACtC,MAAM,OAAO,GAAG,MAAM,IAAA,aAAS,EAC7B,IAAI,CAAC,MAAM,EACX,eAAe,EACf,IAAI,EACJ,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAC7B,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF;AAvRD,8BAuRC"}
@@ -1,5 +1,5 @@
1
1
  import { Partition } from './Partition';
2
- import { ResStatus, GrpcTimeOut, CreateResourceGroupReq, DropResourceGroupsReq, ListResourceGroupsResponse, DesribeResourceGroupsReq, DescribeResourceGroupResponse, TransferNodeReq, TransferReplicaReq } from '.';
2
+ import { ResStatus, GrpcTimeOut, CreateResourceGroupReq, DropResourceGroupsReq, ListResourceGroupsResponse, DescribeResourceGroupsReq, DescribeResourceGroupResponse, TransferNodeReq, TransferReplicaReq } from '../';
3
3
  export declare class Resource extends Partition {
4
4
  /**
5
5
  * Create a resource group.
@@ -71,7 +71,7 @@ export declare class Resource extends Partition {
71
71
  * });
72
72
  * ```
73
73
  */
74
- describeResourceGroup(data: DesribeResourceGroupsReq): Promise<DescribeResourceGroupResponse>;
74
+ describeResourceGroup(data: DescribeResourceGroupsReq): Promise<DescribeResourceGroupResponse>;
75
75
  /**
76
76
  * drop a resource group.
77
77
  * @param data
@@ -0,0 +1,250 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Resource = void 0;
13
+ const Partition_1 = require("./Partition");
14
+ const __1 = require("../");
15
+ class Resource extends Partition_1.Partition {
16
+ /**
17
+ * Create a resource group.
18
+ *
19
+ * @param data
20
+ * | Property | Type | Description |
21
+ * | :--- | :-- | :-- |
22
+ * | resource_group | String | Resource group name |
23
+ * | 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 |
24
+ *
25
+ * @returns
26
+ * | Property | Type | Description |
27
+ * | :-- | :-- | :-- |
28
+ * | status.error_code | string | error code |
29
+ * | status.reason | string | error reason |
30
+ *
31
+ * #### Example
32
+ *
33
+ * ```
34
+ * new milvusClient(MILUVS_ADDRESS).createResourceGroup({
35
+ * resource_group: "vector_01",
36
+ * });
37
+ * ```
38
+ */
39
+ createResourceGroup(data) {
40
+ return __awaiter(this, void 0, void 0, function* () {
41
+ const promise = yield (0, __1.promisify)(this.client, 'CreateResourceGroup', data, data.timeout || this.timeout);
42
+ return promise;
43
+ });
44
+ }
45
+ /**
46
+ * list resource groups.
47
+ *
48
+ * @returns
49
+ * | Property | Type | Description |
50
+ * | :-- | :-- | :-- |
51
+ * | status.error_code | string | error code |
52
+ * | status.reason | string | error reason |
53
+ * | resource_groups | string[] | Resource group string array |
54
+ * | 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 |
55
+ *
56
+ * #### Example
57
+ *
58
+ * ```
59
+ * new milvusClient(MILUVS_ADDRESS).listResourceGroups();
60
+ * ```
61
+ */
62
+ listResourceGroups(data) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ const promise = yield (0, __1.promisify)(this.client, 'ListResourceGroups', {}, (data === null || data === void 0 ? void 0 : data.timeout) || this.timeout);
65
+ return promise;
66
+ });
67
+ }
68
+ /**
69
+ * Describe a resource group.
70
+ *
71
+ * @param data
72
+ * | Property | Type | Description |
73
+ * | :--- | :-- | :-- |
74
+ * | resource_group | String | Resource group name |
75
+ * | 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 |
76
+ *
77
+ * @returns
78
+ * | Property | Type | Description |
79
+ * | :-- | :-- | :-- |
80
+ * | status.error_code | string | error code |
81
+ * | status.reason | string | error reason |
82
+ * | resource_group.capacity | number | num_node which has been transfer to this rg |
83
+ * | resource_group.num_available_node | number | available node_num, some node may shutdown |
84
+ * | resource_group.num_loaded_replica | { [key: string]: number } | from collection_name to loaded replica of each collecion in this rg |
85
+ * | resource_group.num_outgoing_node | { [key: string]: number } | from collection_name to outgoging accessed node num by replica loaded in this rg |
86
+ * | resource_group.num_incoming_node | { [key: string]: number } | from collection_name to incoming accessed node num by replica loaded in other rg |
87
+ *
88
+ * #### Example
89
+ *
90
+ * ```
91
+ * new milvusClient(MILUVS_ADDRESS).describeResrouceGroup({
92
+ * resource_group: 'my-resource-group'
93
+ * });
94
+ * ```
95
+ */
96
+ describeResourceGroup(data) {
97
+ return __awaiter(this, void 0, void 0, function* () {
98
+ const promise = yield (0, __1.promisify)(this.client, 'DescribeResourceGroup', data, data.timeout || this.timeout);
99
+ return promise;
100
+ });
101
+ }
102
+ /**
103
+ * drop a resource group.
104
+ * @param data
105
+ * | Property | Type | Description |
106
+ * | :--- | :-- | :-- |
107
+ * | resource_group | String | Resource group name |
108
+ * | 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 |
109
+ *
110
+ * @returns
111
+ * | Property | Type | Description |
112
+ * | :-- | :-- | :-- |
113
+ * | status.error_code | string | error code |
114
+ * | status.reason | string | error reason |
115
+ *
116
+ * #### Example
117
+ *
118
+ * ```
119
+ * new milvusClient(MILUVS_ADDRESS).dropResourceGroup({
120
+ * resource_group: 'my-resource-group'
121
+ * });
122
+ * ```
123
+ */
124
+ dropResourceGroup(data) {
125
+ return __awaiter(this, void 0, void 0, function* () {
126
+ const promise = yield (0, __1.promisify)(this.client, 'DropResourceGroup', data, data.timeout || this.timeout);
127
+ return promise;
128
+ });
129
+ }
130
+ /**
131
+ * transfer nodes from one resource group to another
132
+ * @param data
133
+ * | Property | Type | Description |
134
+ * | :--- | :-- | :-- |
135
+ * | source_resource_group | String | source resource group name |
136
+ * | target_resource_group | String | target resource group name |
137
+ * | collection_name | String | collection name |
138
+ * | num_replica | Number | number of replicas to transfer |
139
+ * | 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 |
140
+ *
141
+ * @returns
142
+ * | Property | Type | Description |
143
+ * | :-- | :-- | :-- |
144
+ * | status.error_code | string | error code |
145
+ * | status.reason | string | error reason |
146
+ *
147
+ *
148
+ * #### Example
149
+ *
150
+ * ```
151
+ * new milvusClient(MILUVS_ADDRESS).transferNode({
152
+ * source_resource_group: 'source-resource-group',
153
+ * target_resource_group: 'target-resource-group',
154
+ * collection_name: 'my-collection',
155
+ * num_replica: 2
156
+ * });
157
+ * ```
158
+ */
159
+ /* istanbul ignore next */
160
+ transferReplica(data) {
161
+ return __awaiter(this, void 0, void 0, function* () {
162
+ const promise = yield (0, __1.promisify)(this.client, 'TransferReplica', data, data.timeout || this.timeout);
163
+ return promise;
164
+ });
165
+ }
166
+ /**
167
+ * transfer nodes from one resource group to another
168
+ * @param data
169
+ * | Property | Type | Description |
170
+ * | :--- | :-- | :-- |
171
+ * | source_resource_group | String | source resource group name |
172
+ * | target_resource_group | String | target resource group name |
173
+ * | num_node | Number | number of nodes to transfer |
174
+ * | 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 |
175
+ *
176
+ * @returns
177
+ * | Property | Type | Description |
178
+ * | :-- | :-- | :-- |
179
+ * | status.error_code | string | error code |
180
+ * | status.reason | string | error reason |
181
+ *
182
+ *
183
+ * #### Example
184
+ *
185
+ * ```
186
+ * new milvusClient(MILUVS_ADDRESS).transferNode({
187
+ * source_resource_group: 'source-resource-group',
188
+ * target_resource_group: 'target-resource-group',
189
+ * num_node: 4
190
+ * });
191
+ * ```
192
+ */
193
+ /* istanbul ignore next */
194
+ transferNode(data) {
195
+ return __awaiter(this, void 0, void 0, function* () {
196
+ const promise = yield (0, __1.promisify)(this.client, 'TransferNode', data, data.timeout || this.timeout);
197
+ return promise;
198
+ });
199
+ }
200
+ /**
201
+ * drop all resource groups, transfer all nodes to the default group
202
+ *
203
+ * @returns
204
+ * | Property | Type | Description |
205
+ * | :-- | :-- | :-- |
206
+ * | status.error_code | string | error code |
207
+ * | status.reason | string[] | error reason |
208
+ *
209
+ * #### Example
210
+ *
211
+ * ```
212
+ * new milvusClient(MILUVS_ADDRESS).dropResourceGroups();
213
+ * ```
214
+ */
215
+ dropAllResourceGroups() {
216
+ return __awaiter(this, void 0, void 0, function* () {
217
+ // get all resource groups
218
+ const { resource_groups } = yield this.listResourceGroups();
219
+ const res = [];
220
+ // iterate over all resource groups
221
+ // find the query nodes in it that need to be transferred
222
+ // transfer those query nodes to the default group
223
+ for (let i = 0; i < resource_groups.length; i++) {
224
+ const sourceRg = resource_groups[i];
225
+ if (sourceRg !== __1.DEFAULT_RESOURCE_GROUP) {
226
+ // get detail
227
+ const detail = yield this.describeResourceGroup({
228
+ resource_group: sourceRg,
229
+ });
230
+ // if capacity is not 0, transfer node back
231
+ if (detail.resource_group.capacity > 0) {
232
+ // istanbul ignore next
233
+ yield this.transferNode({
234
+ source_resource_group: sourceRg,
235
+ target_resource_group: __1.DEFAULT_RESOURCE_GROUP,
236
+ num_node: detail.resource_group.capacity,
237
+ });
238
+ }
239
+ // drop rg
240
+ res.push(yield this.dropResourceGroup({
241
+ resource_group: sourceRg,
242
+ }));
243
+ }
244
+ }
245
+ return Promise.all(res);
246
+ });
247
+ }
248
+ }
249
+ exports.Resource = Resource;
250
+ //# sourceMappingURL=Resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Resource.js","sourceRoot":"","sources":["../../../milvus/grpc/Resource.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAwC;AACxC,2BAYa;AAEb,MAAa,QAAS,SAAQ,qBAAS;IACrC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,mBAAmB,CAAC,IAA4B;;YACpD,MAAM,OAAO,GAAG,MAAM,IAAA,aAAS,EAC7B,IAAI,CAAC,MAAM,EACX,qBAAqB,EACrB,IAAI,EACJ,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,OAAO,CAC7B,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,kBAAkB,CACtB,IAAkB;;YAElB,MAAM,OAAO,GAAG,MAAM,IAAA,aAAS,EAC7B,IAAI,CAAC,MAAM,EACX,oBAAoB,EACpB,EAAE,EACF,CAA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IACG,qBAAqB;;YACzB,0BAA0B;YAC1B,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAE5D,MAAM,GAAG,GAAG,EAAE,CAAC;YAEf,mCAAmC;YACnC,yDAAyD;YACzD,kDAAkD;YAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBAC/C,MAAM,QAAQ,GAAG,eAAe,CAAC,CAAC,CAAC,CAAC;gBACpC,IAAI,QAAQ,KAAK,0BAAsB,EAAE;oBACvC,aAAa;oBACb,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,qBAAqB,CAAC;wBAC9C,cAAc,EAAE,QAAQ;qBACzB,CAAC,CAAC;oBAEH,2CAA2C;oBAC3C,IAAI,MAAM,CAAC,cAAc,CAAC,QAAQ,GAAG,CAAC,EAAE;wBACtC,uBAAuB;wBACvB,MAAM,IAAI,CAAC,YAAY,CAAC;4BACtB,qBAAqB,EAAE,QAAQ;4BAC/B,qBAAqB,EAAE,0BAAsB;4BAC7C,QAAQ,EAAE,MAAM,CAAC,cAAc,CAAC,QAAQ;yBACzC,CAAC,CAAC;qBACJ;oBAED,UAAU;oBACV,GAAG,CAAC,IAAI,CACN,MAAM,IAAI,CAAC,iBAAiB,CAAC;wBAC3B,cAAc,EAAE,QAAQ;qBACzB,CAAC,CACH,CAAC;iBACH;aACF;YACD,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;KAAA;CACF;AAzQD,4BAyQC"}
@@ -1,5 +1,5 @@
1
1
  import { Resource } from './Resource';
2
- import { CreateUserReq, DeleteUserReq, ListUsersReq, UpdateUserReq, CreateRoleReq, DropRoleReq, AddUserToRoleReq, RemoveUserFromRoleReq, SelectRoleReq, SelectUserReq, OperateRolePrivilegeReq, SelectGrantReq, ListGrantsReq, HasRoleReq, GrpcTimeOut, ListCredUsersResponse, ResStatus, SelectRoleResponse, SelectUserResponse, SelectGrantResponse, HasRoleResponse } from '.';
2
+ import { CreateUserReq, DeleteUserReq, ListUsersReq, UpdateUserReq, CreateRoleReq, DropRoleReq, AddUserToRoleReq, RemoveUserFromRoleReq, SelectRoleReq, SelectUserReq, OperateRolePrivilegeReq, SelectGrantReq, ListGrantsReq, HasRoleReq, GrpcTimeOut, ListCredUsersResponse, ResStatus, SelectRoleResponse, SelectUserResponse, SelectGrantResponse, HasRoleResponse } from '../';
3
3
  export declare class User extends Resource {
4
4
  /**
5
5
  * Create user in milvus