@lazycatcloud/sdk 0.1.142 → 0.1.144

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 (216) hide show
  1. package/common/box.ts +545 -0
  2. package/common/browseronly.ts +520 -0
  3. package/common/end_device.ts +635 -0
  4. package/common/file_handler.ts +485 -0
  5. package/common/filetrans.ts +1936 -0
  6. package/common/gateway.ts +663 -0
  7. package/common/media_meta.ts +319 -0
  8. package/common/message.ts +242 -0
  9. package/common/peripheral_device.ts +783 -0
  10. package/common/security_context.ts +729 -0
  11. package/common/users.ts +1044 -0
  12. package/dist/common/box.d.ts +1 -1
  13. package/dist/common/box.d.ts.map +1 -1
  14. package/dist/common/box.js +21 -37
  15. package/dist/common/box.js.map +1 -1
  16. package/dist/common/browseronly.d.ts +2 -2
  17. package/dist/common/browseronly.d.ts.map +1 -1
  18. package/dist/common/browseronly.js +12 -23
  19. package/dist/common/browseronly.js.map +1 -1
  20. package/dist/common/end_device.d.ts +2 -2
  21. package/dist/common/end_device.d.ts.map +1 -1
  22. package/dist/common/end_device.js +18 -41
  23. package/dist/common/end_device.js.map +1 -1
  24. package/dist/common/file_handler.d.ts.map +1 -1
  25. package/dist/common/file_handler.js +5 -15
  26. package/dist/common/file_handler.js.map +1 -1
  27. package/dist/common/filetrans.d.ts +2 -2
  28. package/dist/common/filetrans.d.ts.map +1 -1
  29. package/dist/common/filetrans.js +94 -221
  30. package/dist/common/filetrans.js.map +1 -1
  31. package/dist/common/gateway.d.ts +1 -1
  32. package/dist/common/gateway.d.ts.map +1 -1
  33. package/dist/common/gateway.js +14 -33
  34. package/dist/common/gateway.js.map +1 -1
  35. package/dist/common/media_meta.d.ts +85 -0
  36. package/dist/common/media_meta.d.ts.map +1 -0
  37. package/dist/common/media_meta.js +233 -0
  38. package/dist/common/media_meta.js.map +1 -0
  39. package/dist/common/message.d.ts.map +1 -1
  40. package/dist/common/message.js +13 -23
  41. package/dist/common/message.js.map +1 -1
  42. package/dist/common/peripheral_device.d.ts +2 -2
  43. package/dist/common/peripheral_device.d.ts.map +1 -1
  44. package/dist/common/peripheral_device.js +22 -39
  45. package/dist/common/peripheral_device.js.map +1 -1
  46. package/dist/common/security_context.d.ts.map +1 -1
  47. package/dist/common/security_context.js +11 -33
  48. package/dist/common/security_context.js.map +1 -1
  49. package/dist/common/users.d.ts +2 -2
  50. package/dist/common/users.d.ts.map +1 -1
  51. package/dist/common/users.js +10 -24
  52. package/dist/common/users.js.map +1 -1
  53. package/dist/dlna/dlna.d.ts +2 -2
  54. package/dist/dlna/dlna.d.ts.map +1 -1
  55. package/dist/dlna/dlna.js +23 -58
  56. package/dist/dlna/dlna.js.map +1 -1
  57. package/dist/extentions/app_common.d.ts +1 -1
  58. package/dist/extentions/app_common.d.ts.map +1 -1
  59. package/dist/extentions/app_common.js +21 -8
  60. package/dist/extentions/app_common.js.map +1 -1
  61. package/dist/extentions/index.d.ts +1 -1
  62. package/dist/extentions/index.d.ts.map +1 -1
  63. package/dist/extentions/unsafe_app.d.ts +3 -0
  64. package/dist/extentions/unsafe_app.d.ts.map +1 -1
  65. package/dist/extentions/unsafe_app.js +21 -0
  66. package/dist/extentions/unsafe_app.js.map +1 -1
  67. package/dist/google/protobuf/descriptor.d.ts +0 -1
  68. package/dist/google/protobuf/descriptor.d.ts.map +1 -1
  69. package/dist/google/protobuf/descriptor.js +176 -406
  70. package/dist/google/protobuf/descriptor.js.map +1 -1
  71. package/dist/google/protobuf/empty.d.ts.map +1 -1
  72. package/dist/google/protobuf/empty.js.map +1 -1
  73. package/dist/google/protobuf/timestamp.d.ts +0 -2
  74. package/dist/google/protobuf/timestamp.d.ts.map +1 -1
  75. package/dist/google/protobuf/timestamp.js +9 -6
  76. package/dist/google/protobuf/timestamp.js.map +1 -1
  77. package/dist/lanforward/lanforward.d.ts +1 -1
  78. package/dist/lanforward/lanforward.d.ts.map +1 -1
  79. package/dist/lanforward/lanforward.js +7 -12
  80. package/dist/lanforward/lanforward.js.map +1 -1
  81. package/dist/localdevice/clipboard.d.ts +1 -1
  82. package/dist/localdevice/clipboard.d.ts.map +1 -1
  83. package/dist/localdevice/clipboard.js +17 -25
  84. package/dist/localdevice/clipboard.js.map +1 -1
  85. package/dist/localdevice/config.d.ts.map +1 -1
  86. package/dist/localdevice/config.js +3 -8
  87. package/dist/localdevice/config.js.map +1 -1
  88. package/dist/localdevice/device.d.ts +1 -1
  89. package/dist/localdevice/device.d.ts.map +1 -1
  90. package/dist/localdevice/device.js +4 -9
  91. package/dist/localdevice/device.js.map +1 -1
  92. package/dist/localdevice/dialog.d.ts +1 -1
  93. package/dist/localdevice/dialog.d.ts.map +1 -1
  94. package/dist/localdevice/dialog.js +8 -22
  95. package/dist/localdevice/dialog.js.map +1 -1
  96. package/dist/localdevice/local-launch.d.ts.map +1 -1
  97. package/dist/localdevice/local-launch.js +9 -32
  98. package/dist/localdevice/local-launch.js.map +1 -1
  99. package/dist/localdevice/network.d.ts +1 -1
  100. package/dist/localdevice/network.d.ts.map +1 -1
  101. package/dist/localdevice/network.js +3 -6
  102. package/dist/localdevice/network.js.map +1 -1
  103. package/dist/localdevice/permission.d.ts +1 -1
  104. package/dist/localdevice/permission.d.ts.map +1 -1
  105. package/dist/localdevice/permission.js +18 -35
  106. package/dist/localdevice/permission.js.map +1 -1
  107. package/dist/localdevice/photo.d.ts +1 -1
  108. package/dist/localdevice/photo.d.ts.map +1 -1
  109. package/dist/localdevice/photo.js +64 -156
  110. package/dist/localdevice/photo.js.map +1 -1
  111. package/dist/package.json +1 -5
  112. package/dist/ssdp/ssdp.d.ts +1 -1
  113. package/dist/ssdp/ssdp.d.ts.map +1 -1
  114. package/dist/ssdp/ssdp.js +6 -9
  115. package/dist/ssdp/ssdp.js.map +1 -1
  116. package/dist/sys/OS_daemon.d.ts +1 -1
  117. package/dist/sys/OS_daemon.d.ts.map +1 -1
  118. package/dist/sys/OS_daemon.js +5 -14
  119. package/dist/sys/OS_daemon.js.map +1 -1
  120. package/dist/sys/OS_snapshot.d.ts +1 -1
  121. package/dist/sys/OS_snapshot.d.ts.map +1 -1
  122. package/dist/sys/OS_snapshot.js +41 -81
  123. package/dist/sys/OS_snapshot.js.map +1 -1
  124. package/dist/sys/OS_upgrader.d.ts +1 -1
  125. package/dist/sys/OS_upgrader.d.ts.map +1 -1
  126. package/dist/sys/OS_upgrader.js +22 -39
  127. package/dist/sys/OS_upgrader.js.map +1 -1
  128. package/dist/sys/btrfs.d.ts +1 -1
  129. package/dist/sys/btrfs.d.ts.map +1 -1
  130. package/dist/sys/btrfs.js +14 -22
  131. package/dist/sys/btrfs.js.map +1 -1
  132. package/dist/sys/devopt.d.ts +1 -1
  133. package/dist/sys/devopt.d.ts.map +1 -1
  134. package/dist/sys/devopt.js +9 -25
  135. package/dist/sys/devopt.js.map +1 -1
  136. package/dist/sys/event.d.ts +2 -2
  137. package/dist/sys/event.d.ts.map +1 -1
  138. package/dist/sys/event.js +15 -30
  139. package/dist/sys/event.js.map +1 -1
  140. package/dist/sys/hc-core/hc-core.d.ts +2 -2
  141. package/dist/sys/hc-core/hc-core.d.ts.map +1 -1
  142. package/dist/sys/hc-core/hc-core.js +32 -65
  143. package/dist/sys/hc-core/hc-core.js.map +1 -1
  144. package/dist/sys/ingress.d.ts +1 -1
  145. package/dist/sys/ingress.d.ts.map +1 -1
  146. package/dist/sys/ingress.js +19 -36
  147. package/dist/sys/ingress.js.map +1 -1
  148. package/dist/sys/network_manager.d.ts +1 -1
  149. package/dist/sys/network_manager.d.ts.map +1 -1
  150. package/dist/sys/network_manager.js +22 -66
  151. package/dist/sys/network_manager.js.map +1 -1
  152. package/dist/sys/package_manager.d.ts +1 -1
  153. package/dist/sys/package_manager.d.ts.map +1 -1
  154. package/dist/sys/package_manager.js +36 -73
  155. package/dist/sys/package_manager.js.map +1 -1
  156. package/dist/sys/portal-server/portal-server.d.ts +2 -2
  157. package/dist/sys/portal-server/portal-server.d.ts.map +1 -1
  158. package/dist/sys/portal-server/portal-server.js +62 -157
  159. package/dist/sys/portal-server/portal-server.js.map +1 -1
  160. package/dist/sys/snapd.d.ts +1 -1
  161. package/dist/sys/snapd.d.ts.map +1 -1
  162. package/dist/sys/snapd.js +20 -50
  163. package/dist/sys/snapd.js.map +1 -1
  164. package/dlna/dlna.ts +895 -0
  165. package/docs/contribute.md +40 -0
  166. package/docs/extentions/AppCommon.md +30 -0
  167. package/extentions/app_common.ts +63 -0
  168. package/extentions/base.ts +459 -0
  169. package/extentions/index.ts +27 -0
  170. package/extentions/safe_app.ts +60 -0
  171. package/extentions/unsafe_app.ts +107 -0
  172. package/google/protobuf/descriptor.ts +3778 -0
  173. package/google/protobuf/empty.ts +64 -0
  174. package/google/protobuf/timestamp.ts +214 -0
  175. package/grpcweb.ts +106 -0
  176. package/index.ts +204 -0
  177. package/lanforward/lanforward.ts +301 -0
  178. package/localdevice/clipboard.ts +499 -0
  179. package/localdevice/config.ts +268 -0
  180. package/localdevice/device.ts +218 -0
  181. package/localdevice/dialog.ts +707 -0
  182. package/localdevice/local-launch.ts +954 -0
  183. package/localdevice/network.ts +273 -0
  184. package/localdevice/permission.ts +733 -0
  185. package/localdevice/photo.ts +1497 -0
  186. package/package.json +1 -5
  187. package/ssdp/ssdp.ts +332 -0
  188. package/sys/OS_daemon.ts +325 -0
  189. package/sys/OS_snapshot.ts +1714 -0
  190. package/sys/OS_upgrader.ts +782 -0
  191. package/sys/btrfs.ts +530 -0
  192. package/sys/devopt.ts +250 -0
  193. package/sys/event.ts +787 -0
  194. package/sys/hc-core/hc-core.ts +1582 -0
  195. package/sys/ingress.ts +953 -0
  196. package/sys/network_manager.ts +874 -0
  197. package/sys/package_manager.ts +1931 -0
  198. package/sys/portal-server/portal-server.ts +2934 -0
  199. package/sys/snapd.ts +861 -0
  200. package/tsconfig.json +15 -0
  201. package/dist/API.d.ts +0 -24
  202. package/dist/API.d.ts.map +0 -1
  203. package/dist/API.js +0 -117
  204. package/dist/API.js.map +0 -1
  205. package/dist/google/protobuf/wrappers.d.ts +0 -182
  206. package/dist/google/protobuf/wrappers.d.ts.map +0 -1
  207. package/dist/google/protobuf/wrappers.js +0 -458
  208. package/dist/google/protobuf/wrappers.js.map +0 -1
  209. package/dist/sys/message.d.ts +0 -186
  210. package/dist/sys/message.d.ts.map +0 -1
  211. package/dist/sys/message.js +0 -493
  212. package/dist/sys/message.js.map +0 -1
  213. package/dist/sys/settings.d.ts +0 -68
  214. package/dist/sys/settings.d.ts.map +0 -1
  215. package/dist/sys/settings.js +0 -183
  216. package/dist/sys/settings.js.map +0 -1
