grpc-dc 0.34.0 → 0.35.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/plugin/gen/generators.js +1 -1
- package/src/kafka_grpc_dc.js +65 -0
- package/src/kafka_pb.js +1335 -0
package/src/kafka_pb.js
ADDED
|
@@ -0,0 +1,1335 @@
|
|
|
1
|
+
// Generated code: use without restriction (see GENERATED-CODE-LICENSE.md).
|
|
2
|
+
// @generated by protoc-gen-grpc-dc-js. DO NOT EDIT.
|
|
3
|
+
// source: kafka.proto
|
|
4
|
+
|
|
5
|
+
function varintBytes(value) {
|
|
6
|
+
let n = BigInt.asUintN(64, BigInt(value));
|
|
7
|
+
const out = [];
|
|
8
|
+
while (n > 0x7fn) {
|
|
9
|
+
out.push(Number((n & 0x7fn) | 0x80n));
|
|
10
|
+
n >>= 7n;
|
|
11
|
+
}
|
|
12
|
+
out.push(Number(n));
|
|
13
|
+
return out;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function zz64(v) {
|
|
17
|
+
const b = BigInt(v);
|
|
18
|
+
return (b << 1n) ^ (b >> 63n);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function unzz64(v) {
|
|
22
|
+
return (v >> 1n) ^ (-(v & 1n));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class Reader {
|
|
26
|
+
constructor(bytes) {
|
|
27
|
+
this.bytes = bytes;
|
|
28
|
+
this.pos = 0;
|
|
29
|
+
}
|
|
30
|
+
get done() {
|
|
31
|
+
return this.pos >= this.bytes.length;
|
|
32
|
+
}
|
|
33
|
+
varint() {
|
|
34
|
+
let result = 0n;
|
|
35
|
+
let shift = 0n;
|
|
36
|
+
for (;;) {
|
|
37
|
+
if (this.pos >= this.bytes.length) throw new Error("truncated varint");
|
|
38
|
+
const byte = this.bytes[this.pos++];
|
|
39
|
+
result |= BigInt(byte & 0x7f) << shift;
|
|
40
|
+
if ((byte & 0x80) === 0) return result;
|
|
41
|
+
shift += 7n;
|
|
42
|
+
if (shift >= 64n) throw new Error("varint too long");
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
take(n) {
|
|
46
|
+
const value = this.bytes.slice(this.pos, this.pos + n);
|
|
47
|
+
if (value.length !== n) throw new Error("truncated field");
|
|
48
|
+
this.pos += n;
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
field() {
|
|
52
|
+
if (this.done) return null;
|
|
53
|
+
const start = this.pos;
|
|
54
|
+
const tag = this.varint();
|
|
55
|
+
const field = Number(tag >> 3n);
|
|
56
|
+
const wire = Number(tag & 7n);
|
|
57
|
+
switch (wire) {
|
|
58
|
+
case 0:
|
|
59
|
+
return [field, wire, this.varint(), this.bytes.slice(start, this.pos)];
|
|
60
|
+
case 2: {
|
|
61
|
+
const len = Number(this.varint());
|
|
62
|
+
const v = this.take(len);
|
|
63
|
+
return [field, wire, v, this.bytes.slice(start, this.pos)];
|
|
64
|
+
}
|
|
65
|
+
case 1: {
|
|
66
|
+
const v = this.take(8);
|
|
67
|
+
return [field, wire, v, this.bytes.slice(start, this.pos)];
|
|
68
|
+
}
|
|
69
|
+
case 5: {
|
|
70
|
+
const v = this.take(4);
|
|
71
|
+
return [field, wire, v, this.bytes.slice(start, this.pos)];
|
|
72
|
+
}
|
|
73
|
+
default:
|
|
74
|
+
throw new Error("bad wire type " + wire);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function concatBytes(a, b) {
|
|
80
|
+
const out = new Uint8Array(a.length + b.length);
|
|
81
|
+
out.set(a);
|
|
82
|
+
out.set(b, a.length);
|
|
83
|
+
return out;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function putRaw(out, bytes) {
|
|
87
|
+
for (let i = 0; i < bytes.length; i++) out.push(bytes[i]);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function putTag(out, num, wire) {
|
|
91
|
+
out.push(...varintBytes((BigInt(num) << 3n) | BigInt(wire)));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function putVarintField(out, num, value) {
|
|
95
|
+
if (value === 0n) return;
|
|
96
|
+
putTag(out, num, 0);
|
|
97
|
+
out.push(...varintBytes(value));
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function putBytesField(out, num, payload) {
|
|
101
|
+
putTag(out, num, 2);
|
|
102
|
+
putRaw(out, varintBytes(payload.length));
|
|
103
|
+
putRaw(out, payload);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function putStringField(out, num, value) {
|
|
107
|
+
if (!value) return;
|
|
108
|
+
putBytesField(out, num, new TextEncoder().encode(value));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function putFixedField(out, num, payload) {
|
|
112
|
+
putTag(out, num, payload.length === 8 ? 1 : 5);
|
|
113
|
+
out.push(...payload);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function fixedBytes(value, size, write) {
|
|
117
|
+
const bytes = new Uint8Array(size);
|
|
118
|
+
write(new DataView(bytes.buffer), value);
|
|
119
|
+
return bytes;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function readFixed(bytes, read) {
|
|
123
|
+
return read(new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export const Compression = { COMPRESSION_NONE: 0, COMPRESSION_GZIP: 1, COMPRESSION_SNAPPY: 2, COMPRESSION_LZ4: 3, COMPRESSION_ZSTD: 4 };
|
|
127
|
+
|
|
128
|
+
export const Acks = { ACKS_UNSPECIFIED: 0, ACKS_NONE: 1, ACKS_LEADER: 2, ACKS_ALL: 3 };
|
|
129
|
+
|
|
130
|
+
export class Header {
|
|
131
|
+
constructor({ key = "", value = new Uint8Array(0) } = {}) {
|
|
132
|
+
this.key = key;
|
|
133
|
+
this.value = value;
|
|
134
|
+
this.unknownFields = new Uint8Array(0);
|
|
135
|
+
}
|
|
136
|
+
static encode(msg) {
|
|
137
|
+
const out = [];
|
|
138
|
+
putStringField(out, 1, msg.key);
|
|
139
|
+
if (msg.value && msg.value.length) putBytesField(out, 2, msg.value);
|
|
140
|
+
putRaw(out, msg.unknownFields);
|
|
141
|
+
return new Uint8Array(out);
|
|
142
|
+
}
|
|
143
|
+
static decode(bytes) {
|
|
144
|
+
const msg = new Header();
|
|
145
|
+
const reader = new Reader(bytes);
|
|
146
|
+
let f;
|
|
147
|
+
while ((f = reader.field()) !== null) {
|
|
148
|
+
const [num, wire, value, raw] = f;
|
|
149
|
+
switch (num) {
|
|
150
|
+
case 1: msg.key = new TextDecoder().decode(value); break;
|
|
151
|
+
case 2: msg.value = value; break;
|
|
152
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return msg;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export class Record {
|
|
160
|
+
constructor({ key = new Uint8Array(0), value = new Uint8Array(0), headers = [], timestampMs = 0n, nullKey = false } = {}) {
|
|
161
|
+
this.key = key;
|
|
162
|
+
this.value = value;
|
|
163
|
+
this.headers = headers;
|
|
164
|
+
this.timestampMs = timestampMs;
|
|
165
|
+
this.nullKey = nullKey;
|
|
166
|
+
this.unknownFields = new Uint8Array(0);
|
|
167
|
+
}
|
|
168
|
+
static encode(msg) {
|
|
169
|
+
const out = [];
|
|
170
|
+
if (msg.key && msg.key.length) putBytesField(out, 1, msg.key);
|
|
171
|
+
if (msg.value && msg.value.length) putBytesField(out, 2, msg.value);
|
|
172
|
+
if (msg.headers) for (const v of msg.headers) putBytesField(out, 3, Header.encode(v));
|
|
173
|
+
putVarintField(out, 4, BigInt(msg.timestampMs));
|
|
174
|
+
putVarintField(out, 5, (msg.nullKey ? 1n : 0n));
|
|
175
|
+
putRaw(out, msg.unknownFields);
|
|
176
|
+
return new Uint8Array(out);
|
|
177
|
+
}
|
|
178
|
+
static decode(bytes) {
|
|
179
|
+
const msg = new Record();
|
|
180
|
+
const reader = new Reader(bytes);
|
|
181
|
+
let f;
|
|
182
|
+
while ((f = reader.field()) !== null) {
|
|
183
|
+
const [num, wire, value, raw] = f;
|
|
184
|
+
switch (num) {
|
|
185
|
+
case 1: msg.key = value; break;
|
|
186
|
+
case 2: msg.value = value; break;
|
|
187
|
+
case 3: msg.headers.push(Header.decode(value)); break;
|
|
188
|
+
case 4: msg.timestampMs = BigInt.asIntN(64, value); break;
|
|
189
|
+
case 5: msg.nullKey = value !== 0n; break;
|
|
190
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return msg;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export class FetchedRecord {
|
|
198
|
+
constructor({ offset = 0n, timestampMs = 0n, key = new Uint8Array(0), value = new Uint8Array(0), headers = [], keyNull = false } = {}) {
|
|
199
|
+
this.offset = offset;
|
|
200
|
+
this.timestampMs = timestampMs;
|
|
201
|
+
this.key = key;
|
|
202
|
+
this.value = value;
|
|
203
|
+
this.headers = headers;
|
|
204
|
+
this.keyNull = keyNull;
|
|
205
|
+
this.unknownFields = new Uint8Array(0);
|
|
206
|
+
}
|
|
207
|
+
static encode(msg) {
|
|
208
|
+
const out = [];
|
|
209
|
+
putVarintField(out, 1, BigInt(msg.offset));
|
|
210
|
+
putVarintField(out, 2, BigInt(msg.timestampMs));
|
|
211
|
+
if (msg.key && msg.key.length) putBytesField(out, 3, msg.key);
|
|
212
|
+
if (msg.value && msg.value.length) putBytesField(out, 4, msg.value);
|
|
213
|
+
if (msg.headers) for (const v of msg.headers) putBytesField(out, 5, Header.encode(v));
|
|
214
|
+
putVarintField(out, 6, (msg.keyNull ? 1n : 0n));
|
|
215
|
+
putRaw(out, msg.unknownFields);
|
|
216
|
+
return new Uint8Array(out);
|
|
217
|
+
}
|
|
218
|
+
static decode(bytes) {
|
|
219
|
+
const msg = new FetchedRecord();
|
|
220
|
+
const reader = new Reader(bytes);
|
|
221
|
+
let f;
|
|
222
|
+
while ((f = reader.field()) !== null) {
|
|
223
|
+
const [num, wire, value, raw] = f;
|
|
224
|
+
switch (num) {
|
|
225
|
+
case 1: msg.offset = BigInt.asIntN(64, value); break;
|
|
226
|
+
case 2: msg.timestampMs = BigInt.asIntN(64, value); break;
|
|
227
|
+
case 3: msg.key = value; break;
|
|
228
|
+
case 4: msg.value = value; break;
|
|
229
|
+
case 5: msg.headers.push(Header.decode(value)); break;
|
|
230
|
+
case 6: msg.keyNull = value !== 0n; break;
|
|
231
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return msg;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export class TopicPartition {
|
|
239
|
+
constructor({ topic = "", partition = 0 } = {}) {
|
|
240
|
+
this.topic = topic;
|
|
241
|
+
this.partition = partition;
|
|
242
|
+
this.unknownFields = new Uint8Array(0);
|
|
243
|
+
}
|
|
244
|
+
static encode(msg) {
|
|
245
|
+
const out = [];
|
|
246
|
+
putStringField(out, 1, msg.topic);
|
|
247
|
+
putVarintField(out, 2, BigInt(msg.partition));
|
|
248
|
+
putRaw(out, msg.unknownFields);
|
|
249
|
+
return new Uint8Array(out);
|
|
250
|
+
}
|
|
251
|
+
static decode(bytes) {
|
|
252
|
+
const msg = new TopicPartition();
|
|
253
|
+
const reader = new Reader(bytes);
|
|
254
|
+
let f;
|
|
255
|
+
while ((f = reader.field()) !== null) {
|
|
256
|
+
const [num, wire, value, raw] = f;
|
|
257
|
+
switch (num) {
|
|
258
|
+
case 1: msg.topic = new TextDecoder().decode(value); break;
|
|
259
|
+
case 2: msg.partition = Number(BigInt.asIntN(32, value)); break;
|
|
260
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return msg;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
export class MetadataRequest {
|
|
268
|
+
constructor({ topics = [], allowAutoTopicCreation = false } = {}) {
|
|
269
|
+
this.topics = topics;
|
|
270
|
+
this.allowAutoTopicCreation = allowAutoTopicCreation;
|
|
271
|
+
this.unknownFields = new Uint8Array(0);
|
|
272
|
+
}
|
|
273
|
+
static encode(msg) {
|
|
274
|
+
const out = [];
|
|
275
|
+
if (msg.topics) for (const v of msg.topics) putBytesField(out, 1, new TextEncoder().encode(v));
|
|
276
|
+
putVarintField(out, 2, (msg.allowAutoTopicCreation ? 1n : 0n));
|
|
277
|
+
putRaw(out, msg.unknownFields);
|
|
278
|
+
return new Uint8Array(out);
|
|
279
|
+
}
|
|
280
|
+
static decode(bytes) {
|
|
281
|
+
const msg = new MetadataRequest();
|
|
282
|
+
const reader = new Reader(bytes);
|
|
283
|
+
let f;
|
|
284
|
+
while ((f = reader.field()) !== null) {
|
|
285
|
+
const [num, wire, value, raw] = f;
|
|
286
|
+
switch (num) {
|
|
287
|
+
case 1: msg.topics.push(new TextDecoder().decode(value)); break;
|
|
288
|
+
case 2: msg.allowAutoTopicCreation = value !== 0n; break;
|
|
289
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return msg;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
export class BrokerMetadata {
|
|
297
|
+
constructor({ nodeId = 0, host = "", port = 0, rack = "" } = {}) {
|
|
298
|
+
this.nodeId = nodeId;
|
|
299
|
+
this.host = host;
|
|
300
|
+
this.port = port;
|
|
301
|
+
this.rack = rack;
|
|
302
|
+
this.unknownFields = new Uint8Array(0);
|
|
303
|
+
}
|
|
304
|
+
static encode(msg) {
|
|
305
|
+
const out = [];
|
|
306
|
+
putVarintField(out, 1, BigInt(msg.nodeId));
|
|
307
|
+
putStringField(out, 2, msg.host);
|
|
308
|
+
putVarintField(out, 3, BigInt(msg.port));
|
|
309
|
+
putStringField(out, 4, msg.rack);
|
|
310
|
+
putRaw(out, msg.unknownFields);
|
|
311
|
+
return new Uint8Array(out);
|
|
312
|
+
}
|
|
313
|
+
static decode(bytes) {
|
|
314
|
+
const msg = new BrokerMetadata();
|
|
315
|
+
const reader = new Reader(bytes);
|
|
316
|
+
let f;
|
|
317
|
+
while ((f = reader.field()) !== null) {
|
|
318
|
+
const [num, wire, value, raw] = f;
|
|
319
|
+
switch (num) {
|
|
320
|
+
case 1: msg.nodeId = Number(BigInt.asIntN(32, value)); break;
|
|
321
|
+
case 2: msg.host = new TextDecoder().decode(value); break;
|
|
322
|
+
case 3: msg.port = Number(BigInt.asIntN(32, value)); break;
|
|
323
|
+
case 4: msg.rack = new TextDecoder().decode(value); break;
|
|
324
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return msg;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
export class PartitionMetadata {
|
|
332
|
+
constructor({ id = 0, leaderId = 0, leaderEpoch = 0, replicas = [], isr = [], errorCode = 0 } = {}) {
|
|
333
|
+
this.id = id;
|
|
334
|
+
this.leaderId = leaderId;
|
|
335
|
+
this.leaderEpoch = leaderEpoch;
|
|
336
|
+
this.replicas = replicas;
|
|
337
|
+
this.isr = isr;
|
|
338
|
+
this.errorCode = errorCode;
|
|
339
|
+
this.unknownFields = new Uint8Array(0);
|
|
340
|
+
}
|
|
341
|
+
static encode(msg) {
|
|
342
|
+
const out = [];
|
|
343
|
+
putVarintField(out, 1, BigInt(msg.id));
|
|
344
|
+
putVarintField(out, 2, BigInt(msg.leaderId));
|
|
345
|
+
putVarintField(out, 3, BigInt(msg.leaderEpoch));
|
|
346
|
+
if (msg.replicas && msg.replicas.length) {
|
|
347
|
+
const payload = [];
|
|
348
|
+
for (const x of msg.replicas) payload.push(...varintBytes(BigInt(x)));
|
|
349
|
+
putBytesField(out, 4, payload);
|
|
350
|
+
}
|
|
351
|
+
if (msg.isr && msg.isr.length) {
|
|
352
|
+
const payload = [];
|
|
353
|
+
for (const x of msg.isr) payload.push(...varintBytes(BigInt(x)));
|
|
354
|
+
putBytesField(out, 5, payload);
|
|
355
|
+
}
|
|
356
|
+
putVarintField(out, 6, BigInt(msg.errorCode));
|
|
357
|
+
putRaw(out, msg.unknownFields);
|
|
358
|
+
return new Uint8Array(out);
|
|
359
|
+
}
|
|
360
|
+
static decode(bytes) {
|
|
361
|
+
const msg = new PartitionMetadata();
|
|
362
|
+
const reader = new Reader(bytes);
|
|
363
|
+
let f;
|
|
364
|
+
while ((f = reader.field()) !== null) {
|
|
365
|
+
const [num, wire, value, raw] = f;
|
|
366
|
+
switch (num) {
|
|
367
|
+
case 1: msg.id = Number(BigInt.asIntN(32, value)); break;
|
|
368
|
+
case 2: msg.leaderId = Number(BigInt.asIntN(32, value)); break;
|
|
369
|
+
case 3: msg.leaderEpoch = Number(BigInt.asIntN(32, value)); break;
|
|
370
|
+
case 4: if (wire === 2) { const r = new Reader(value); while (!r.done) msg.replicas.push(Number(BigInt.asIntN(32, r.varint()))); } else msg.replicas.push(Number(BigInt.asIntN(32, value))); break;
|
|
371
|
+
case 5: if (wire === 2) { const r = new Reader(value); while (!r.done) msg.isr.push(Number(BigInt.asIntN(32, r.varint()))); } else msg.isr.push(Number(BigInt.asIntN(32, value))); break;
|
|
372
|
+
case 6: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
373
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return msg;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export class TopicMetadata {
|
|
381
|
+
constructor({ name = "", isInternal = false, errorCode = 0, partitions = [] } = {}) {
|
|
382
|
+
this.name = name;
|
|
383
|
+
this.isInternal = isInternal;
|
|
384
|
+
this.errorCode = errorCode;
|
|
385
|
+
this.partitions = partitions;
|
|
386
|
+
this.unknownFields = new Uint8Array(0);
|
|
387
|
+
}
|
|
388
|
+
static encode(msg) {
|
|
389
|
+
const out = [];
|
|
390
|
+
putStringField(out, 1, msg.name);
|
|
391
|
+
putVarintField(out, 2, (msg.isInternal ? 1n : 0n));
|
|
392
|
+
putVarintField(out, 3, BigInt(msg.errorCode));
|
|
393
|
+
if (msg.partitions) for (const v of msg.partitions) putBytesField(out, 4, PartitionMetadata.encode(v));
|
|
394
|
+
putRaw(out, msg.unknownFields);
|
|
395
|
+
return new Uint8Array(out);
|
|
396
|
+
}
|
|
397
|
+
static decode(bytes) {
|
|
398
|
+
const msg = new TopicMetadata();
|
|
399
|
+
const reader = new Reader(bytes);
|
|
400
|
+
let f;
|
|
401
|
+
while ((f = reader.field()) !== null) {
|
|
402
|
+
const [num, wire, value, raw] = f;
|
|
403
|
+
switch (num) {
|
|
404
|
+
case 1: msg.name = new TextDecoder().decode(value); break;
|
|
405
|
+
case 2: msg.isInternal = value !== 0n; break;
|
|
406
|
+
case 3: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
407
|
+
case 4: msg.partitions.push(PartitionMetadata.decode(value)); break;
|
|
408
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
return msg;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export class MetadataResponse {
|
|
416
|
+
constructor({ throttleTimeMs = 0, brokers = [], clusterId = "", controllerId = 0, topics = [] } = {}) {
|
|
417
|
+
this.throttleTimeMs = throttleTimeMs;
|
|
418
|
+
this.brokers = brokers;
|
|
419
|
+
this.clusterId = clusterId;
|
|
420
|
+
this.controllerId = controllerId;
|
|
421
|
+
this.topics = topics;
|
|
422
|
+
this.unknownFields = new Uint8Array(0);
|
|
423
|
+
}
|
|
424
|
+
static encode(msg) {
|
|
425
|
+
const out = [];
|
|
426
|
+
putVarintField(out, 1, BigInt(msg.throttleTimeMs));
|
|
427
|
+
if (msg.brokers) for (const v of msg.brokers) putBytesField(out, 2, BrokerMetadata.encode(v));
|
|
428
|
+
putStringField(out, 3, msg.clusterId);
|
|
429
|
+
putVarintField(out, 4, BigInt(msg.controllerId));
|
|
430
|
+
if (msg.topics) for (const v of msg.topics) putBytesField(out, 5, TopicMetadata.encode(v));
|
|
431
|
+
putRaw(out, msg.unknownFields);
|
|
432
|
+
return new Uint8Array(out);
|
|
433
|
+
}
|
|
434
|
+
static decode(bytes) {
|
|
435
|
+
const msg = new MetadataResponse();
|
|
436
|
+
const reader = new Reader(bytes);
|
|
437
|
+
let f;
|
|
438
|
+
while ((f = reader.field()) !== null) {
|
|
439
|
+
const [num, wire, value, raw] = f;
|
|
440
|
+
switch (num) {
|
|
441
|
+
case 1: msg.throttleTimeMs = Number(BigInt.asIntN(32, value)); break;
|
|
442
|
+
case 2: msg.brokers.push(BrokerMetadata.decode(value)); break;
|
|
443
|
+
case 3: msg.clusterId = new TextDecoder().decode(value); break;
|
|
444
|
+
case 4: msg.controllerId = Number(BigInt.asIntN(32, value)); break;
|
|
445
|
+
case 5: msg.topics.push(TopicMetadata.decode(value)); break;
|
|
446
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
return msg;
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
export class OpenProducerRequest {
|
|
454
|
+
constructor({ transactionalId = "", transactionTimeoutMs = 0 } = {}) {
|
|
455
|
+
this.transactionalId = transactionalId;
|
|
456
|
+
this.transactionTimeoutMs = transactionTimeoutMs;
|
|
457
|
+
this.unknownFields = new Uint8Array(0);
|
|
458
|
+
}
|
|
459
|
+
static encode(msg) {
|
|
460
|
+
const out = [];
|
|
461
|
+
putStringField(out, 1, msg.transactionalId);
|
|
462
|
+
putVarintField(out, 2, BigInt(msg.transactionTimeoutMs));
|
|
463
|
+
putRaw(out, msg.unknownFields);
|
|
464
|
+
return new Uint8Array(out);
|
|
465
|
+
}
|
|
466
|
+
static decode(bytes) {
|
|
467
|
+
const msg = new OpenProducerRequest();
|
|
468
|
+
const reader = new Reader(bytes);
|
|
469
|
+
let f;
|
|
470
|
+
while ((f = reader.field()) !== null) {
|
|
471
|
+
const [num, wire, value, raw] = f;
|
|
472
|
+
switch (num) {
|
|
473
|
+
case 1: msg.transactionalId = new TextDecoder().decode(value); break;
|
|
474
|
+
case 2: msg.transactionTimeoutMs = Number(BigInt.asIntN(32, value)); break;
|
|
475
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return msg;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export class OpenProducerResponse {
|
|
483
|
+
constructor({ sessionId = "", producerId = 0n, producerEpoch = 0, errorCode = 0 } = {}) {
|
|
484
|
+
this.sessionId = sessionId;
|
|
485
|
+
this.producerId = producerId;
|
|
486
|
+
this.producerEpoch = producerEpoch;
|
|
487
|
+
this.errorCode = errorCode;
|
|
488
|
+
this.unknownFields = new Uint8Array(0);
|
|
489
|
+
}
|
|
490
|
+
static encode(msg) {
|
|
491
|
+
const out = [];
|
|
492
|
+
putStringField(out, 1, msg.sessionId);
|
|
493
|
+
putVarintField(out, 2, BigInt(msg.producerId));
|
|
494
|
+
putVarintField(out, 3, BigInt(msg.producerEpoch));
|
|
495
|
+
putVarintField(out, 4, BigInt(msg.errorCode));
|
|
496
|
+
putRaw(out, msg.unknownFields);
|
|
497
|
+
return new Uint8Array(out);
|
|
498
|
+
}
|
|
499
|
+
static decode(bytes) {
|
|
500
|
+
const msg = new OpenProducerResponse();
|
|
501
|
+
const reader = new Reader(bytes);
|
|
502
|
+
let f;
|
|
503
|
+
while ((f = reader.field()) !== null) {
|
|
504
|
+
const [num, wire, value, raw] = f;
|
|
505
|
+
switch (num) {
|
|
506
|
+
case 1: msg.sessionId = new TextDecoder().decode(value); break;
|
|
507
|
+
case 2: msg.producerId = BigInt.asIntN(64, value); break;
|
|
508
|
+
case 3: msg.producerEpoch = Number(BigInt.asIntN(32, value)); break;
|
|
509
|
+
case 4: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
510
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return msg;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
export class CloseProducerRequest {
|
|
518
|
+
constructor({ sessionId = "" } = {}) {
|
|
519
|
+
this.sessionId = sessionId;
|
|
520
|
+
this.unknownFields = new Uint8Array(0);
|
|
521
|
+
}
|
|
522
|
+
static encode(msg) {
|
|
523
|
+
const out = [];
|
|
524
|
+
putStringField(out, 1, msg.sessionId);
|
|
525
|
+
putRaw(out, msg.unknownFields);
|
|
526
|
+
return new Uint8Array(out);
|
|
527
|
+
}
|
|
528
|
+
static decode(bytes) {
|
|
529
|
+
const msg = new CloseProducerRequest();
|
|
530
|
+
const reader = new Reader(bytes);
|
|
531
|
+
let f;
|
|
532
|
+
while ((f = reader.field()) !== null) {
|
|
533
|
+
const [num, wire, value, raw] = f;
|
|
534
|
+
switch (num) {
|
|
535
|
+
case 1: msg.sessionId = new TextDecoder().decode(value); break;
|
|
536
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
return msg;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
export class CloseProducerResponse {
|
|
544
|
+
constructor({ errorCode = 0 } = {}) {
|
|
545
|
+
this.errorCode = errorCode;
|
|
546
|
+
this.unknownFields = new Uint8Array(0);
|
|
547
|
+
}
|
|
548
|
+
static encode(msg) {
|
|
549
|
+
const out = [];
|
|
550
|
+
putVarintField(out, 1, BigInt(msg.errorCode));
|
|
551
|
+
putRaw(out, msg.unknownFields);
|
|
552
|
+
return new Uint8Array(out);
|
|
553
|
+
}
|
|
554
|
+
static decode(bytes) {
|
|
555
|
+
const msg = new CloseProducerResponse();
|
|
556
|
+
const reader = new Reader(bytes);
|
|
557
|
+
let f;
|
|
558
|
+
while ((f = reader.field()) !== null) {
|
|
559
|
+
const [num, wire, value, raw] = f;
|
|
560
|
+
switch (num) {
|
|
561
|
+
case 1: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
562
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
return msg;
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export class EndTransactionRequest {
|
|
570
|
+
constructor({ sessionId = "", commit = false } = {}) {
|
|
571
|
+
this.sessionId = sessionId;
|
|
572
|
+
this.commit = commit;
|
|
573
|
+
this.unknownFields = new Uint8Array(0);
|
|
574
|
+
}
|
|
575
|
+
static encode(msg) {
|
|
576
|
+
const out = [];
|
|
577
|
+
putStringField(out, 1, msg.sessionId);
|
|
578
|
+
putVarintField(out, 2, (msg.commit ? 1n : 0n));
|
|
579
|
+
putRaw(out, msg.unknownFields);
|
|
580
|
+
return new Uint8Array(out);
|
|
581
|
+
}
|
|
582
|
+
static decode(bytes) {
|
|
583
|
+
const msg = new EndTransactionRequest();
|
|
584
|
+
const reader = new Reader(bytes);
|
|
585
|
+
let f;
|
|
586
|
+
while ((f = reader.field()) !== null) {
|
|
587
|
+
const [num, wire, value, raw] = f;
|
|
588
|
+
switch (num) {
|
|
589
|
+
case 1: msg.sessionId = new TextDecoder().decode(value); break;
|
|
590
|
+
case 2: msg.commit = value !== 0n; break;
|
|
591
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
return msg;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export class EndTransactionResponse {
|
|
599
|
+
constructor({ errorCode = 0 } = {}) {
|
|
600
|
+
this.errorCode = errorCode;
|
|
601
|
+
this.unknownFields = new Uint8Array(0);
|
|
602
|
+
}
|
|
603
|
+
static encode(msg) {
|
|
604
|
+
const out = [];
|
|
605
|
+
putVarintField(out, 1, BigInt(msg.errorCode));
|
|
606
|
+
putRaw(out, msg.unknownFields);
|
|
607
|
+
return new Uint8Array(out);
|
|
608
|
+
}
|
|
609
|
+
static decode(bytes) {
|
|
610
|
+
const msg = new EndTransactionResponse();
|
|
611
|
+
const reader = new Reader(bytes);
|
|
612
|
+
let f;
|
|
613
|
+
while ((f = reader.field()) !== null) {
|
|
614
|
+
const [num, wire, value, raw] = f;
|
|
615
|
+
switch (num) {
|
|
616
|
+
case 1: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
617
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return msg;
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
export class ProduceRequest {
|
|
625
|
+
constructor({ topic = "", partition = 0, records = [], acks = 0, timeoutMs = 0, compression = 0, sessionId = "", transactionalId = "" } = {}) {
|
|
626
|
+
this.topic = topic;
|
|
627
|
+
this.partition = partition;
|
|
628
|
+
this.records = records;
|
|
629
|
+
this.acks = acks;
|
|
630
|
+
this.timeoutMs = timeoutMs;
|
|
631
|
+
this.compression = compression;
|
|
632
|
+
this.sessionId = sessionId;
|
|
633
|
+
this.transactionalId = transactionalId;
|
|
634
|
+
this.unknownFields = new Uint8Array(0);
|
|
635
|
+
}
|
|
636
|
+
static encode(msg) {
|
|
637
|
+
const out = [];
|
|
638
|
+
putStringField(out, 1, msg.topic);
|
|
639
|
+
putVarintField(out, 2, BigInt(msg.partition));
|
|
640
|
+
if (msg.records) for (const v of msg.records) putBytesField(out, 3, Record.encode(v));
|
|
641
|
+
putVarintField(out, 4, BigInt(msg.acks));
|
|
642
|
+
putVarintField(out, 5, BigInt(msg.timeoutMs));
|
|
643
|
+
putVarintField(out, 6, BigInt(msg.compression));
|
|
644
|
+
putStringField(out, 7, msg.sessionId);
|
|
645
|
+
putStringField(out, 8, msg.transactionalId);
|
|
646
|
+
putRaw(out, msg.unknownFields);
|
|
647
|
+
return new Uint8Array(out);
|
|
648
|
+
}
|
|
649
|
+
static decode(bytes) {
|
|
650
|
+
const msg = new ProduceRequest();
|
|
651
|
+
const reader = new Reader(bytes);
|
|
652
|
+
let f;
|
|
653
|
+
while ((f = reader.field()) !== null) {
|
|
654
|
+
const [num, wire, value, raw] = f;
|
|
655
|
+
switch (num) {
|
|
656
|
+
case 1: msg.topic = new TextDecoder().decode(value); break;
|
|
657
|
+
case 2: msg.partition = Number(BigInt.asIntN(32, value)); break;
|
|
658
|
+
case 3: msg.records.push(Record.decode(value)); break;
|
|
659
|
+
case 4: msg.acks = Number(BigInt.asIntN(32, value)); break;
|
|
660
|
+
case 5: msg.timeoutMs = Number(BigInt.asIntN(32, value)); break;
|
|
661
|
+
case 6: msg.compression = Number(BigInt.asIntN(32, value)); break;
|
|
662
|
+
case 7: msg.sessionId = new TextDecoder().decode(value); break;
|
|
663
|
+
case 8: msg.transactionalId = new TextDecoder().decode(value); break;
|
|
664
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
return msg;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
export class ProduceResponse {
|
|
672
|
+
constructor({ partition = 0, baseOffset = 0n, logAppendTimeMs = 0n, errorCode = 0 } = {}) {
|
|
673
|
+
this.partition = partition;
|
|
674
|
+
this.baseOffset = baseOffset;
|
|
675
|
+
this.logAppendTimeMs = logAppendTimeMs;
|
|
676
|
+
this.errorCode = errorCode;
|
|
677
|
+
this.unknownFields = new Uint8Array(0);
|
|
678
|
+
}
|
|
679
|
+
static encode(msg) {
|
|
680
|
+
const out = [];
|
|
681
|
+
putVarintField(out, 1, BigInt(msg.partition));
|
|
682
|
+
putVarintField(out, 2, BigInt(msg.baseOffset));
|
|
683
|
+
putVarintField(out, 3, BigInt(msg.logAppendTimeMs));
|
|
684
|
+
putVarintField(out, 4, BigInt(msg.errorCode));
|
|
685
|
+
putRaw(out, msg.unknownFields);
|
|
686
|
+
return new Uint8Array(out);
|
|
687
|
+
}
|
|
688
|
+
static decode(bytes) {
|
|
689
|
+
const msg = new ProduceResponse();
|
|
690
|
+
const reader = new Reader(bytes);
|
|
691
|
+
let f;
|
|
692
|
+
while ((f = reader.field()) !== null) {
|
|
693
|
+
const [num, wire, value, raw] = f;
|
|
694
|
+
switch (num) {
|
|
695
|
+
case 1: msg.partition = Number(BigInt.asIntN(32, value)); break;
|
|
696
|
+
case 2: msg.baseOffset = BigInt.asIntN(64, value); break;
|
|
697
|
+
case 3: msg.logAppendTimeMs = BigInt.asIntN(64, value); break;
|
|
698
|
+
case 4: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
699
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
return msg;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
export class ConsumeRequest {
|
|
707
|
+
constructor({ topic = "", partition = 0, offset = 0n, maxRecords = 0, maxWaitMs = 0, minBytes = 0, readCommitted = false } = {}) {
|
|
708
|
+
this.topic = topic;
|
|
709
|
+
this.partition = partition;
|
|
710
|
+
this.offset = offset;
|
|
711
|
+
this.maxRecords = maxRecords;
|
|
712
|
+
this.maxWaitMs = maxWaitMs;
|
|
713
|
+
this.minBytes = minBytes;
|
|
714
|
+
this.readCommitted = readCommitted;
|
|
715
|
+
this.unknownFields = new Uint8Array(0);
|
|
716
|
+
}
|
|
717
|
+
static encode(msg) {
|
|
718
|
+
const out = [];
|
|
719
|
+
putStringField(out, 1, msg.topic);
|
|
720
|
+
putVarintField(out, 2, BigInt(msg.partition));
|
|
721
|
+
putVarintField(out, 3, BigInt(msg.offset));
|
|
722
|
+
putVarintField(out, 4, BigInt(msg.maxRecords));
|
|
723
|
+
putVarintField(out, 5, BigInt(msg.maxWaitMs));
|
|
724
|
+
putVarintField(out, 6, BigInt(msg.minBytes));
|
|
725
|
+
putVarintField(out, 7, (msg.readCommitted ? 1n : 0n));
|
|
726
|
+
putRaw(out, msg.unknownFields);
|
|
727
|
+
return new Uint8Array(out);
|
|
728
|
+
}
|
|
729
|
+
static decode(bytes) {
|
|
730
|
+
const msg = new ConsumeRequest();
|
|
731
|
+
const reader = new Reader(bytes);
|
|
732
|
+
let f;
|
|
733
|
+
while ((f = reader.field()) !== null) {
|
|
734
|
+
const [num, wire, value, raw] = f;
|
|
735
|
+
switch (num) {
|
|
736
|
+
case 1: msg.topic = new TextDecoder().decode(value); break;
|
|
737
|
+
case 2: msg.partition = Number(BigInt.asIntN(32, value)); break;
|
|
738
|
+
case 3: msg.offset = BigInt.asIntN(64, value); break;
|
|
739
|
+
case 4: msg.maxRecords = Number(BigInt.asIntN(32, value)); break;
|
|
740
|
+
case 5: msg.maxWaitMs = Number(BigInt.asIntN(32, value)); break;
|
|
741
|
+
case 6: msg.minBytes = Number(BigInt.asIntN(32, value)); break;
|
|
742
|
+
case 7: msg.readCommitted = value !== 0n; break;
|
|
743
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
return msg;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
export class ConsumeResponse {
|
|
751
|
+
constructor({ topic = "", partition = 0, highWatermark = 0n, errorCode = 0, records = [] } = {}) {
|
|
752
|
+
this.topic = topic;
|
|
753
|
+
this.partition = partition;
|
|
754
|
+
this.highWatermark = highWatermark;
|
|
755
|
+
this.errorCode = errorCode;
|
|
756
|
+
this.records = records;
|
|
757
|
+
this.unknownFields = new Uint8Array(0);
|
|
758
|
+
}
|
|
759
|
+
static encode(msg) {
|
|
760
|
+
const out = [];
|
|
761
|
+
putStringField(out, 1, msg.topic);
|
|
762
|
+
putVarintField(out, 2, BigInt(msg.partition));
|
|
763
|
+
putVarintField(out, 3, BigInt(msg.highWatermark));
|
|
764
|
+
putVarintField(out, 4, BigInt(msg.errorCode));
|
|
765
|
+
if (msg.records) for (const v of msg.records) putBytesField(out, 5, FetchedRecord.encode(v));
|
|
766
|
+
putRaw(out, msg.unknownFields);
|
|
767
|
+
return new Uint8Array(out);
|
|
768
|
+
}
|
|
769
|
+
static decode(bytes) {
|
|
770
|
+
const msg = new ConsumeResponse();
|
|
771
|
+
const reader = new Reader(bytes);
|
|
772
|
+
let f;
|
|
773
|
+
while ((f = reader.field()) !== null) {
|
|
774
|
+
const [num, wire, value, raw] = f;
|
|
775
|
+
switch (num) {
|
|
776
|
+
case 1: msg.topic = new TextDecoder().decode(value); break;
|
|
777
|
+
case 2: msg.partition = Number(BigInt.asIntN(32, value)); break;
|
|
778
|
+
case 3: msg.highWatermark = BigInt.asIntN(64, value); break;
|
|
779
|
+
case 4: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
780
|
+
case 5: msg.records.push(FetchedRecord.decode(value)); break;
|
|
781
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
return msg;
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
export class GroupSubscribeRequest {
|
|
789
|
+
constructor({ groupId = "", topics = [], groupInstanceId = "", sessionTimeoutMs = 0, maxPollRecords = 0, autoOffsetReset = "", readCommitted = false } = {}) {
|
|
790
|
+
this.groupId = groupId;
|
|
791
|
+
this.topics = topics;
|
|
792
|
+
this.groupInstanceId = groupInstanceId;
|
|
793
|
+
this.sessionTimeoutMs = sessionTimeoutMs;
|
|
794
|
+
this.maxPollRecords = maxPollRecords;
|
|
795
|
+
this.autoOffsetReset = autoOffsetReset;
|
|
796
|
+
this.readCommitted = readCommitted;
|
|
797
|
+
this.unknownFields = new Uint8Array(0);
|
|
798
|
+
}
|
|
799
|
+
static encode(msg) {
|
|
800
|
+
const out = [];
|
|
801
|
+
putStringField(out, 1, msg.groupId);
|
|
802
|
+
if (msg.topics) for (const v of msg.topics) putBytesField(out, 2, new TextEncoder().encode(v));
|
|
803
|
+
putStringField(out, 3, msg.groupInstanceId);
|
|
804
|
+
putVarintField(out, 4, BigInt(msg.sessionTimeoutMs));
|
|
805
|
+
putVarintField(out, 5, BigInt(msg.maxPollRecords));
|
|
806
|
+
putStringField(out, 6, msg.autoOffsetReset);
|
|
807
|
+
putVarintField(out, 7, (msg.readCommitted ? 1n : 0n));
|
|
808
|
+
putRaw(out, msg.unknownFields);
|
|
809
|
+
return new Uint8Array(out);
|
|
810
|
+
}
|
|
811
|
+
static decode(bytes) {
|
|
812
|
+
const msg = new GroupSubscribeRequest();
|
|
813
|
+
const reader = new Reader(bytes);
|
|
814
|
+
let f;
|
|
815
|
+
while ((f = reader.field()) !== null) {
|
|
816
|
+
const [num, wire, value, raw] = f;
|
|
817
|
+
switch (num) {
|
|
818
|
+
case 1: msg.groupId = new TextDecoder().decode(value); break;
|
|
819
|
+
case 2: msg.topics.push(new TextDecoder().decode(value)); break;
|
|
820
|
+
case 3: msg.groupInstanceId = new TextDecoder().decode(value); break;
|
|
821
|
+
case 4: msg.sessionTimeoutMs = Number(BigInt.asIntN(32, value)); break;
|
|
822
|
+
case 5: msg.maxPollRecords = Number(BigInt.asIntN(32, value)); break;
|
|
823
|
+
case 6: msg.autoOffsetReset = new TextDecoder().decode(value); break;
|
|
824
|
+
case 7: msg.readCommitted = value !== 0n; break;
|
|
825
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return msg;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
export class GroupSubscribeResponse {
|
|
833
|
+
constructor({ assignment = undefined, batch = undefined, groupError = undefined } = {}) {
|
|
834
|
+
this.assignment = assignment;
|
|
835
|
+
this.batch = batch;
|
|
836
|
+
this.groupError = groupError;
|
|
837
|
+
this.unknownFields = new Uint8Array(0);
|
|
838
|
+
}
|
|
839
|
+
static encode(msg) {
|
|
840
|
+
const out = [];
|
|
841
|
+
if (!(msg.batch || msg.groupError)) {
|
|
842
|
+
if (msg.assignment) putBytesField(out, 1, Assignment.encode(msg.assignment));
|
|
843
|
+
}
|
|
844
|
+
if (!(msg.groupError)) {
|
|
845
|
+
if (msg.batch) putBytesField(out, 2, RecordBatch.encode(msg.batch));
|
|
846
|
+
}
|
|
847
|
+
if (msg.groupError) putBytesField(out, 3, GroupError.encode(msg.groupError));
|
|
848
|
+
putRaw(out, msg.unknownFields);
|
|
849
|
+
return new Uint8Array(out);
|
|
850
|
+
}
|
|
851
|
+
static decode(bytes) {
|
|
852
|
+
const msg = new GroupSubscribeResponse();
|
|
853
|
+
const reader = new Reader(bytes);
|
|
854
|
+
let f;
|
|
855
|
+
while ((f = reader.field()) !== null) {
|
|
856
|
+
const [num, wire, value, raw] = f;
|
|
857
|
+
switch (num) {
|
|
858
|
+
case 1: msg.batch = undefined; msg.groupError = undefined; msg.assignment = Assignment.decode(value); break;
|
|
859
|
+
case 2: msg.assignment = undefined; msg.groupError = undefined; msg.batch = RecordBatch.decode(value); break;
|
|
860
|
+
case 3: msg.assignment = undefined; msg.batch = undefined; msg.groupError = GroupError.decode(value); break;
|
|
861
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return msg;
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
export class Assignment {
|
|
869
|
+
constructor({ generationId = 0, memberId = "", partitions = [] } = {}) {
|
|
870
|
+
this.generationId = generationId;
|
|
871
|
+
this.memberId = memberId;
|
|
872
|
+
this.partitions = partitions;
|
|
873
|
+
this.unknownFields = new Uint8Array(0);
|
|
874
|
+
}
|
|
875
|
+
static encode(msg) {
|
|
876
|
+
const out = [];
|
|
877
|
+
putVarintField(out, 1, BigInt(msg.generationId));
|
|
878
|
+
putStringField(out, 2, msg.memberId);
|
|
879
|
+
if (msg.partitions) for (const v of msg.partitions) putBytesField(out, 3, TopicPartition.encode(v));
|
|
880
|
+
putRaw(out, msg.unknownFields);
|
|
881
|
+
return new Uint8Array(out);
|
|
882
|
+
}
|
|
883
|
+
static decode(bytes) {
|
|
884
|
+
const msg = new Assignment();
|
|
885
|
+
const reader = new Reader(bytes);
|
|
886
|
+
let f;
|
|
887
|
+
while ((f = reader.field()) !== null) {
|
|
888
|
+
const [num, wire, value, raw] = f;
|
|
889
|
+
switch (num) {
|
|
890
|
+
case 1: msg.generationId = Number(BigInt.asIntN(32, value)); break;
|
|
891
|
+
case 2: msg.memberId = new TextDecoder().decode(value); break;
|
|
892
|
+
case 3: msg.partitions.push(TopicPartition.decode(value)); break;
|
|
893
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
return msg;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
export class RecordBatch {
|
|
901
|
+
constructor({ topic = "", partition = 0, highWatermark = 0n, records = [] } = {}) {
|
|
902
|
+
this.topic = topic;
|
|
903
|
+
this.partition = partition;
|
|
904
|
+
this.highWatermark = highWatermark;
|
|
905
|
+
this.records = records;
|
|
906
|
+
this.unknownFields = new Uint8Array(0);
|
|
907
|
+
}
|
|
908
|
+
static encode(msg) {
|
|
909
|
+
const out = [];
|
|
910
|
+
putStringField(out, 1, msg.topic);
|
|
911
|
+
putVarintField(out, 2, BigInt(msg.partition));
|
|
912
|
+
putVarintField(out, 3, BigInt(msg.highWatermark));
|
|
913
|
+
if (msg.records) for (const v of msg.records) putBytesField(out, 4, FetchedRecord.encode(v));
|
|
914
|
+
putRaw(out, msg.unknownFields);
|
|
915
|
+
return new Uint8Array(out);
|
|
916
|
+
}
|
|
917
|
+
static decode(bytes) {
|
|
918
|
+
const msg = new RecordBatch();
|
|
919
|
+
const reader = new Reader(bytes);
|
|
920
|
+
let f;
|
|
921
|
+
while ((f = reader.field()) !== null) {
|
|
922
|
+
const [num, wire, value, raw] = f;
|
|
923
|
+
switch (num) {
|
|
924
|
+
case 1: msg.topic = new TextDecoder().decode(value); break;
|
|
925
|
+
case 2: msg.partition = Number(BigInt.asIntN(32, value)); break;
|
|
926
|
+
case 3: msg.highWatermark = BigInt.asIntN(64, value); break;
|
|
927
|
+
case 4: msg.records.push(FetchedRecord.decode(value)); break;
|
|
928
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
return msg;
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
export class GroupError {
|
|
936
|
+
constructor({ errorCode = 0, message = "" } = {}) {
|
|
937
|
+
this.errorCode = errorCode;
|
|
938
|
+
this.message = message;
|
|
939
|
+
this.unknownFields = new Uint8Array(0);
|
|
940
|
+
}
|
|
941
|
+
static encode(msg) {
|
|
942
|
+
const out = [];
|
|
943
|
+
putVarintField(out, 1, BigInt(msg.errorCode));
|
|
944
|
+
putStringField(out, 2, msg.message);
|
|
945
|
+
putRaw(out, msg.unknownFields);
|
|
946
|
+
return new Uint8Array(out);
|
|
947
|
+
}
|
|
948
|
+
static decode(bytes) {
|
|
949
|
+
const msg = new GroupError();
|
|
950
|
+
const reader = new Reader(bytes);
|
|
951
|
+
let f;
|
|
952
|
+
while ((f = reader.field()) !== null) {
|
|
953
|
+
const [num, wire, value, raw] = f;
|
|
954
|
+
switch (num) {
|
|
955
|
+
case 1: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
956
|
+
case 2: msg.message = new TextDecoder().decode(value); break;
|
|
957
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
return msg;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
export class ListOffsetsRequest {
|
|
965
|
+
constructor({ topic = "", partition = 0, timestamp = 0n, readCommitted = false } = {}) {
|
|
966
|
+
this.topic = topic;
|
|
967
|
+
this.partition = partition;
|
|
968
|
+
this.timestamp = timestamp;
|
|
969
|
+
this.readCommitted = readCommitted;
|
|
970
|
+
this.unknownFields = new Uint8Array(0);
|
|
971
|
+
}
|
|
972
|
+
static encode(msg) {
|
|
973
|
+
const out = [];
|
|
974
|
+
putStringField(out, 1, msg.topic);
|
|
975
|
+
putVarintField(out, 2, BigInt(msg.partition));
|
|
976
|
+
putVarintField(out, 3, BigInt(msg.timestamp));
|
|
977
|
+
putVarintField(out, 4, (msg.readCommitted ? 1n : 0n));
|
|
978
|
+
putRaw(out, msg.unknownFields);
|
|
979
|
+
return new Uint8Array(out);
|
|
980
|
+
}
|
|
981
|
+
static decode(bytes) {
|
|
982
|
+
const msg = new ListOffsetsRequest();
|
|
983
|
+
const reader = new Reader(bytes);
|
|
984
|
+
let f;
|
|
985
|
+
while ((f = reader.field()) !== null) {
|
|
986
|
+
const [num, wire, value, raw] = f;
|
|
987
|
+
switch (num) {
|
|
988
|
+
case 1: msg.topic = new TextDecoder().decode(value); break;
|
|
989
|
+
case 2: msg.partition = Number(BigInt.asIntN(32, value)); break;
|
|
990
|
+
case 3: msg.timestamp = BigInt.asIntN(64, value); break;
|
|
991
|
+
case 4: msg.readCommitted = value !== 0n; break;
|
|
992
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
return msg;
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
export class ListOffsetsResponse {
|
|
1000
|
+
constructor({ offset = 0n, timestampMs = 0n, errorCode = 0 } = {}) {
|
|
1001
|
+
this.offset = offset;
|
|
1002
|
+
this.timestampMs = timestampMs;
|
|
1003
|
+
this.errorCode = errorCode;
|
|
1004
|
+
this.unknownFields = new Uint8Array(0);
|
|
1005
|
+
}
|
|
1006
|
+
static encode(msg) {
|
|
1007
|
+
const out = [];
|
|
1008
|
+
putVarintField(out, 1, BigInt(msg.offset));
|
|
1009
|
+
putVarintField(out, 2, BigInt(msg.timestampMs));
|
|
1010
|
+
putVarintField(out, 3, BigInt(msg.errorCode));
|
|
1011
|
+
putRaw(out, msg.unknownFields);
|
|
1012
|
+
return new Uint8Array(out);
|
|
1013
|
+
}
|
|
1014
|
+
static decode(bytes) {
|
|
1015
|
+
const msg = new ListOffsetsResponse();
|
|
1016
|
+
const reader = new Reader(bytes);
|
|
1017
|
+
let f;
|
|
1018
|
+
while ((f = reader.field()) !== null) {
|
|
1019
|
+
const [num, wire, value, raw] = f;
|
|
1020
|
+
switch (num) {
|
|
1021
|
+
case 1: msg.offset = BigInt.asIntN(64, value); break;
|
|
1022
|
+
case 2: msg.timestampMs = BigInt.asIntN(64, value); break;
|
|
1023
|
+
case 3: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
1024
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
return msg;
|
|
1028
|
+
}
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1031
|
+
export class CommitOffsetRequest {
|
|
1032
|
+
constructor({ groupId = "", topic = "", partition = 0, committedOffset = 0n, metadata = "", sessionId = "" } = {}) {
|
|
1033
|
+
this.groupId = groupId;
|
|
1034
|
+
this.topic = topic;
|
|
1035
|
+
this.partition = partition;
|
|
1036
|
+
this.committedOffset = committedOffset;
|
|
1037
|
+
this.metadata = metadata;
|
|
1038
|
+
this.sessionId = sessionId;
|
|
1039
|
+
this.unknownFields = new Uint8Array(0);
|
|
1040
|
+
}
|
|
1041
|
+
static encode(msg) {
|
|
1042
|
+
const out = [];
|
|
1043
|
+
putStringField(out, 1, msg.groupId);
|
|
1044
|
+
putStringField(out, 2, msg.topic);
|
|
1045
|
+
putVarintField(out, 3, BigInt(msg.partition));
|
|
1046
|
+
putVarintField(out, 4, BigInt(msg.committedOffset));
|
|
1047
|
+
putStringField(out, 5, msg.metadata);
|
|
1048
|
+
putStringField(out, 6, msg.sessionId);
|
|
1049
|
+
putRaw(out, msg.unknownFields);
|
|
1050
|
+
return new Uint8Array(out);
|
|
1051
|
+
}
|
|
1052
|
+
static decode(bytes) {
|
|
1053
|
+
const msg = new CommitOffsetRequest();
|
|
1054
|
+
const reader = new Reader(bytes);
|
|
1055
|
+
let f;
|
|
1056
|
+
while ((f = reader.field()) !== null) {
|
|
1057
|
+
const [num, wire, value, raw] = f;
|
|
1058
|
+
switch (num) {
|
|
1059
|
+
case 1: msg.groupId = new TextDecoder().decode(value); break;
|
|
1060
|
+
case 2: msg.topic = new TextDecoder().decode(value); break;
|
|
1061
|
+
case 3: msg.partition = Number(BigInt.asIntN(32, value)); break;
|
|
1062
|
+
case 4: msg.committedOffset = BigInt.asIntN(64, value); break;
|
|
1063
|
+
case 5: msg.metadata = new TextDecoder().decode(value); break;
|
|
1064
|
+
case 6: msg.sessionId = new TextDecoder().decode(value); break;
|
|
1065
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
return msg;
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
export class CommitOffsetResponse {
|
|
1073
|
+
constructor({ errorCode = 0 } = {}) {
|
|
1074
|
+
this.errorCode = errorCode;
|
|
1075
|
+
this.unknownFields = new Uint8Array(0);
|
|
1076
|
+
}
|
|
1077
|
+
static encode(msg) {
|
|
1078
|
+
const out = [];
|
|
1079
|
+
putVarintField(out, 1, BigInt(msg.errorCode));
|
|
1080
|
+
putRaw(out, msg.unknownFields);
|
|
1081
|
+
return new Uint8Array(out);
|
|
1082
|
+
}
|
|
1083
|
+
static decode(bytes) {
|
|
1084
|
+
const msg = new CommitOffsetResponse();
|
|
1085
|
+
const reader = new Reader(bytes);
|
|
1086
|
+
let f;
|
|
1087
|
+
while ((f = reader.field()) !== null) {
|
|
1088
|
+
const [num, wire, value, raw] = f;
|
|
1089
|
+
switch (num) {
|
|
1090
|
+
case 1: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
1091
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
return msg;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
export class FetchOffsetRequest {
|
|
1099
|
+
constructor({ groupId = "", topic = "", partition = 0 } = {}) {
|
|
1100
|
+
this.groupId = groupId;
|
|
1101
|
+
this.topic = topic;
|
|
1102
|
+
this.partition = partition;
|
|
1103
|
+
this.unknownFields = new Uint8Array(0);
|
|
1104
|
+
}
|
|
1105
|
+
static encode(msg) {
|
|
1106
|
+
const out = [];
|
|
1107
|
+
putStringField(out, 1, msg.groupId);
|
|
1108
|
+
putStringField(out, 2, msg.topic);
|
|
1109
|
+
putVarintField(out, 3, BigInt(msg.partition));
|
|
1110
|
+
putRaw(out, msg.unknownFields);
|
|
1111
|
+
return new Uint8Array(out);
|
|
1112
|
+
}
|
|
1113
|
+
static decode(bytes) {
|
|
1114
|
+
const msg = new FetchOffsetRequest();
|
|
1115
|
+
const reader = new Reader(bytes);
|
|
1116
|
+
let f;
|
|
1117
|
+
while ((f = reader.field()) !== null) {
|
|
1118
|
+
const [num, wire, value, raw] = f;
|
|
1119
|
+
switch (num) {
|
|
1120
|
+
case 1: msg.groupId = new TextDecoder().decode(value); break;
|
|
1121
|
+
case 2: msg.topic = new TextDecoder().decode(value); break;
|
|
1122
|
+
case 3: msg.partition = Number(BigInt.asIntN(32, value)); break;
|
|
1123
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
return msg;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
export class FetchOffsetResponse {
|
|
1131
|
+
constructor({ committedOffset = 0n, metadata = "", errorCode = 0 } = {}) {
|
|
1132
|
+
this.committedOffset = committedOffset;
|
|
1133
|
+
this.metadata = metadata;
|
|
1134
|
+
this.errorCode = errorCode;
|
|
1135
|
+
this.unknownFields = new Uint8Array(0);
|
|
1136
|
+
}
|
|
1137
|
+
static encode(msg) {
|
|
1138
|
+
const out = [];
|
|
1139
|
+
putVarintField(out, 1, BigInt(msg.committedOffset));
|
|
1140
|
+
putStringField(out, 2, msg.metadata);
|
|
1141
|
+
putVarintField(out, 3, BigInt(msg.errorCode));
|
|
1142
|
+
putRaw(out, msg.unknownFields);
|
|
1143
|
+
return new Uint8Array(out);
|
|
1144
|
+
}
|
|
1145
|
+
static decode(bytes) {
|
|
1146
|
+
const msg = new FetchOffsetResponse();
|
|
1147
|
+
const reader = new Reader(bytes);
|
|
1148
|
+
let f;
|
|
1149
|
+
while ((f = reader.field()) !== null) {
|
|
1150
|
+
const [num, wire, value, raw] = f;
|
|
1151
|
+
switch (num) {
|
|
1152
|
+
case 1: msg.committedOffset = BigInt.asIntN(64, value); break;
|
|
1153
|
+
case 2: msg.metadata = new TextDecoder().decode(value); break;
|
|
1154
|
+
case 3: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
1155
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
return msg;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
export class NewTopic {
|
|
1163
|
+
constructor({ name = "", numPartitions = 0, replicationFactor = 0 } = {}) {
|
|
1164
|
+
this.name = name;
|
|
1165
|
+
this.numPartitions = numPartitions;
|
|
1166
|
+
this.replicationFactor = replicationFactor;
|
|
1167
|
+
this.unknownFields = new Uint8Array(0);
|
|
1168
|
+
}
|
|
1169
|
+
static encode(msg) {
|
|
1170
|
+
const out = [];
|
|
1171
|
+
putStringField(out, 1, msg.name);
|
|
1172
|
+
putVarintField(out, 2, BigInt(msg.numPartitions));
|
|
1173
|
+
putVarintField(out, 3, BigInt(msg.replicationFactor));
|
|
1174
|
+
putRaw(out, msg.unknownFields);
|
|
1175
|
+
return new Uint8Array(out);
|
|
1176
|
+
}
|
|
1177
|
+
static decode(bytes) {
|
|
1178
|
+
const msg = new NewTopic();
|
|
1179
|
+
const reader = new Reader(bytes);
|
|
1180
|
+
let f;
|
|
1181
|
+
while ((f = reader.field()) !== null) {
|
|
1182
|
+
const [num, wire, value, raw] = f;
|
|
1183
|
+
switch (num) {
|
|
1184
|
+
case 1: msg.name = new TextDecoder().decode(value); break;
|
|
1185
|
+
case 2: msg.numPartitions = Number(BigInt.asIntN(32, value)); break;
|
|
1186
|
+
case 3: msg.replicationFactor = Number(BigInt.asIntN(32, value)); break;
|
|
1187
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
return msg;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
export class CreateTopicsRequest {
|
|
1195
|
+
constructor({ topics = [], timeoutMs = 0, validateOnly = false } = {}) {
|
|
1196
|
+
this.topics = topics;
|
|
1197
|
+
this.timeoutMs = timeoutMs;
|
|
1198
|
+
this.validateOnly = validateOnly;
|
|
1199
|
+
this.unknownFields = new Uint8Array(0);
|
|
1200
|
+
}
|
|
1201
|
+
static encode(msg) {
|
|
1202
|
+
const out = [];
|
|
1203
|
+
if (msg.topics) for (const v of msg.topics) putBytesField(out, 1, NewTopic.encode(v));
|
|
1204
|
+
putVarintField(out, 2, BigInt(msg.timeoutMs));
|
|
1205
|
+
putVarintField(out, 3, (msg.validateOnly ? 1n : 0n));
|
|
1206
|
+
putRaw(out, msg.unknownFields);
|
|
1207
|
+
return new Uint8Array(out);
|
|
1208
|
+
}
|
|
1209
|
+
static decode(bytes) {
|
|
1210
|
+
const msg = new CreateTopicsRequest();
|
|
1211
|
+
const reader = new Reader(bytes);
|
|
1212
|
+
let f;
|
|
1213
|
+
while ((f = reader.field()) !== null) {
|
|
1214
|
+
const [num, wire, value, raw] = f;
|
|
1215
|
+
switch (num) {
|
|
1216
|
+
case 1: msg.topics.push(NewTopic.decode(value)); break;
|
|
1217
|
+
case 2: msg.timeoutMs = Number(BigInt.asIntN(32, value)); break;
|
|
1218
|
+
case 3: msg.validateOnly = value !== 0n; break;
|
|
1219
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
return msg;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
export class TopicError {
|
|
1227
|
+
constructor({ name = "", errorCode = 0 } = {}) {
|
|
1228
|
+
this.name = name;
|
|
1229
|
+
this.errorCode = errorCode;
|
|
1230
|
+
this.unknownFields = new Uint8Array(0);
|
|
1231
|
+
}
|
|
1232
|
+
static encode(msg) {
|
|
1233
|
+
const out = [];
|
|
1234
|
+
putStringField(out, 1, msg.name);
|
|
1235
|
+
putVarintField(out, 2, BigInt(msg.errorCode));
|
|
1236
|
+
putRaw(out, msg.unknownFields);
|
|
1237
|
+
return new Uint8Array(out);
|
|
1238
|
+
}
|
|
1239
|
+
static decode(bytes) {
|
|
1240
|
+
const msg = new TopicError();
|
|
1241
|
+
const reader = new Reader(bytes);
|
|
1242
|
+
let f;
|
|
1243
|
+
while ((f = reader.field()) !== null) {
|
|
1244
|
+
const [num, wire, value, raw] = f;
|
|
1245
|
+
switch (num) {
|
|
1246
|
+
case 1: msg.name = new TextDecoder().decode(value); break;
|
|
1247
|
+
case 2: msg.errorCode = Number(BigInt.asIntN(32, value)); break;
|
|
1248
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1251
|
+
return msg;
|
|
1252
|
+
}
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
export class CreateTopicsResponse {
|
|
1256
|
+
constructor({ results = [] } = {}) {
|
|
1257
|
+
this.results = results;
|
|
1258
|
+
this.unknownFields = new Uint8Array(0);
|
|
1259
|
+
}
|
|
1260
|
+
static encode(msg) {
|
|
1261
|
+
const out = [];
|
|
1262
|
+
if (msg.results) for (const v of msg.results) putBytesField(out, 1, TopicError.encode(v));
|
|
1263
|
+
putRaw(out, msg.unknownFields);
|
|
1264
|
+
return new Uint8Array(out);
|
|
1265
|
+
}
|
|
1266
|
+
static decode(bytes) {
|
|
1267
|
+
const msg = new CreateTopicsResponse();
|
|
1268
|
+
const reader = new Reader(bytes);
|
|
1269
|
+
let f;
|
|
1270
|
+
while ((f = reader.field()) !== null) {
|
|
1271
|
+
const [num, wire, value, raw] = f;
|
|
1272
|
+
switch (num) {
|
|
1273
|
+
case 1: msg.results.push(TopicError.decode(value)); break;
|
|
1274
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
return msg;
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
export class DeleteTopicsRequest {
|
|
1282
|
+
constructor({ topics = [], timeoutMs = 0 } = {}) {
|
|
1283
|
+
this.topics = topics;
|
|
1284
|
+
this.timeoutMs = timeoutMs;
|
|
1285
|
+
this.unknownFields = new Uint8Array(0);
|
|
1286
|
+
}
|
|
1287
|
+
static encode(msg) {
|
|
1288
|
+
const out = [];
|
|
1289
|
+
if (msg.topics) for (const v of msg.topics) putBytesField(out, 1, new TextEncoder().encode(v));
|
|
1290
|
+
putVarintField(out, 2, BigInt(msg.timeoutMs));
|
|
1291
|
+
putRaw(out, msg.unknownFields);
|
|
1292
|
+
return new Uint8Array(out);
|
|
1293
|
+
}
|
|
1294
|
+
static decode(bytes) {
|
|
1295
|
+
const msg = new DeleteTopicsRequest();
|
|
1296
|
+
const reader = new Reader(bytes);
|
|
1297
|
+
let f;
|
|
1298
|
+
while ((f = reader.field()) !== null) {
|
|
1299
|
+
const [num, wire, value, raw] = f;
|
|
1300
|
+
switch (num) {
|
|
1301
|
+
case 1: msg.topics.push(new TextDecoder().decode(value)); break;
|
|
1302
|
+
case 2: msg.timeoutMs = Number(BigInt.asIntN(32, value)); break;
|
|
1303
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
return msg;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
export class DeleteTopicsResponse {
|
|
1311
|
+
constructor({ results = [] } = {}) {
|
|
1312
|
+
this.results = results;
|
|
1313
|
+
this.unknownFields = new Uint8Array(0);
|
|
1314
|
+
}
|
|
1315
|
+
static encode(msg) {
|
|
1316
|
+
const out = [];
|
|
1317
|
+
if (msg.results) for (const v of msg.results) putBytesField(out, 1, TopicError.encode(v));
|
|
1318
|
+
putRaw(out, msg.unknownFields);
|
|
1319
|
+
return new Uint8Array(out);
|
|
1320
|
+
}
|
|
1321
|
+
static decode(bytes) {
|
|
1322
|
+
const msg = new DeleteTopicsResponse();
|
|
1323
|
+
const reader = new Reader(bytes);
|
|
1324
|
+
let f;
|
|
1325
|
+
while ((f = reader.field()) !== null) {
|
|
1326
|
+
const [num, wire, value, raw] = f;
|
|
1327
|
+
switch (num) {
|
|
1328
|
+
case 1: msg.results.push(TopicError.decode(value)); break;
|
|
1329
|
+
default: msg.unknownFields = concatBytes(msg.unknownFields, raw); break;
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
return msg;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
|