@@ -0,0 +1,1714 @@
1
+ /* eslint-disable */
2
+ import { grpc } from "@improbable-eng/grpc-web";
3
+ import { BrowserHeaders } from "browser-headers";
4
+ import Long from "long";
5
+ import _m0 from "protobufjs/minimal";
6
+ import { Empty } from "../google/protobuf/empty";
7
+
8
+ export enum SnapshotManagerStatus {
9
+ Stopped = 0,
10
+ Running = 1,
11
+ UNRECOGNIZED = -1,
12
+ }
13
+
14
+ export function snapshotManagerStatusFromJSON(object: any): SnapshotManagerStatus {
15
+ switch (object) {
16
+ case 0:
17
+ case "Stopped":
18
+ return SnapshotManagerStatus.Stopped;
19
+ case 1:
20
+ case "Running":
21
+ return SnapshotManagerStatus.Running;
22
+ case -1:
23
+ case "UNRECOGNIZED":
24
+ default:
25
+ return SnapshotManagerStatus.UNRECOGNIZED;
26
+ }
27
+ }
28
+
29
+ export function snapshotManagerStatusToJSON(object: SnapshotManagerStatus): string {
30
+ switch (object) {
31
+ case SnapshotManagerStatus.Stopped:
32
+ return "Stopped";
33
+ case SnapshotManagerStatus.Running:
34
+ return "Running";
35
+ case SnapshotManagerStatus.UNRECOGNIZED:
36
+ default:
37
+ return "UNRECOGNIZED";
38
+ }
39
+ }
40
+
41
+ export enum SnapshotTransferMode {
42
+ Normal = 0,
43
+ /** NoResume - 若存在可恢复的传输任务,是否不尝试恢复,重新传输 */
44
+ NoResume = 1,
45
+ /** DryRun - 不进行传输,只预估传输的数据量 */
46
+ DryRun = 2,
47
+ UNRECOGNIZED = -1,
48
+ }
49
+
50
+ export function snapshotTransferModeFromJSON(object: any): SnapshotTransferMode {
51
+ switch (object) {
52
+ case 0:
53
+ case "Normal":
54
+ return SnapshotTransferMode.Normal;
55
+ case 1:
56
+ case "NoResume":
57
+ return SnapshotTransferMode.NoResume;
58
+ case 2:
59
+ case "DryRun":
60
+ return SnapshotTransferMode.DryRun;
61
+ case -1:
62
+ case "UNRECOGNIZED":
63
+ default:
64
+ return SnapshotTransferMode.UNRECOGNIZED;
65
+ }
66
+ }
67
+
68
+ export function snapshotTransferModeToJSON(object: SnapshotTransferMode): string {
69
+ switch (object) {
70
+ case SnapshotTransferMode.Normal:
71
+ return "Normal";
72
+ case SnapshotTransferMode.NoResume:
73
+ return "NoResume";
74
+ case SnapshotTransferMode.DryRun:
75
+ return "DryRun";
76
+ case SnapshotTransferMode.UNRECOGNIZED:
77
+ default:
78
+ return "UNRECOGNIZED";
79
+ }
80
+ }
81
+
82
+ export interface SnapshotBackupPoolRequest {
83
+ /** 用于备份的 ZFS 池的名称 */
84
+ PoolName: string;
85
+ }
86
+
87
+ export interface SnapshotBackupPoolListResponse {
88
+ PoolNameList: string[];
89
+ }
90
+
91
+ export interface SnapshotDatasetRequest {
92
+ /**
93
+ * 数据集挂载点的绝对路径。
94
+ * 对应的数据集名称会根据路径自动生成,无需客户端关注
95
+ */
96
+ DatasetPath: string;
97
+ }
98
+
99
+ export interface SnapshotDatasetBackupRequest {
100
+ PoolName: string;
101
+ DatasetPath: string;
102
+ }
103
+
104
+ export interface SnapshotDatasetDesc {
105
+ Path: string;
106
+ /** 数据集自身占用的存储空间大小 */
107
+ BytesUsed: number;
108
+ /** 数据集的快照占用的存储空间大小 */
109
+ SnapshotBytesUsed: number;
110
+ CreatedAt: number;
111
+ }
112
+
113
+ export interface SnapshotDatasetListResponse {
114
+ DatasetList: SnapshotDatasetDesc[];
115
+ }
116
+
117
+ export interface SnapshotRequest {
118
+ DatasetPath: string;
119
+ /** 快照名称("@" 之后的部分) */
120
+ SnapshotName: string;
121
+ }
122
+
123
+ export interface SnapshotDesc {
124
+ Name: string;
125
+ BytesUsed: number;
126
+ CreatedAt: number;
127
+ }
128
+
129
+ export interface SnapshotListResponse {
130
+ SnapshotList: SnapshotDesc[];
131
+ }
132
+
133
+ export interface SnapshotBackupRequest {
134
+ PoolName: string;
135
+ DatasetPath: string;
136
+ SnapshotName: string;
137
+ }
138
+
139
+ export interface SnapshotBackupTransferRequest {
140
+ PoolName: string;
141
+ DatasetPath: string;
142
+ SnapshotName: string;
143
+ TransferMode: SnapshotTransferMode;
144
+ }
145
+
146
+ export interface SnapshotBackupTransferResponse {
147
+ /**
148
+ * 若存在可恢复的传输任务,则为已传输的数据量
149
+ * 当 TransferMode 为 NoResume 时,忽略该字段
150
+ */
151
+ BytesSent: number;
152
+ BytesTotal: number;
153
+ }
154
+
155
+ export interface SnapshotBackupListRequest {
156
+ PoolName: string;
157
+ DatasetPath: string;
158
+ }
159
+
160
+ export interface SnapshotStatusResponse {
161
+ Status: SnapshotManagerStatus;
162
+ /** 最近一次传输任务中,已传输的数据量 */
163
+ BytesSent: number;
164
+ /**
165
+ * 最近一次传输任务中,预估的总数据量。
166
+ * 实际需要传输的数据量一般会略小于该数值。判断传输任务是否完成,以 Status 字段为准
167
+ */
168
+ BytesTotal: number;
169
+ }
170
+
171
+ function createBaseSnapshotBackupPoolRequest(): SnapshotBackupPoolRequest {
172
+ return { PoolName: "" };
173
+ }
174
+
175
+ export const SnapshotBackupPoolRequest = {
176
+ encode(message: SnapshotBackupPoolRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
177
+ if (message.PoolName !== "") {
178
+ writer.uint32(10).string(message.PoolName);
179
+ }
180
+ return writer;
181
+ },
182
+
183
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotBackupPoolRequest {
184
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
185
+ let end = length === undefined ? reader.len : reader.pos + length;
186
+ const message = createBaseSnapshotBackupPoolRequest();
187
+ while (reader.pos < end) {
188
+ const tag = reader.uint32();
189
+ switch (tag >>> 3) {
190
+ case 1:
191
+ message.PoolName = reader.string();
192
+ break;
193
+ default:
194
+ reader.skipType(tag & 7);
195
+ break;
196
+ }
197
+ }
198
+ return message;
199
+ },
200
+
201
+ fromJSON(object: any): SnapshotBackupPoolRequest {
202
+ return { PoolName: isSet(object.PoolName) ? String(object.PoolName) : "" };
203
+ },
204
+
205
+ toJSON(message: SnapshotBackupPoolRequest): unknown {
206
+ const obj: any = {};
207
+ message.PoolName !== undefined && (obj.PoolName = message.PoolName);
208
+ return obj;
209
+ },
210
+
211
+ fromPartial<I extends Exact<DeepPartial<SnapshotBackupPoolRequest>, I>>(object: I): SnapshotBackupPoolRequest {
212
+ const message = createBaseSnapshotBackupPoolRequest();
213
+ message.PoolName = object.PoolName ?? "";
214
+ return message;
215
+ },
216
+ };
217
+
218
+ function createBaseSnapshotBackupPoolListResponse(): SnapshotBackupPoolListResponse {
219
+ return { PoolNameList: [] };
220
+ }
221
+
222
+ export const SnapshotBackupPoolListResponse = {
223
+ encode(message: SnapshotBackupPoolListResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
224
+ for (const v of message.PoolNameList) {
225
+ writer.uint32(10).string(v!);
226
+ }
227
+ return writer;
228
+ },
229
+
230
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotBackupPoolListResponse {
231
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
232
+ let end = length === undefined ? reader.len : reader.pos + length;
233
+ const message = createBaseSnapshotBackupPoolListResponse();
234
+ while (reader.pos < end) {
235
+ const tag = reader.uint32();
236
+ switch (tag >>> 3) {
237
+ case 1:
238
+ message.PoolNameList.push(reader.string());
239
+ break;
240
+ default:
241
+ reader.skipType(tag & 7);
242
+ break;
243
+ }
244
+ }
245
+ return message;
246
+ },
247
+
248
+ fromJSON(object: any): SnapshotBackupPoolListResponse {
249
+ return { PoolNameList: Array.isArray(object?.PoolNameList) ? object.PoolNameList.map((e: any) => String(e)) : [] };
250
+ },
251
+
252
+ toJSON(message: SnapshotBackupPoolListResponse): unknown {
253
+ const obj: any = {};
254
+ if (message.PoolNameList) {
255
+ obj.PoolNameList = message.PoolNameList.map((e) => e);
256
+ } else {
257
+ obj.PoolNameList = [];
258
+ }
259
+ return obj;
260
+ },
261
+
262
+ fromPartial<I extends Exact<DeepPartial<SnapshotBackupPoolListResponse>, I>>(
263
+ object: I,
264
+ ): SnapshotBackupPoolListResponse {
265
+ const message = createBaseSnapshotBackupPoolListResponse();
266
+ message.PoolNameList = object.PoolNameList?.map((e) => e) || [];
267
+ return message;
268
+ },
269
+ };
270
+
271
+ function createBaseSnapshotDatasetRequest(): SnapshotDatasetRequest {
272
+ return { DatasetPath: "" };
273
+ }
274
+
275
+ export const SnapshotDatasetRequest = {
276
+ encode(message: SnapshotDatasetRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
277
+ if (message.DatasetPath !== "") {
278
+ writer.uint32(10).string(message.DatasetPath);
279
+ }
280
+ return writer;
281
+ },
282
+
283
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotDatasetRequest {
284
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
285
+ let end = length === undefined ? reader.len : reader.pos + length;
286
+ const message = createBaseSnapshotDatasetRequest();
287
+ while (reader.pos < end) {
288
+ const tag = reader.uint32();
289
+ switch (tag >>> 3) {
290
+ case 1:
291
+ message.DatasetPath = reader.string();
292
+ break;
293
+ default:
294
+ reader.skipType(tag & 7);
295
+ break;
296
+ }
297
+ }
298
+ return message;
299
+ },
300
+
301
+ fromJSON(object: any): SnapshotDatasetRequest {
302
+ return { DatasetPath: isSet(object.DatasetPath) ? String(object.DatasetPath) : "" };
303
+ },
304
+
305
+ toJSON(message: SnapshotDatasetRequest): unknown {
306
+ const obj: any = {};
307
+ message.DatasetPath !== undefined && (obj.DatasetPath = message.DatasetPath);
308
+ return obj;
309
+ },
310
+
311
+ fromPartial<I extends Exact<DeepPartial<SnapshotDatasetRequest>, I>>(object: I): SnapshotDatasetRequest {
312
+ const message = createBaseSnapshotDatasetRequest();
313
+ message.DatasetPath = object.DatasetPath ?? "";
314
+ return message;
315
+ },
316
+ };
317
+
318
+ function createBaseSnapshotDatasetBackupRequest(): SnapshotDatasetBackupRequest {
319
+ return { PoolName: "", DatasetPath: "" };
320
+ }
321
+
322
+ export const SnapshotDatasetBackupRequest = {
323
+ encode(message: SnapshotDatasetBackupRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
324
+ if (message.PoolName !== "") {
325
+ writer.uint32(10).string(message.PoolName);
326
+ }
327
+ if (message.DatasetPath !== "") {
328
+ writer.uint32(18).string(message.DatasetPath);
329
+ }
330
+ return writer;
331
+ },
332
+
333
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotDatasetBackupRequest {
334
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
335
+ let end = length === undefined ? reader.len : reader.pos + length;
336
+ const message = createBaseSnapshotDatasetBackupRequest();
337
+ while (reader.pos < end) {
338
+ const tag = reader.uint32();
339
+ switch (tag >>> 3) {
340
+ case 1:
341
+ message.PoolName = reader.string();
342
+ break;
343
+ case 2:
344
+ message.DatasetPath = reader.string();
345
+ break;
346
+ default:
347
+ reader.skipType(tag & 7);
348
+ break;
349
+ }
350
+ }
351
+ return message;
352
+ },
353
+
354
+ fromJSON(object: any): SnapshotDatasetBackupRequest {
355
+ return {
356
+ PoolName: isSet(object.PoolName) ? String(object.PoolName) : "",
357
+ DatasetPath: isSet(object.DatasetPath) ? String(object.DatasetPath) : "",
358
+ };
359
+ },
360
+
361
+ toJSON(message: SnapshotDatasetBackupRequest): unknown {
362
+ const obj: any = {};
363
+ message.PoolName !== undefined && (obj.PoolName = message.PoolName);
364
+ message.DatasetPath !== undefined && (obj.DatasetPath = message.DatasetPath);
365
+ return obj;
366
+ },
367
+
368
+ fromPartial<I extends Exact<DeepPartial<SnapshotDatasetBackupRequest>, I>>(object: I): SnapshotDatasetBackupRequest {
369
+ const message = createBaseSnapshotDatasetBackupRequest();
370
+ message.PoolName = object.PoolName ?? "";
371
+ message.DatasetPath = object.DatasetPath ?? "";
372
+ return message;
373
+ },
374
+ };
375
+
376
+ function createBaseSnapshotDatasetDesc(): SnapshotDatasetDesc {
377
+ return { Path: "", BytesUsed: 0, SnapshotBytesUsed: 0, CreatedAt: 0 };
378
+ }
379
+
380
+ export const SnapshotDatasetDesc = {
381
+ encode(message: SnapshotDatasetDesc, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
382
+ if (message.Path !== "") {
383
+ writer.uint32(10).string(message.Path);
384
+ }
385
+ if (message.BytesUsed !== 0) {
386
+ writer.uint32(16).uint64(message.BytesUsed);
387
+ }
388
+ if (message.SnapshotBytesUsed !== 0) {
389
+ writer.uint32(24).uint64(message.SnapshotBytesUsed);
390
+ }
391
+ if (message.CreatedAt !== 0) {
392
+ writer.uint32(32).uint64(message.CreatedAt);
393
+ }
394
+ return writer;
395
+ },
396
+
397
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotDatasetDesc {
398
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
399
+ let end = length === undefined ? reader.len : reader.pos + length;
400
+ const message = createBaseSnapshotDatasetDesc();
401
+ while (reader.pos < end) {
402
+ const tag = reader.uint32();
403
+ switch (tag >>> 3) {
404
+ case 1:
405
+ message.Path = reader.string();
406
+ break;
407
+ case 2:
408
+ message.BytesUsed = longToNumber(reader.uint64() as Long);
409
+ break;
410
+ case 3:
411
+ message.SnapshotBytesUsed = longToNumber(reader.uint64() as Long);
412
+ break;
413
+ case 4:
414
+ message.CreatedAt = longToNumber(reader.uint64() as Long);
415
+ break;
416
+ default:
417
+ reader.skipType(tag & 7);
418
+ break;
419
+ }
420
+ }
421
+ return message;
422
+ },
423
+
424
+ fromJSON(object: any): SnapshotDatasetDesc {
425
+ return {
426
+ Path: isSet(object.Path) ? String(object.Path) : "",
427
+ BytesUsed: isSet(object.BytesUsed) ? Number(object.BytesUsed) : 0,
428
+ SnapshotBytesUsed: isSet(object.SnapshotBytesUsed) ? Number(object.SnapshotBytesUsed) : 0,
429
+ CreatedAt: isSet(object.CreatedAt) ? Number(object.CreatedAt) : 0,
430
+ };
431
+ },
432
+
433
+ toJSON(message: SnapshotDatasetDesc): unknown {
434
+ const obj: any = {};
435
+ message.Path !== undefined && (obj.Path = message.Path);
436
+ message.BytesUsed !== undefined && (obj.BytesUsed = Math.round(message.BytesUsed));
437
+ message.SnapshotBytesUsed !== undefined && (obj.SnapshotBytesUsed = Math.round(message.SnapshotBytesUsed));
438
+ message.CreatedAt !== undefined && (obj.CreatedAt = Math.round(message.CreatedAt));
439
+ return obj;
440
+ },
441
+
442
+ fromPartial<I extends Exact<DeepPartial<SnapshotDatasetDesc>, I>>(object: I): SnapshotDatasetDesc {
443
+ const message = createBaseSnapshotDatasetDesc();
444
+ message.Path = object.Path ?? "";
445
+ message.BytesUsed = object.BytesUsed ?? 0;
446
+ message.SnapshotBytesUsed = object.SnapshotBytesUsed ?? 0;
447
+ message.CreatedAt = object.CreatedAt ?? 0;
448
+ return message;
449
+ },
450
+ };
451
+
452
+ function createBaseSnapshotDatasetListResponse(): SnapshotDatasetListResponse {
453
+ return { DatasetList: [] };
454
+ }
455
+
456
+ export const SnapshotDatasetListResponse = {
457
+ encode(message: SnapshotDatasetListResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
458
+ for (const v of message.DatasetList) {
459
+ SnapshotDatasetDesc.encode(v!, writer.uint32(10).fork()).ldelim();
460
+ }
461
+ return writer;
462
+ },
463
+
464
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotDatasetListResponse {
465
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
466
+ let end = length === undefined ? reader.len : reader.pos + length;
467
+ const message = createBaseSnapshotDatasetListResponse();
468
+ while (reader.pos < end) {
469
+ const tag = reader.uint32();
470
+ switch (tag >>> 3) {
471
+ case 1:
472
+ message.DatasetList.push(SnapshotDatasetDesc.decode(reader, reader.uint32()));
473
+ break;
474
+ default:
475
+ reader.skipType(tag & 7);
476
+ break;
477
+ }
478
+ }
479
+ return message;
480
+ },
481
+
482
+ fromJSON(object: any): SnapshotDatasetListResponse {
483
+ return {
484
+ DatasetList: Array.isArray(object?.DatasetList)
485
+ ? object.DatasetList.map((e: any) => SnapshotDatasetDesc.fromJSON(e))
486
+ : [],
487
+ };
488
+ },
489
+
490
+ toJSON(message: SnapshotDatasetListResponse): unknown {
491
+ const obj: any = {};
492
+ if (message.DatasetList) {
493
+ obj.DatasetList = message.DatasetList.map((e) => e ? SnapshotDatasetDesc.toJSON(e) : undefined);
494
+ } else {
495
+ obj.DatasetList = [];
496
+ }
497
+ return obj;
498
+ },
499
+
500
+ fromPartial<I extends Exact<DeepPartial<SnapshotDatasetListResponse>, I>>(object: I): SnapshotDatasetListResponse {
501
+ const message = createBaseSnapshotDatasetListResponse();
502
+ message.DatasetList = object.DatasetList?.map((e) => SnapshotDatasetDesc.fromPartial(e)) || [];
503
+ return message;
504
+ },
505
+ };
506
+
507
+ function createBaseSnapshotRequest(): SnapshotRequest {
508
+ return { DatasetPath: "", SnapshotName: "" };
509
+ }
510
+
511
+ export const SnapshotRequest = {
512
+ encode(message: SnapshotRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
513
+ if (message.DatasetPath !== "") {
514
+ writer.uint32(10).string(message.DatasetPath);
515
+ }
516
+ if (message.SnapshotName !== "") {
517
+ writer.uint32(18).string(message.SnapshotName);
518
+ }
519
+ return writer;
520
+ },
521
+
522
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotRequest {
523
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
524
+ let end = length === undefined ? reader.len : reader.pos + length;
525
+ const message = createBaseSnapshotRequest();
526
+ while (reader.pos < end) {
527
+ const tag = reader.uint32();
528
+ switch (tag >>> 3) {
529
+ case 1:
530
+ message.DatasetPath = reader.string();
531
+ break;
532
+ case 2:
533
+ message.SnapshotName = reader.string();
534
+ break;
535
+ default:
536
+ reader.skipType(tag & 7);
537
+ break;
538
+ }
539
+ }
540
+ return message;
541
+ },
542
+
543
+ fromJSON(object: any): SnapshotRequest {
544
+ return {
545
+ DatasetPath: isSet(object.DatasetPath) ? String(object.DatasetPath) : "",
546
+ SnapshotName: isSet(object.SnapshotName) ? String(object.SnapshotName) : "",
547
+ };
548
+ },
549
+
550
+ toJSON(message: SnapshotRequest): unknown {
551
+ const obj: any = {};
552
+ message.DatasetPath !== undefined && (obj.DatasetPath = message.DatasetPath);
553
+ message.SnapshotName !== undefined && (obj.SnapshotName = message.SnapshotName);
554
+ return obj;
555
+ },
556
+
557
+ fromPartial<I extends Exact<DeepPartial<SnapshotRequest>, I>>(object: I): SnapshotRequest {
558
+ const message = createBaseSnapshotRequest();
559
+ message.DatasetPath = object.DatasetPath ?? "";
560
+ message.SnapshotName = object.SnapshotName ?? "";
561
+ return message;
562
+ },
563
+ };
564
+
565
+ function createBaseSnapshotDesc(): SnapshotDesc {
566
+ return { Name: "", BytesUsed: 0, CreatedAt: 0 };
567
+ }
568
+
569
+ export const SnapshotDesc = {
570
+ encode(message: SnapshotDesc, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
571
+ if (message.Name !== "") {
572
+ writer.uint32(10).string(message.Name);
573
+ }
574
+ if (message.BytesUsed !== 0) {
575
+ writer.uint32(16).uint64(message.BytesUsed);
576
+ }
577
+ if (message.CreatedAt !== 0) {
578
+ writer.uint32(24).uint64(message.CreatedAt);
579
+ }
580
+ return writer;
581
+ },
582
+
583
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotDesc {
584
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
585
+ let end = length === undefined ? reader.len : reader.pos + length;
586
+ const message = createBaseSnapshotDesc();
587
+ while (reader.pos < end) {
588
+ const tag = reader.uint32();
589
+ switch (tag >>> 3) {
590
+ case 1:
591
+ message.Name = reader.string();
592
+ break;
593
+ case 2:
594
+ message.BytesUsed = longToNumber(reader.uint64() as Long);
595
+ break;
596
+ case 3:
597
+ message.CreatedAt = longToNumber(reader.uint64() as Long);
598
+ break;
599
+ default:
600
+ reader.skipType(tag & 7);
601
+ break;
602
+ }
603
+ }
604
+ return message;
605
+ },
606
+
607
+ fromJSON(object: any): SnapshotDesc {
608
+ return {
609
+ Name: isSet(object.Name) ? String(object.Name) : "",
610
+ BytesUsed: isSet(object.BytesUsed) ? Number(object.BytesUsed) : 0,
611
+ CreatedAt: isSet(object.CreatedAt) ? Number(object.CreatedAt) : 0,
612
+ };
613
+ },
614
+
615
+ toJSON(message: SnapshotDesc): unknown {
616
+ const obj: any = {};
617
+ message.Name !== undefined && (obj.Name = message.Name);
618
+ message.BytesUsed !== undefined && (obj.BytesUsed = Math.round(message.BytesUsed));
619
+ message.CreatedAt !== undefined && (obj.CreatedAt = Math.round(message.CreatedAt));
620
+ return obj;
621
+ },
622
+
623
+ fromPartial<I extends Exact<DeepPartial<SnapshotDesc>, I>>(object: I): SnapshotDesc {
624
+ const message = createBaseSnapshotDesc();
625
+ message.Name = object.Name ?? "";
626
+ message.BytesUsed = object.BytesUsed ?? 0;
627
+ message.CreatedAt = object.CreatedAt ?? 0;
628
+ return message;
629
+ },
630
+ };
631
+
632
+ function createBaseSnapshotListResponse(): SnapshotListResponse {
633
+ return { SnapshotList: [] };
634
+ }
635
+
636
+ export const SnapshotListResponse = {
637
+ encode(message: SnapshotListResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
638
+ for (const v of message.SnapshotList) {
639
+ SnapshotDesc.encode(v!, writer.uint32(10).fork()).ldelim();
640
+ }
641
+ return writer;
642
+ },
643
+
644
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotListResponse {
645
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
646
+ let end = length === undefined ? reader.len : reader.pos + length;
647
+ const message = createBaseSnapshotListResponse();
648
+ while (reader.pos < end) {
649
+ const tag = reader.uint32();
650
+ switch (tag >>> 3) {
651
+ case 1:
652
+ message.SnapshotList.push(SnapshotDesc.decode(reader, reader.uint32()));
653
+ break;
654
+ default:
655
+ reader.skipType(tag & 7);
656
+ break;
657
+ }
658
+ }
659
+ return message;
660
+ },
661
+
662
+ fromJSON(object: any): SnapshotListResponse {
663
+ return {
664
+ SnapshotList: Array.isArray(object?.SnapshotList)
665
+ ? object.SnapshotList.map((e: any) => SnapshotDesc.fromJSON(e))
666
+ : [],
667
+ };
668
+ },
669
+
670
+ toJSON(message: SnapshotListResponse): unknown {
671
+ const obj: any = {};
672
+ if (message.SnapshotList) {
673
+ obj.SnapshotList = message.SnapshotList.map((e) => e ? SnapshotDesc.toJSON(e) : undefined);
674
+ } else {
675
+ obj.SnapshotList = [];
676
+ }
677
+ return obj;
678
+ },
679
+
680
+ fromPartial<I extends Exact<DeepPartial<SnapshotListResponse>, I>>(object: I): SnapshotListResponse {
681
+ const message = createBaseSnapshotListResponse();
682
+ message.SnapshotList = object.SnapshotList?.map((e) => SnapshotDesc.fromPartial(e)) || [];
683
+ return message;
684
+ },
685
+ };
686
+
687
+ function createBaseSnapshotBackupRequest(): SnapshotBackupRequest {
688
+ return { PoolName: "", DatasetPath: "", SnapshotName: "" };
689
+ }
690
+
691
+ export const SnapshotBackupRequest = {
692
+ encode(message: SnapshotBackupRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
693
+ if (message.PoolName !== "") {
694
+ writer.uint32(10).string(message.PoolName);
695
+ }
696
+ if (message.DatasetPath !== "") {
697
+ writer.uint32(18).string(message.DatasetPath);
698
+ }
699
+ if (message.SnapshotName !== "") {
700
+ writer.uint32(26).string(message.SnapshotName);
701
+ }
702
+ return writer;
703
+ },
704
+
705
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotBackupRequest {
706
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
707
+ let end = length === undefined ? reader.len : reader.pos + length;
708
+ const message = createBaseSnapshotBackupRequest();
709
+ while (reader.pos < end) {
710
+ const tag = reader.uint32();
711
+ switch (tag >>> 3) {
712
+ case 1:
713
+ message.PoolName = reader.string();
714
+ break;
715
+ case 2:
716
+ message.DatasetPath = reader.string();
717
+ break;
718
+ case 3:
719
+ message.SnapshotName = reader.string();
720
+ break;
721
+ default:
722
+ reader.skipType(tag & 7);
723
+ break;
724
+ }
725
+ }
726
+ return message;
727
+ },
728
+
729
+ fromJSON(object: any): SnapshotBackupRequest {
730
+ return {
731
+ PoolName: isSet(object.PoolName) ? String(object.PoolName) : "",
732
+ DatasetPath: isSet(object.DatasetPath) ? String(object.DatasetPath) : "",
733
+ SnapshotName: isSet(object.SnapshotName) ? String(object.SnapshotName) : "",
734
+ };
735
+ },
736
+
737
+ toJSON(message: SnapshotBackupRequest): unknown {
738
+ const obj: any = {};
739
+ message.PoolName !== undefined && (obj.PoolName = message.PoolName);
740
+ message.DatasetPath !== undefined && (obj.DatasetPath = message.DatasetPath);
741
+ message.SnapshotName !== undefined && (obj.SnapshotName = message.SnapshotName);
742
+ return obj;
743
+ },
744
+
745
+ fromPartial<I extends Exact<DeepPartial<SnapshotBackupRequest>, I>>(object: I): SnapshotBackupRequest {
746
+ const message = createBaseSnapshotBackupRequest();
747
+ message.PoolName = object.PoolName ?? "";
748
+ message.DatasetPath = object.DatasetPath ?? "";
749
+ message.SnapshotName = object.SnapshotName ?? "";
750
+ return message;
751
+ },
752
+ };
753
+
754
+ function createBaseSnapshotBackupTransferRequest(): SnapshotBackupTransferRequest {
755
+ return { PoolName: "", DatasetPath: "", SnapshotName: "", TransferMode: 0 };
756
+ }
757
+
758
+ export const SnapshotBackupTransferRequest = {
759
+ encode(message: SnapshotBackupTransferRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
760
+ if (message.PoolName !== "") {
761
+ writer.uint32(10).string(message.PoolName);
762
+ }
763
+ if (message.DatasetPath !== "") {
764
+ writer.uint32(18).string(message.DatasetPath);
765
+ }
766
+ if (message.SnapshotName !== "") {
767
+ writer.uint32(26).string(message.SnapshotName);
768
+ }
769
+ if (message.TransferMode !== 0) {
770
+ writer.uint32(32).int32(message.TransferMode);
771
+ }
772
+ return writer;
773
+ },
774
+
775
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotBackupTransferRequest {
776
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
777
+ let end = length === undefined ? reader.len : reader.pos + length;
778
+ const message = createBaseSnapshotBackupTransferRequest();
779
+ while (reader.pos < end) {
780
+ const tag = reader.uint32();
781
+ switch (tag >>> 3) {
782
+ case 1:
783
+ message.PoolName = reader.string();
784
+ break;
785
+ case 2:
786
+ message.DatasetPath = reader.string();
787
+ break;
788
+ case 3:
789
+ message.SnapshotName = reader.string();
790
+ break;
791
+ case 4:
792
+ message.TransferMode = reader.int32() as any;
793
+ break;
794
+ default:
795
+ reader.skipType(tag & 7);
796
+ break;
797
+ }
798
+ }
799
+ return message;
800
+ },
801
+
802
+ fromJSON(object: any): SnapshotBackupTransferRequest {
803
+ return {
804
+ PoolName: isSet(object.PoolName) ? String(object.PoolName) : "",
805
+ DatasetPath: isSet(object.DatasetPath) ? String(object.DatasetPath) : "",
806
+ SnapshotName: isSet(object.SnapshotName) ? String(object.SnapshotName) : "",
807
+ TransferMode: isSet(object.TransferMode) ? snapshotTransferModeFromJSON(object.TransferMode) : 0,
808
+ };
809
+ },
810
+
811
+ toJSON(message: SnapshotBackupTransferRequest): unknown {
812
+ const obj: any = {};
813
+ message.PoolName !== undefined && (obj.PoolName = message.PoolName);
814
+ message.DatasetPath !== undefined && (obj.DatasetPath = message.DatasetPath);
815
+ message.SnapshotName !== undefined && (obj.SnapshotName = message.SnapshotName);
816
+ message.TransferMode !== undefined && (obj.TransferMode = snapshotTransferModeToJSON(message.TransferMode));
817
+ return obj;
818
+ },
819
+
820
+ fromPartial<I extends Exact<DeepPartial<SnapshotBackupTransferRequest>, I>>(
821
+ object: I,
822
+ ): SnapshotBackupTransferRequest {
823
+ const message = createBaseSnapshotBackupTransferRequest();
824
+ message.PoolName = object.PoolName ?? "";
825
+ message.DatasetPath = object.DatasetPath ?? "";
826
+ message.SnapshotName = object.SnapshotName ?? "";
827
+ message.TransferMode = object.TransferMode ?? 0;
828
+ return message;
829
+ },
830
+ };
831
+
832
+ function createBaseSnapshotBackupTransferResponse(): SnapshotBackupTransferResponse {
833
+ return { BytesSent: 0, BytesTotal: 0 };
834
+ }
835
+
836
+ export const SnapshotBackupTransferResponse = {
837
+ encode(message: SnapshotBackupTransferResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
838
+ if (message.BytesSent !== 0) {
839
+ writer.uint32(8).uint64(message.BytesSent);
840
+ }
841
+ if (message.BytesTotal !== 0) {
842
+ writer.uint32(16).uint64(message.BytesTotal);
843
+ }
844
+ return writer;
845
+ },
846
+
847
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotBackupTransferResponse {
848
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
849
+ let end = length === undefined ? reader.len : reader.pos + length;
850
+ const message = createBaseSnapshotBackupTransferResponse();
851
+ while (reader.pos < end) {
852
+ const tag = reader.uint32();
853
+ switch (tag >>> 3) {
854
+ case 1:
855
+ message.BytesSent = longToNumber(reader.uint64() as Long);
856
+ break;
857
+ case 2:
858
+ message.BytesTotal = longToNumber(reader.uint64() as Long);
859
+ break;
860
+ default:
861
+ reader.skipType(tag & 7);
862
+ break;
863
+ }
864
+ }
865
+ return message;
866
+ },
867
+
868
+ fromJSON(object: any): SnapshotBackupTransferResponse {
869
+ return {
870
+ BytesSent: isSet(object.BytesSent) ? Number(object.BytesSent) : 0,
871
+ BytesTotal: isSet(object.BytesTotal) ? Number(object.BytesTotal) : 0,
872
+ };
873
+ },
874
+
875
+ toJSON(message: SnapshotBackupTransferResponse): unknown {
876
+ const obj: any = {};
877
+ message.BytesSent !== undefined && (obj.BytesSent = Math.round(message.BytesSent));
878
+ message.BytesTotal !== undefined && (obj.BytesTotal = Math.round(message.BytesTotal));
879
+ return obj;
880
+ },
881
+
882
+ fromPartial<I extends Exact<DeepPartial<SnapshotBackupTransferResponse>, I>>(
883
+ object: I,
884
+ ): SnapshotBackupTransferResponse {
885
+ const message = createBaseSnapshotBackupTransferResponse();
886
+ message.BytesSent = object.BytesSent ?? 0;
887
+ message.BytesTotal = object.BytesTotal ?? 0;
888
+ return message;
889
+ },
890
+ };
891
+
892
+ function createBaseSnapshotBackupListRequest(): SnapshotBackupListRequest {
893
+ return { PoolName: "", DatasetPath: "" };
894
+ }
895
+
896
+ export const SnapshotBackupListRequest = {
897
+ encode(message: SnapshotBackupListRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
898
+ if (message.PoolName !== "") {
899
+ writer.uint32(10).string(message.PoolName);
900
+ }
901
+ if (message.DatasetPath !== "") {
902
+ writer.uint32(18).string(message.DatasetPath);
903
+ }
904
+ return writer;
905
+ },
906
+
907
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotBackupListRequest {
908
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
909
+ let end = length === undefined ? reader.len : reader.pos + length;
910
+ const message = createBaseSnapshotBackupListRequest();
911
+ while (reader.pos < end) {
912
+ const tag = reader.uint32();
913
+ switch (tag >>> 3) {
914
+ case 1:
915
+ message.PoolName = reader.string();
916
+ break;
917
+ case 2:
918
+ message.DatasetPath = reader.string();
919
+ break;
920
+ default:
921
+ reader.skipType(tag & 7);
922
+ break;
923
+ }
924
+ }
925
+ return message;
926
+ },
927
+
928
+ fromJSON(object: any): SnapshotBackupListRequest {
929
+ return {
930
+ PoolName: isSet(object.PoolName) ? String(object.PoolName) : "",
931
+ DatasetPath: isSet(object.DatasetPath) ? String(object.DatasetPath) : "",
932
+ };
933
+ },
934
+
935
+ toJSON(message: SnapshotBackupListRequest): unknown {
936
+ const obj: any = {};
937
+ message.PoolName !== undefined && (obj.PoolName = message.PoolName);
938
+ message.DatasetPath !== undefined && (obj.DatasetPath = message.DatasetPath);
939
+ return obj;
940
+ },
941
+
942
+ fromPartial<I extends Exact<DeepPartial<SnapshotBackupListRequest>, I>>(object: I): SnapshotBackupListRequest {
943
+ const message = createBaseSnapshotBackupListRequest();
944
+ message.PoolName = object.PoolName ?? "";
945
+ message.DatasetPath = object.DatasetPath ?? "";
946
+ return message;
947
+ },
948
+ };
949
+
950
+ function createBaseSnapshotStatusResponse(): SnapshotStatusResponse {
951
+ return { Status: 0, BytesSent: 0, BytesTotal: 0 };
952
+ }
953
+
954
+ export const SnapshotStatusResponse = {
955
+ encode(message: SnapshotStatusResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
956
+ if (message.Status !== 0) {
957
+ writer.uint32(8).int32(message.Status);
958
+ }
959
+ if (message.BytesSent !== 0) {
960
+ writer.uint32(16).uint64(message.BytesSent);
961
+ }
962
+ if (message.BytesTotal !== 0) {
963
+ writer.uint32(24).uint64(message.BytesTotal);
964
+ }
965
+ return writer;
966
+ },
967
+
968
+ decode(input: _m0.Reader | Uint8Array, length?: number): SnapshotStatusResponse {
969
+ const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
970
+ let end = length === undefined ? reader.len : reader.pos + length;
971
+ const message = createBaseSnapshotStatusResponse();
972
+ while (reader.pos < end) {
973
+ const tag = reader.uint32();
974
+ switch (tag >>> 3) {
975
+ case 1:
976
+ message.Status = reader.int32() as any;
977
+ break;
978
+ case 2:
979
+ message.BytesSent = longToNumber(reader.uint64() as Long);
980
+ break;
981
+ case 3:
982
+ message.BytesTotal = longToNumber(reader.uint64() as Long);
983
+ break;
984
+ default:
985
+ reader.skipType(tag & 7);
986
+ break;
987
+ }
988
+ }
989
+ return message;
990
+ },
991
+
992
+ fromJSON(object: any): SnapshotStatusResponse {
993
+ return {
994
+ Status: isSet(object.Status) ? snapshotManagerStatusFromJSON(object.Status) : 0,
995
+ BytesSent: isSet(object.BytesSent) ? Number(object.BytesSent) : 0,
996
+ BytesTotal: isSet(object.BytesTotal) ? Number(object.BytesTotal) : 0,
997
+ };
998
+ },
999
+
1000
+ toJSON(message: SnapshotStatusResponse): unknown {
1001
+ const obj: any = {};
1002
+ message.Status !== undefined && (obj.Status = snapshotManagerStatusToJSON(message.Status));
1003
+ message.BytesSent !== undefined && (obj.BytesSent = Math.round(message.BytesSent));
1004
+ message.BytesTotal !== undefined && (obj.BytesTotal = Math.round(message.BytesTotal));
1005
+ return obj;
1006
+ },
1007
+
1008
+ fromPartial<I extends Exact<DeepPartial<SnapshotStatusResponse>, I>>(object: I): SnapshotStatusResponse {
1009
+ const message = createBaseSnapshotStatusResponse();
1010
+ message.Status = object.Status ?? 0;
1011
+ message.BytesSent = object.BytesSent ?? 0;
1012
+ message.BytesTotal = object.BytesTotal ?? 0;
1013
+ return message;
1014
+ },
1015
+ };
1016
+
1017
+ export interface OSSnapshotService {
1018
+ /** 添加快照备份池(必须是已存在的 ZFS 池) */
1019
+ BackupPoolAdd(request: DeepPartial<SnapshotBackupPoolRequest>, metadata?: grpc.Metadata): Promise<Empty>;
1020
+ /** 移除快照备份池(对应 ZFS 池不会被删除) */
1021
+ BackupPoolDel(request: DeepPartial<SnapshotBackupPoolRequest>, metadata?: grpc.Metadata): Promise<Empty>;
1022
+ /** 列举已注册的快照备份池 */
1023
+ BackupPoolList(request: DeepPartial<Empty>, metadata?: grpc.Metadata): Promise<SnapshotBackupPoolListResponse>;
1024
+ /** 创建数据集并挂载到指定路径(若已存在,不会重复创建) */
1025
+ DatasetAdd(request: DeepPartial<SnapshotDatasetRequest>, metadata?: grpc.Metadata): Promise<Empty>;
1026
+ /** 删除数据集(及其所有快照) */
1027
+ DatasetDel(request: DeepPartial<SnapshotDatasetRequest>, metadata?: grpc.Metadata): Promise<Empty>;
1028
+ /** 列举所有数据集 */
1029
+ DatasetList(request: DeepPartial<Empty>, metadata?: grpc.Metadata): Promise<SnapshotDatasetListResponse>;
1030
+ /** 删除备份池中指定数据集(及其所有快照) */
1031
+ DatasetBackupDel(request: DeepPartial<SnapshotDatasetBackupRequest>, metadata?: grpc.Metadata): Promise<Empty>;
1032
+ /** 列举指定备份池中的所有数据集 */
1033
+ DatasetBackupList(
1034
+ request: DeepPartial<SnapshotBackupPoolRequest>,
1035
+ metadata?: grpc.Metadata,
1036
+ ): Promise<SnapshotDatasetListResponse>;
1037
+ /** 为指定数据集创建快照(同一个数据集下的快照名称不能重复) */
1038
+ SnapshotAdd(request: DeepPartial<SnapshotRequest>, metadata?: grpc.Metadata): Promise<Empty>;
1039
+ /** 根据名称删除指定数据集中的一个快照 */
1040
+ SnapshotDel(request: DeepPartial<SnapshotRequest>, metadata?: grpc.Metadata): Promise<Empty>;
1041
+ /** 列举指定数据集下所有快照 */
1042
+ SnapshotList(request: DeepPartial<SnapshotDatasetRequest>, metadata?: grpc.Metadata): Promise<SnapshotListResponse>;
1043
+ /** 将数据集回滚到指定快照的状态(数据集中较新的快照会被丢弃) */
1044
+ SnapshotRestore(request: DeepPartial<SnapshotRequest>, metadata?: grpc.Metadata): Promise<Empty>;
1045
+ /** 备份快照到已注册的备份池(若对应数据集不存在,则会自动创建) */
1046
+ SnapshotBackupAdd(
1047
+ request: DeepPartial<SnapshotBackupTransferRequest>,
1048
+ metadata?: grpc.Metadata,
1049
+ ): Promise<SnapshotBackupTransferResponse>;
1050
+ /** 将指定数据集快照从备份池中移除 */
1051
+ SnapshotBackupDel(request: DeepPartial<SnapshotBackupRequest>, metadata?: grpc.Metadata): Promise<Empty>;
1052
+ /** 列举指定备份池中某个数据集的快照 */
1053
+ SnapshotBackupList(
1054
+ request: DeepPartial<SnapshotBackupListRequest>,
1055
+ metadata?: grpc.Metadata,
1056
+ ): Promise<SnapshotListResponse>;
1057
+ /** 将某个快照备份还原 */
1058
+ SnapshotBackupRestore(
1059
+ request: DeepPartial<SnapshotBackupTransferRequest>,
1060
+ metadata?: grpc.Metadata,
1061
+ ): Promise<SnapshotBackupTransferResponse>;
1062
+ /** 获取当前运行状态 */
1063
+ GetStatus(request: DeepPartial<Empty>, metadata?: grpc.Metadata): Promise<SnapshotStatusResponse>;
1064
+ /** 停止当前正在进行的传输任务 */
1065
+ StopTransfer(request: DeepPartial<Empty>, metadata?: grpc.Metadata): Promise<Empty>;
1066
+ }
1067
+
1068
+ export class OSSnapshotServiceClientImpl implements OSSnapshotService {
1069
+ private readonly rpc: Rpc;
1070
+
1071
+ constructor(rpc: Rpc) {
1072
+ this.rpc = rpc;
1073
+ this.BackupPoolAdd = this.BackupPoolAdd.bind(this);
1074
+ this.BackupPoolDel = this.BackupPoolDel.bind(this);
1075
+ this.BackupPoolList = this.BackupPoolList.bind(this);
1076
+ this.DatasetAdd = this.DatasetAdd.bind(this);
1077
+ this.DatasetDel = this.DatasetDel.bind(this);
1078
+ this.DatasetList = this.DatasetList.bind(this);
1079
+ this.DatasetBackupDel = this.DatasetBackupDel.bind(this);
1080
+ this.DatasetBackupList = this.DatasetBackupList.bind(this);
1081
+ this.SnapshotAdd = this.SnapshotAdd.bind(this);
1082
+ this.SnapshotDel = this.SnapshotDel.bind(this);
1083
+ this.SnapshotList = this.SnapshotList.bind(this);
1084
+ this.SnapshotRestore = this.SnapshotRestore.bind(this);
1085
+ this.SnapshotBackupAdd = this.SnapshotBackupAdd.bind(this);
1086
+ this.SnapshotBackupDel = this.SnapshotBackupDel.bind(this);
1087
+ this.SnapshotBackupList = this.SnapshotBackupList.bind(this);
1088
+ this.SnapshotBackupRestore = this.SnapshotBackupRestore.bind(this);
1089
+ this.GetStatus = this.GetStatus.bind(this);
1090
+ this.StopTransfer = this.StopTransfer.bind(this);
1091
+ }
1092
+
1093
+ BackupPoolAdd(request: DeepPartial<SnapshotBackupPoolRequest>, metadata?: grpc.Metadata): Promise<Empty> {
1094
+ return this.rpc.unary(OSSnapshotServiceBackupPoolAddDesc, SnapshotBackupPoolRequest.fromPartial(request), metadata);
1095
+ }
1096
+
1097
+ BackupPoolDel(request: DeepPartial<SnapshotBackupPoolRequest>, metadata?: grpc.Metadata): Promise<Empty> {
1098
+ return this.rpc.unary(OSSnapshotServiceBackupPoolDelDesc, SnapshotBackupPoolRequest.fromPartial(request), metadata);
1099
+ }
1100
+
1101
+ BackupPoolList(request: DeepPartial<Empty>, metadata?: grpc.Metadata): Promise<SnapshotBackupPoolListResponse> {
1102
+ return this.rpc.unary(OSSnapshotServiceBackupPoolListDesc, Empty.fromPartial(request), metadata);
1103
+ }
1104
+
1105
+ DatasetAdd(request: DeepPartial<SnapshotDatasetRequest>, metadata?: grpc.Metadata): Promise<Empty> {
1106
+ return this.rpc.unary(OSSnapshotServiceDatasetAddDesc, SnapshotDatasetRequest.fromPartial(request), metadata);
1107
+ }
1108
+
1109
+ DatasetDel(request: DeepPartial<SnapshotDatasetRequest>, metadata?: grpc.Metadata): Promise<Empty> {
1110
+ return this.rpc.unary(OSSnapshotServiceDatasetDelDesc, SnapshotDatasetRequest.fromPartial(request), metadata);
1111
+ }
1112
+
1113
+ DatasetList(request: DeepPartial<Empty>, metadata?: grpc.Metadata): Promise<SnapshotDatasetListResponse> {
1114
+ return this.rpc.unary(OSSnapshotServiceDatasetListDesc, Empty.fromPartial(request), metadata);
1115
+ }
1116
+
1117
+ DatasetBackupDel(request: DeepPartial<SnapshotDatasetBackupRequest>, metadata?: grpc.Metadata): Promise<Empty> {
1118
+ return this.rpc.unary(
1119
+ OSSnapshotServiceDatasetBackupDelDesc,
1120
+ SnapshotDatasetBackupRequest.fromPartial(request),
1121
+ metadata,
1122
+ );
1123
+ }
1124
+
1125
+ DatasetBackupList(
1126
+ request: DeepPartial<SnapshotBackupPoolRequest>,
1127
+ metadata?: grpc.Metadata,
1128
+ ): Promise<SnapshotDatasetListResponse> {
1129
+ return this.rpc.unary(
1130
+ OSSnapshotServiceDatasetBackupListDesc,
1131
+ SnapshotBackupPoolRequest.fromPartial(request),
1132
+ metadata,
1133
+ );
1134
+ }
1135
+
1136
+ SnapshotAdd(request: DeepPartial<SnapshotRequest>, metadata?: grpc.Metadata): Promise<Empty> {
1137
+ return this.rpc.unary(OSSnapshotServiceSnapshotAddDesc, SnapshotRequest.fromPartial(request), metadata);
1138
+ }
1139
+
1140
+ SnapshotDel(request: DeepPartial<SnapshotRequest>, metadata?: grpc.Metadata): Promise<Empty> {
1141
+ return this.rpc.unary(OSSnapshotServiceSnapshotDelDesc, SnapshotRequest.fromPartial(request), metadata);
1142
+ }
1143
+
1144
+ SnapshotList(request: DeepPartial<SnapshotDatasetRequest>, metadata?: grpc.Metadata): Promise<SnapshotListResponse> {
1145
+ return this.rpc.unary(OSSnapshotServiceSnapshotListDesc, SnapshotDatasetRequest.fromPartial(request), metadata);
1146
+ }
1147
+
1148
+ SnapshotRestore(request: DeepPartial<SnapshotRequest>, metadata?: grpc.Metadata): Promise<Empty> {
1149
+ return this.rpc.unary(OSSnapshotServiceSnapshotRestoreDesc, SnapshotRequest.fromPartial(request), metadata);
1150
+ }
1151
+
1152
+ SnapshotBackupAdd(
1153
+ request: DeepPartial<SnapshotBackupTransferRequest>,
1154
+ metadata?: grpc.Metadata,
1155
+ ): Promise<SnapshotBackupTransferResponse> {
1156
+ return this.rpc.unary(
1157
+ OSSnapshotServiceSnapshotBackupAddDesc,
1158
+ SnapshotBackupTransferRequest.fromPartial(request),
1159
+ metadata,
1160
+ );
1161
+ }
1162
+
1163
+ SnapshotBackupDel(request: DeepPartial<SnapshotBackupRequest>, metadata?: grpc.Metadata): Promise<Empty> {
1164
+ return this.rpc.unary(OSSnapshotServiceSnapshotBackupDelDesc, SnapshotBackupRequest.fromPartial(request), metadata);
1165
+ }
1166
+
1167
+ SnapshotBackupList(
1168
+ request: DeepPartial<SnapshotBackupListRequest>,
1169
+ metadata?: grpc.Metadata,
1170
+ ): Promise<SnapshotListResponse> {
1171
+ return this.rpc.unary(
1172
+ OSSnapshotServiceSnapshotBackupListDesc,
1173
+ SnapshotBackupListRequest.fromPartial(request),
1174
+ metadata,
1175
+ );
1176
+ }
1177
+
1178
+ SnapshotBackupRestore(
1179
+ request: DeepPartial<SnapshotBackupTransferRequest>,
1180
+ metadata?: grpc.Metadata,
1181
+ ): Promise<SnapshotBackupTransferResponse> {
1182
+ return this.rpc.unary(
1183
+ OSSnapshotServiceSnapshotBackupRestoreDesc,
1184
+ SnapshotBackupTransferRequest.fromPartial(request),
1185
+ metadata,
1186
+ );
1187
+ }
1188
+
1189
+ GetStatus(request: DeepPartial<Empty>, metadata?: grpc.Metadata): Promise<SnapshotStatusResponse> {
1190
+ return this.rpc.unary(OSSnapshotServiceGetStatusDesc, Empty.fromPartial(request), metadata);
1191
+ }
1192
+
1193
+ StopTransfer(request: DeepPartial<Empty>, metadata?: grpc.Metadata): Promise<Empty> {
1194
+ return this.rpc.unary(OSSnapshotServiceStopTransferDesc, Empty.fromPartial(request), metadata);
1195
+ }
1196
+ }
1197
+
1198
+ export const OSSnapshotServiceDesc = { serviceName: "cloud.lazycat.apis.sys.OSSnapshotService" };
1199
+
1200
+ export const OSSnapshotServiceBackupPoolAddDesc: UnaryMethodDefinitionish = {
1201
+ methodName: "BackupPoolAdd",
1202
+ service: OSSnapshotServiceDesc,
1203
+ requestStream: false,
1204
+ responseStream: false,
1205
+ requestType: {
1206
+ serializeBinary() {
1207
+ return SnapshotBackupPoolRequest.encode(this).finish();
1208
+ },
1209
+ } as any,
1210
+ responseType: {
1211
+ deserializeBinary(data: Uint8Array) {
1212
+ return {
1213
+ ...Empty.decode(data),
1214
+ toObject() {
1215
+ return this;
1216
+ },
1217
+ };
1218
+ },
1219
+ } as any,
1220
+ };
1221
+
1222
+ export const OSSnapshotServiceBackupPoolDelDesc: UnaryMethodDefinitionish = {
1223
+ methodName: "BackupPoolDel",
1224
+ service: OSSnapshotServiceDesc,
1225
+ requestStream: false,
1226
+ responseStream: false,
1227
+ requestType: {
1228
+ serializeBinary() {
1229
+ return SnapshotBackupPoolRequest.encode(this).finish();
1230
+ },
1231
+ } as any,
1232
+ responseType: {
1233
+ deserializeBinary(data: Uint8Array) {
1234
+ return {
1235
+ ...Empty.decode(data),
1236
+ toObject() {
1237
+ return this;
1238
+ },
1239
+ };
1240
+ },
1241
+ } as any,
1242
+ };
1243
+
1244
+ export const OSSnapshotServiceBackupPoolListDesc: UnaryMethodDefinitionish = {
1245
+ methodName: "BackupPoolList",
1246
+ service: OSSnapshotServiceDesc,
1247
+ requestStream: false,
1248
+ responseStream: false,
1249
+ requestType: {
1250
+ serializeBinary() {
1251
+ return Empty.encode(this).finish();
1252
+ },
1253
+ } as any,
1254
+ responseType: {
1255
+ deserializeBinary(data: Uint8Array) {
1256
+ return {
1257
+ ...SnapshotBackupPoolListResponse.decode(data),
1258
+ toObject() {
1259
+ return this;
1260
+ },
1261
+ };
1262
+ },
1263
+ } as any,
1264
+ };
1265
+
1266
+ export const OSSnapshotServiceDatasetAddDesc: UnaryMethodDefinitionish = {
1267
+ methodName: "DatasetAdd",
1268
+ service: OSSnapshotServiceDesc,
1269
+ requestStream: false,
1270
+ responseStream: false,
1271
+ requestType: {
1272
+ serializeBinary() {
1273
+ return SnapshotDatasetRequest.encode(this).finish();
1274
+ },
1275
+ } as any,
1276
+ responseType: {
1277
+ deserializeBinary(data: Uint8Array) {
1278
+ return {
1279
+ ...Empty.decode(data),
1280
+ toObject() {
1281
+ return this;
1282
+ },
1283
+ };
1284
+ },
1285
+ } as any,
1286
+ };
1287
+
1288
+ export const OSSnapshotServiceDatasetDelDesc: UnaryMethodDefinitionish = {
1289
+ methodName: "DatasetDel",
1290
+ service: OSSnapshotServiceDesc,
1291
+ requestStream: false,
1292
+ responseStream: false,
1293
+ requestType: {
1294
+ serializeBinary() {
1295
+ return SnapshotDatasetRequest.encode(this).finish();
1296
+ },
1297
+ } as any,
1298
+ responseType: {
1299
+ deserializeBinary(data: Uint8Array) {
1300
+ return {
1301
+ ...Empty.decode(data),
1302
+ toObject() {
1303
+ return this;
1304
+ },
1305
+ };
1306
+ },
1307
+ } as any,
1308
+ };
1309
+
1310
+ export const OSSnapshotServiceDatasetListDesc: UnaryMethodDefinitionish = {
1311
+ methodName: "DatasetList",
1312
+ service: OSSnapshotServiceDesc,
1313
+ requestStream: false,
1314
+ responseStream: false,
1315
+ requestType: {
1316
+ serializeBinary() {
1317
+ return Empty.encode(this).finish();
1318
+ },
1319
+ } as any,
1320
+ responseType: {
1321
+ deserializeBinary(data: Uint8Array) {
1322
+ return {
1323
+ ...SnapshotDatasetListResponse.decode(data),
1324
+ toObject() {
1325
+ return this;
1326
+ },
1327
+ };
1328
+ },
1329
+ } as any,
1330
+ };
1331
+
1332
+ export const OSSnapshotServiceDatasetBackupDelDesc: UnaryMethodDefinitionish = {
1333
+ methodName: "DatasetBackupDel",
1334
+ service: OSSnapshotServiceDesc,
1335
+ requestStream: false,
1336
+ responseStream: false,
1337
+ requestType: {
1338
+ serializeBinary() {
1339
+ return SnapshotDatasetBackupRequest.encode(this).finish();
1340
+ },
1341
+ } as any,
1342
+ responseType: {
1343
+ deserializeBinary(data: Uint8Array) {
1344
+ return {
1345
+ ...Empty.decode(data),
1346
+ toObject() {
1347
+ return this;
1348
+ },
1349
+ };
1350
+ },
1351
+ } as any,
1352
+ };
1353
+
1354
+ export const OSSnapshotServiceDatasetBackupListDesc: UnaryMethodDefinitionish = {
1355
+ methodName: "DatasetBackupList",
1356
+ service: OSSnapshotServiceDesc,
1357
+ requestStream: false,
1358
+ responseStream: false,
1359
+ requestType: {
1360
+ serializeBinary() {
1361
+ return SnapshotBackupPoolRequest.encode(this).finish();
1362
+ },
1363
+ } as any,
1364
+ responseType: {
1365
+ deserializeBinary(data: Uint8Array) {
1366
+ return {
1367
+ ...SnapshotDatasetListResponse.decode(data),
1368
+ toObject() {
1369
+ return this;
1370
+ },
1371
+ };
1372
+ },
1373
+ } as any,
1374
+ };
1375
+
1376
+ export const OSSnapshotServiceSnapshotAddDesc: UnaryMethodDefinitionish = {
1377
+ methodName: "SnapshotAdd",
1378
+ service: OSSnapshotServiceDesc,
1379
+ requestStream: false,
1380
+ responseStream: false,
1381
+ requestType: {
1382
+ serializeBinary() {
1383
+ return SnapshotRequest.encode(this).finish();
1384
+ },
1385
+ } as any,
1386
+ responseType: {
1387
+ deserializeBinary(data: Uint8Array) {
1388
+ return {
1389
+ ...Empty.decode(data),
1390
+ toObject() {
1391
+ return this;
1392
+ },
1393
+ };
1394
+ },
1395
+ } as any,
1396
+ };
1397
+
1398
+ export const OSSnapshotServiceSnapshotDelDesc: UnaryMethodDefinitionish = {
1399
+ methodName: "SnapshotDel",
1400
+ service: OSSnapshotServiceDesc,
1401
+ requestStream: false,
1402
+ responseStream: false,
1403
+ requestType: {
1404
+ serializeBinary() {
1405
+ return SnapshotRequest.encode(this).finish();
1406
+ },
1407
+ } as any,
1408
+ responseType: {
1409
+ deserializeBinary(data: Uint8Array) {
1410
+ return {
1411
+ ...Empty.decode(data),
1412
+ toObject() {
1413
+ return this;
1414
+ },
1415
+ };
1416
+ },
1417
+ } as any,
1418
+ };
1419
+
1420
+ export const OSSnapshotServiceSnapshotListDesc: UnaryMethodDefinitionish = {
1421
+ methodName: "SnapshotList",
1422
+ service: OSSnapshotServiceDesc,
1423
+ requestStream: false,
1424
+ responseStream: false,
1425
+ requestType: {
1426
+ serializeBinary() {
1427
+ return SnapshotDatasetRequest.encode(this).finish();
1428
+ },
1429
+ } as any,
1430
+ responseType: {
1431
+ deserializeBinary(data: Uint8Array) {
1432
+ return {
1433
+ ...SnapshotListResponse.decode(data),
1434
+ toObject() {
1435
+ return this;
1436
+ },
1437
+ };
1438
+ },
1439
+ } as any,
1440
+ };
1441
+
1442
+ export const OSSnapshotServiceSnapshotRestoreDesc: UnaryMethodDefinitionish = {
1443
+ methodName: "SnapshotRestore",
1444
+ service: OSSnapshotServiceDesc,
1445
+ requestStream: false,
1446
+ responseStream: false,
1447
+ requestType: {
1448
+ serializeBinary() {
1449
+ return SnapshotRequest.encode(this).finish();
1450
+ },
1451
+ } as any,
1452
+ responseType: {
1453
+ deserializeBinary(data: Uint8Array) {
1454
+ return {
1455
+ ...Empty.decode(data),
1456
+ toObject() {
1457
+ return this;
1458
+ },
1459
+ };
1460
+ },
1461
+ } as any,
1462
+ };
1463
+
1464
+ export const OSSnapshotServiceSnapshotBackupAddDesc: UnaryMethodDefinitionish = {
1465
+ methodName: "SnapshotBackupAdd",
1466
+ service: OSSnapshotServiceDesc,
1467
+ requestStream: false,
1468
+ responseStream: false,
1469
+ requestType: {
1470
+ serializeBinary() {
1471
+ return SnapshotBackupTransferRequest.encode(this).finish();
1472
+ },
1473
+ } as any,
1474
+ responseType: {
1475
+ deserializeBinary(data: Uint8Array) {
1476
+ return {
1477
+ ...SnapshotBackupTransferResponse.decode(data),
1478
+ toObject() {
1479
+ return this;
1480
+ },
1481
+ };
1482
+ },
1483
+ } as any,
1484
+ };
1485
+
1486
+ export const OSSnapshotServiceSnapshotBackupDelDesc: UnaryMethodDefinitionish = {
1487
+ methodName: "SnapshotBackupDel",
1488
+ service: OSSnapshotServiceDesc,
1489
+ requestStream: false,
1490
+ responseStream: false,
1491
+ requestType: {
1492
+ serializeBinary() {
1493
+ return SnapshotBackupRequest.encode(this).finish();
1494
+ },
1495
+ } as any,
1496
+ responseType: {
1497
+ deserializeBinary(data: Uint8Array) {
1498
+ return {
1499
+ ...Empty.decode(data),
1500
+ toObject() {
1501
+ return this;
1502
+ },
1503
+ };
1504
+ },
1505
+ } as any,
1506
+ };
1507
+
1508
+ export const OSSnapshotServiceSnapshotBackupListDesc: UnaryMethodDefinitionish = {
1509
+ methodName: "SnapshotBackupList",
1510
+ service: OSSnapshotServiceDesc,
1511
+ requestStream: false,
1512
+ responseStream: false,
1513
+ requestType: {
1514
+ serializeBinary() {
1515
+ return SnapshotBackupListRequest.encode(this).finish();
1516
+ },
1517
+ } as any,
1518
+ responseType: {
1519
+ deserializeBinary(data: Uint8Array) {
1520
+ return {
1521
+ ...SnapshotListResponse.decode(data),
1522
+ toObject() {
1523
+ return this;
1524
+ },
1525
+ };
1526
+ },
1527
+ } as any,
1528
+ };
1529
+
1530
+ export const OSSnapshotServiceSnapshotBackupRestoreDesc: UnaryMethodDefinitionish = {
1531
+ methodName: "SnapshotBackupRestore",
1532
+ service: OSSnapshotServiceDesc,
1533
+ requestStream: false,
1534
+ responseStream: false,
1535
+ requestType: {
1536
+ serializeBinary() {
1537
+ return SnapshotBackupTransferRequest.encode(this).finish();
1538
+ },
1539
+ } as any,
1540
+ responseType: {
1541
+ deserializeBinary(data: Uint8Array) {
1542
+ return {
1543
+ ...SnapshotBackupTransferResponse.decode(data),
1544
+ toObject() {
1545
+ return this;
1546
+ },
1547
+ };
1548
+ },
1549
+ } as any,
1550
+ };
1551
+
1552
+ export const OSSnapshotServiceGetStatusDesc: UnaryMethodDefinitionish = {
1553
+ methodName: "GetStatus",
1554
+ service: OSSnapshotServiceDesc,
1555
+ requestStream: false,
1556
+ responseStream: false,
1557
+ requestType: {
1558
+ serializeBinary() {
1559
+ return Empty.encode(this).finish();
1560
+ },
1561
+ } as any,
1562
+ responseType: {
1563
+ deserializeBinary(data: Uint8Array) {
1564
+ return {
1565
+ ...SnapshotStatusResponse.decode(data),
1566
+ toObject() {
1567
+ return this;
1568
+ },
1569
+ };
1570
+ },
1571
+ } as any,
1572
+ };
1573
+
1574
+ export const OSSnapshotServiceStopTransferDesc: UnaryMethodDefinitionish = {
1575
+ methodName: "StopTransfer",
1576
+ service: OSSnapshotServiceDesc,
1577
+ requestStream: false,
1578
+ responseStream: false,
1579
+ requestType: {
1580
+ serializeBinary() {
1581
+ return Empty.encode(this).finish();
1582
+ },
1583
+ } as any,
1584
+ responseType: {
1585
+ deserializeBinary(data: Uint8Array) {
1586
+ return {
1587
+ ...Empty.decode(data),
1588
+ toObject() {
1589
+ return this;
1590
+ },
1591
+ };
1592
+ },
1593
+ } as any,
1594
+ };
1595
+
1596
+ interface UnaryMethodDefinitionishR extends grpc.UnaryMethodDefinition<any, any> {
1597
+ requestStream: any;
1598
+ responseStream: any;
1599
+ }
1600
+
1601
+ type UnaryMethodDefinitionish = UnaryMethodDefinitionishR;
1602
+
1603
+ interface Rpc {
1604
+ unary<T extends UnaryMethodDefinitionish>(
1605
+ methodDesc: T,
1606
+ request: any,
1607
+ metadata: grpc.Metadata | undefined,
1608
+ ): Promise<any>;
1609
+ }
1610
+
1611
+ export class GrpcWebImpl {
1612
+ private host: string;
1613
+ private options: {
1614
+ transport?: grpc.TransportFactory;
1615
+
1616
+ debug?: boolean;
1617
+ metadata?: grpc.Metadata;
1618
+ upStreamRetryCodes?: number[];
1619
+ };
1620
+
1621
+ constructor(
1622
+ host: string,
1623
+ options: {
1624
+ transport?: grpc.TransportFactory;
1625
+
1626
+ debug?: boolean;
1627
+ metadata?: grpc.Metadata;
1628
+ upStreamRetryCodes?: number[];
1629
+ },
1630
+ ) {
1631
+ this.host = host;
1632
+ this.options = options;
1633
+ }
1634
+
1635
+ unary<T extends UnaryMethodDefinitionish>(
1636
+ methodDesc: T,
1637
+ _request: any,
1638
+ metadata: grpc.Metadata | undefined,
1639
+ ): Promise<any> {
1640
+ const request = { ..._request, ...methodDesc.requestType };
1641
+ const maybeCombinedMetadata = metadata && this.options.metadata
1642
+ ? new BrowserHeaders({ ...this.options?.metadata.headersMap, ...metadata?.headersMap })
1643
+ : metadata || this.options.metadata;
1644
+ return new Promise((resolve, reject) => {
1645
+ grpc.unary(methodDesc, {
1646
+ request,
1647
+ host: this.host,
1648
+ metadata: maybeCombinedMetadata,
1649
+ transport: this.options.transport,
1650
+ debug: this.options.debug,
1651
+ onEnd: function (response) {
1652
+ if (response.status === grpc.Code.OK) {
1653
+ resolve(response.message);
1654
+ } else {
1655
+ const err = new GrpcWebError(response.statusMessage, response.status, response.trailers);
1656
+ reject(err);
1657
+ }
1658
+ },
1659
+ });
1660
+ });
1661
+ }
1662
+ }
1663
+
1664
+ declare var self: any | undefined;
1665
+ declare var window: any | undefined;
1666
+ declare var global: any | undefined;
1667
+ var globalThis: any = (() => {
1668
+ if (typeof globalThis !== "undefined") {
1669
+ return globalThis;
1670
+ }
1671
+ if (typeof self !== "undefined") {
1672
+ return self;
1673
+ }
1674
+ if (typeof window !== "undefined") {
1675
+ return window;
1676
+ }
1677
+ if (typeof global !== "undefined") {
1678
+ return global;
1679
+ }
1680
+ throw "Unable to locate global object";
1681
+ })();
1682
+
1683
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
1684
+
1685
+ type DeepPartial<T> = T extends Builtin ? T
1686
+ : T extends Array<infer U> ? Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
1687
+ : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
1688
+ : Partial<T>;
1689
+
1690
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
1691
+ type Exact<P, I extends P> = P extends Builtin ? P
1692
+ : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
1693
+
1694
+ function longToNumber(long: Long): number {
1695
+ if (long.gt(Number.MAX_SAFE_INTEGER)) {
1696
+ throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
1697
+ }
1698
+ return long.toNumber();
1699
+ }
1700
+
1701
+ if (_m0.util.Long !== Long) {
1702
+ _m0.util.Long = Long as any;
1703
+ _m0.configure();
1704
+ }
1705
+
1706
+ function isSet(value: any): boolean {
1707
+ return value !== null && value !== undefined;
1708
+ }
1709
+
1710
+ export class GrpcWebError extends Error {
1711
+ constructor(message: string, public code: grpc.Code, public metadata: grpc.Metadata) {
1712
+ super(message);
1713
+ }
1714
+ }