@s2-dev/streamstore 0.16.12 → 0.17.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/dist/cjs/basin.d.ts +6 -2
- package/dist/cjs/basin.d.ts.map +1 -1
- package/dist/cjs/basin.js +11 -5
- package/dist/cjs/basin.js.map +1 -1
- package/dist/cjs/batch-transform.d.ts +64 -0
- package/dist/cjs/batch-transform.d.ts.map +1 -0
- package/dist/cjs/batch-transform.js +144 -0
- package/dist/cjs/batch-transform.js.map +1 -0
- package/dist/cjs/generated/proto/s2.d.ts.map +1 -0
- package/dist/cjs/generated/proto/s2.js.map +1 -0
- package/dist/cjs/index.d.ts +4 -2
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +5 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/stream/factory.d.ts +15 -0
- package/dist/cjs/lib/stream/factory.d.ts.map +1 -0
- package/dist/cjs/lib/stream/factory.js +36 -0
- package/dist/cjs/lib/stream/factory.js.map +1 -0
- package/dist/cjs/lib/stream/runtime.d.ts +13 -0
- package/dist/cjs/lib/stream/runtime.d.ts.map +1 -0
- package/dist/cjs/lib/stream/runtime.js +50 -0
- package/dist/cjs/lib/stream/runtime.js.map +1 -0
- package/dist/cjs/lib/stream/transport/fetch/index.d.ts +79 -0
- package/dist/cjs/lib/stream/transport/fetch/index.d.ts.map +1 -0
- package/dist/cjs/lib/stream/transport/fetch/index.js +382 -0
- package/dist/cjs/lib/stream/transport/fetch/index.js.map +1 -0
- package/dist/cjs/lib/stream/transport/fetch/shared.d.ts +7 -0
- package/dist/cjs/lib/stream/transport/fetch/shared.d.ts.map +1 -0
- package/dist/cjs/lib/stream/transport/fetch/shared.js +170 -0
- package/dist/cjs/lib/stream/transport/fetch/shared.js.map +1 -0
- package/dist/cjs/lib/stream/transport/s2s/framing.d.ts +47 -0
- package/dist/cjs/lib/stream/transport/s2s/framing.d.ts.map +1 -0
- package/dist/cjs/lib/stream/transport/s2s/framing.js +123 -0
- package/dist/cjs/lib/stream/transport/s2s/framing.js.map +1 -0
- package/dist/cjs/lib/stream/transport/s2s/index.d.ts +23 -0
- package/dist/cjs/lib/stream/transport/s2s/index.d.ts.map +1 -0
- package/dist/cjs/lib/stream/transport/s2s/index.js +785 -0
- package/dist/cjs/lib/stream/transport/s2s/index.js.map +1 -0
- package/dist/cjs/lib/stream/types.d.ts +53 -0
- package/dist/cjs/lib/stream/types.d.ts.map +1 -0
- package/dist/cjs/lib/stream/types.js +3 -0
- package/dist/cjs/lib/stream/types.js.map +1 -0
- package/dist/cjs/stream.d.ts +22 -116
- package/dist/cjs/stream.d.ts.map +1 -1
- package/dist/cjs/stream.js +35 -551
- package/dist/cjs/stream.js.map +1 -1
- package/dist/cjs/utils.d.ts +32 -6
- package/dist/cjs/utils.d.ts.map +1 -1
- package/dist/cjs/utils.js +129 -34
- package/dist/cjs/utils.js.map +1 -1
- package/dist/esm/basin.d.ts +6 -2
- package/dist/esm/basin.d.ts.map +1 -1
- package/dist/esm/basin.js +11 -5
- package/dist/esm/basin.js.map +1 -1
- package/dist/esm/batch-transform.d.ts +64 -0
- package/dist/esm/batch-transform.d.ts.map +1 -0
- package/dist/esm/batch-transform.js +140 -0
- package/dist/esm/batch-transform.js.map +1 -0
- package/dist/esm/generated/proto/s2.d.ts.map +1 -0
- package/dist/esm/generated/proto/s2.js.map +1 -0
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/stream/factory.d.ts +15 -0
- package/dist/esm/lib/stream/factory.d.ts.map +1 -0
- package/dist/esm/lib/stream/factory.js +33 -0
- package/dist/esm/lib/stream/factory.js.map +1 -0
- package/dist/esm/lib/stream/runtime.d.ts +13 -0
- package/dist/esm/lib/stream/runtime.d.ts.map +1 -0
- package/dist/esm/lib/stream/runtime.js +46 -0
- package/dist/esm/lib/stream/runtime.js.map +1 -0
- package/dist/esm/lib/stream/transport/fetch/index.d.ts +79 -0
- package/dist/esm/lib/stream/transport/fetch/index.d.ts.map +1 -0
- package/dist/esm/lib/stream/transport/fetch/index.js +376 -0
- package/dist/esm/lib/stream/transport/fetch/index.js.map +1 -0
- package/dist/esm/lib/stream/transport/fetch/shared.d.ts +7 -0
- package/dist/esm/lib/stream/transport/fetch/shared.d.ts.map +1 -0
- package/dist/esm/lib/stream/transport/fetch/shared.js +166 -0
- package/dist/esm/lib/stream/transport/fetch/shared.js.map +1 -0
- package/dist/esm/lib/stream/transport/s2s/framing.d.ts +47 -0
- package/dist/esm/lib/stream/transport/s2s/framing.d.ts.map +1 -0
- package/dist/esm/lib/stream/transport/s2s/framing.js +118 -0
- package/dist/esm/lib/stream/transport/s2s/framing.js.map +1 -0
- package/dist/esm/lib/stream/transport/s2s/index.d.ts +23 -0
- package/dist/esm/lib/stream/transport/s2s/index.d.ts.map +1 -0
- package/dist/esm/lib/stream/transport/s2s/index.js +781 -0
- package/dist/esm/lib/stream/transport/s2s/index.js.map +1 -0
- package/dist/esm/lib/stream/types.d.ts +53 -0
- package/dist/esm/lib/stream/types.d.ts.map +1 -0
- package/dist/esm/lib/stream/types.js +2 -0
- package/dist/esm/lib/stream/types.js.map +1 -0
- package/dist/esm/stream.d.ts +22 -116
- package/dist/esm/stream.d.ts.map +1 -1
- package/dist/esm/stream.js +36 -551
- package/dist/esm/stream.js.map +1 -1
- package/dist/esm/utils.d.ts +32 -6
- package/dist/esm/utils.d.ts.map +1 -1
- package/dist/esm/utils.js +126 -34
- package/dist/esm/utils.js.map +1 -1
- package/package.json +2 -2
- package/dist/cjs/generated/proto/s2/v1/s2.d.ts.map +0 -1
- package/dist/cjs/generated/proto/s2/v1/s2.js.map +0 -1
- package/dist/esm/generated/proto/s2/v1/s2.d.ts.map +0 -1
- package/dist/esm/generated/proto/s2/v1/s2.js.map +0 -1
- /package/dist/cjs/generated/proto/{s2/v1/s2.d.ts → s2.d.ts} +0 -0
- /package/dist/cjs/generated/proto/{s2/v1/s2.js → s2.js} +0 -0
- /package/dist/esm/generated/proto/{s2/v1/s2.d.ts → s2.d.ts} +0 -0
- /package/dist/esm/generated/proto/{s2/v1/s2.js → s2.js} +0 -0
package/dist/esm/stream.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { S2Error } from "./error.js";
|
|
2
|
+
import { checkTail } from "./generated/index.js";
|
|
3
|
+
import { createSessionTransport } from "./lib/stream/factory.js";
|
|
4
|
+
import { streamAppend, streamRead, } from "./lib/stream/transport/fetch/shared.js";
|
|
5
5
|
export class S2Stream {
|
|
6
6
|
client;
|
|
7
|
+
transportConfig;
|
|
8
|
+
_transport;
|
|
7
9
|
name;
|
|
8
|
-
constructor(name, client) {
|
|
10
|
+
constructor(name, client, transportConfig) {
|
|
9
11
|
this.name = name;
|
|
10
12
|
this.client = client;
|
|
13
|
+
this.transportConfig = transportConfig;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Get or create the transport instance
|
|
17
|
+
*/
|
|
18
|
+
async getTransport() {
|
|
19
|
+
if (!this._transport) {
|
|
20
|
+
this._transport = await createSessionTransport(this.transportConfig);
|
|
21
|
+
}
|
|
22
|
+
return this._transport;
|
|
11
23
|
}
|
|
12
24
|
/**
|
|
13
25
|
* Check the tail of the stream.
|
|
@@ -40,138 +52,24 @@ export class S2Stream {
|
|
|
40
52
|
* - Use `readSession` for streaming reads
|
|
41
53
|
*/
|
|
42
54
|
async read(args, options) {
|
|
43
|
-
|
|
44
|
-
const response = await read({
|
|
45
|
-
client: this.client,
|
|
46
|
-
path: {
|
|
47
|
-
stream: this.name,
|
|
48
|
-
},
|
|
49
|
-
headers: {
|
|
50
|
-
...(as === "bytes" ? { "s2-format": "base64" } : {}),
|
|
51
|
-
},
|
|
52
|
-
query: queryParams,
|
|
53
|
-
...options,
|
|
54
|
-
});
|
|
55
|
-
if (response.error) {
|
|
56
|
-
if ("message" in response.error) {
|
|
57
|
-
throw new S2Error({
|
|
58
|
-
message: response.error.message,
|
|
59
|
-
code: response.error.code ?? undefined,
|
|
60
|
-
status: response.response.status,
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
// special case for 416 - Range Not Satisfiable
|
|
65
|
-
throw new RangeNotSatisfiableError({
|
|
66
|
-
status: response.response.status,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (args?.as === "bytes") {
|
|
71
|
-
const res = {
|
|
72
|
-
...response.data,
|
|
73
|
-
records: response.data.records?.map((record) => ({
|
|
74
|
-
...record,
|
|
75
|
-
body: record.body ? decodeFromBase64(record.body) : undefined,
|
|
76
|
-
headers: record.headers?.map((header) => header.map((h) => decodeFromBase64(h))),
|
|
77
|
-
})),
|
|
78
|
-
};
|
|
79
|
-
return res;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
const res = response.data;
|
|
83
|
-
return res;
|
|
84
|
-
}
|
|
55
|
+
return await streamRead(this.name, this.client, args, options);
|
|
85
56
|
}
|
|
86
57
|
/**
|
|
87
58
|
* Append one or more records to the stream.
|
|
88
59
|
*
|
|
89
|
-
* - Automatically base64-encodes when
|
|
60
|
+
* - Automatically base64-encodes when format is "bytes".
|
|
90
61
|
* - Supports conditional appends via `fencing_token` and `match_seq_num`.
|
|
91
62
|
* - Returns the acknowledged range and the stream tail after the append.
|
|
63
|
+
*
|
|
64
|
+
* All records in a single append call must use the same format (either all string or all bytes).
|
|
65
|
+
* For high-throughput sequential appends, use `appendSession()` instead.
|
|
66
|
+
*
|
|
67
|
+
* @param records The record(s) to append
|
|
68
|
+
* @param args Optional append arguments (fencing_token, match_seq_num)
|
|
69
|
+
* @param options Optional request options
|
|
92
70
|
*/
|
|
93
71
|
async append(records, args, options) {
|
|
94
|
-
|
|
95
|
-
const normalizeHeaders = (headers) => {
|
|
96
|
-
if (headers === undefined) {
|
|
97
|
-
return undefined;
|
|
98
|
-
}
|
|
99
|
-
else if (Array.isArray(headers)) {
|
|
100
|
-
return headers;
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
return Object.entries(headers).map(([key, value]) => [key, value]);
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
const recordsWithNormalizedHeaders = recordsArray.map((record) => ({
|
|
107
|
-
...record,
|
|
108
|
-
headers: normalizeHeaders(record.headers),
|
|
109
|
-
}));
|
|
110
|
-
const hasBytes = recordsWithNormalizedHeaders.some((record) => record.body instanceof Uint8Array) ||
|
|
111
|
-
recordsWithNormalizedHeaders.some((record) => record.headers?.some((header) => header[0] instanceof Uint8Array || header[1] instanceof Uint8Array));
|
|
112
|
-
const encodedRecords = recordsWithNormalizedHeaders.map((record) => ({
|
|
113
|
-
...record,
|
|
114
|
-
body: record.body instanceof Uint8Array
|
|
115
|
-
? encodeToBase64(record.body)
|
|
116
|
-
: hasBytes && record.body
|
|
117
|
-
? encodeToBase64(new TextEncoder().encode(record.body))
|
|
118
|
-
: record.body,
|
|
119
|
-
headers: record.headers?.map((header) => header.map((h) => h instanceof Uint8Array
|
|
120
|
-
? encodeToBase64(h)
|
|
121
|
-
: hasBytes
|
|
122
|
-
? encodeToBase64(new TextEncoder().encode(h))
|
|
123
|
-
: h)),
|
|
124
|
-
}));
|
|
125
|
-
const response = await append({
|
|
126
|
-
client: this.client,
|
|
127
|
-
path: {
|
|
128
|
-
stream: this.name,
|
|
129
|
-
},
|
|
130
|
-
body: {
|
|
131
|
-
...args,
|
|
132
|
-
records: encodedRecords,
|
|
133
|
-
},
|
|
134
|
-
headers: {
|
|
135
|
-
...(hasBytes ? { "s2-format": "base64" } : {}),
|
|
136
|
-
},
|
|
137
|
-
...options,
|
|
138
|
-
});
|
|
139
|
-
if (response.error) {
|
|
140
|
-
if ("message" in response.error) {
|
|
141
|
-
throw new S2Error({
|
|
142
|
-
message: response.error.message,
|
|
143
|
-
code: response.error.code ?? undefined,
|
|
144
|
-
status: response.response.status,
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
else {
|
|
148
|
-
// special case for 412 - append condition failed
|
|
149
|
-
if ("seq_num_mismatch" in response.error) {
|
|
150
|
-
throw new SeqNumMismatchError({
|
|
151
|
-
message: "Append condition failed: sequence number mismatch",
|
|
152
|
-
code: "APPEND_CONDITION_FAILED",
|
|
153
|
-
status: response.response.status,
|
|
154
|
-
expectedSeqNum: response.error.seq_num_mismatch,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
else if ("fencing_token_mismatch" in response.error) {
|
|
158
|
-
throw new FencingTokenMismatchError({
|
|
159
|
-
message: "Append condition failed: fencing token mismatch",
|
|
160
|
-
code: "APPEND_CONDITION_FAILED",
|
|
161
|
-
status: response.response.status,
|
|
162
|
-
expectedFencingToken: response.error.fencing_token_mismatch,
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
// fallback for unknown 412 error format
|
|
167
|
-
throw new S2Error({
|
|
168
|
-
message: "Append condition failed",
|
|
169
|
-
status: response.response.status,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return response.data;
|
|
72
|
+
return await streamAppend(this.name, this.client, records, args, options);
|
|
175
73
|
}
|
|
176
74
|
/**
|
|
177
75
|
* Open a streaming read session
|
|
@@ -180,433 +78,20 @@ export class S2Stream {
|
|
|
180
78
|
* When `as: "bytes"` is provided, bodies and headers are decoded to `Uint8Array`.
|
|
181
79
|
*/
|
|
182
80
|
async readSession(args, options) {
|
|
183
|
-
|
|
81
|
+
const transport = await this.getTransport();
|
|
82
|
+
return await transport.makeReadSession(this.name, args, options);
|
|
184
83
|
}
|
|
185
84
|
/**
|
|
186
|
-
* Create an append session that
|
|
85
|
+
* Create an append session that guarantees ordering of submissions.
|
|
187
86
|
*
|
|
188
87
|
* Use this to coordinate high-throughput, sequential appends with backpressure.
|
|
88
|
+
* Records can be either string or bytes format - the format is specified in each record.
|
|
89
|
+
*
|
|
90
|
+
* @param options Optional request options
|
|
189
91
|
*/
|
|
190
|
-
async appendSession(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
export class ReadSession extends EventStream {
|
|
195
|
-
static async create(client, name, args, options) {
|
|
196
|
-
const { as, ...queryParams } = args ?? {};
|
|
197
|
-
const response = await read({
|
|
198
|
-
client,
|
|
199
|
-
path: {
|
|
200
|
-
stream: name,
|
|
201
|
-
},
|
|
202
|
-
headers: {
|
|
203
|
-
accept: "text/event-stream",
|
|
204
|
-
...(as === "bytes" ? { "s2-format": "base64" } : {}),
|
|
205
|
-
},
|
|
206
|
-
query: queryParams,
|
|
207
|
-
parseAs: "stream",
|
|
208
|
-
...options,
|
|
209
|
-
});
|
|
210
|
-
if (response.error) {
|
|
211
|
-
if ("message" in response.error) {
|
|
212
|
-
throw new S2Error({
|
|
213
|
-
message: response.error.message,
|
|
214
|
-
code: response.error.code ?? undefined,
|
|
215
|
-
status: response.response.status,
|
|
216
|
-
});
|
|
217
|
-
}
|
|
218
|
-
else {
|
|
219
|
-
// special case for 416 - Range Not Satisfiable
|
|
220
|
-
throw new RangeNotSatisfiableError({
|
|
221
|
-
status: response.response.status,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
if (!response.response.body) {
|
|
226
|
-
throw new S2Error({
|
|
227
|
-
message: "No body in SSE response",
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
return new ReadSession(response.response.body, args?.as ?? "string");
|
|
231
|
-
}
|
|
232
|
-
_streamPosition = undefined;
|
|
233
|
-
constructor(stream, format) {
|
|
234
|
-
super(stream, (msg) => {
|
|
235
|
-
// Parse SSE events according to the S2 protocol
|
|
236
|
-
if (msg.event === "batch" && msg.data) {
|
|
237
|
-
const batch = JSON.parse(msg.data);
|
|
238
|
-
// If format is bytes, decode base64 to Uint8Array
|
|
239
|
-
if (format === "bytes") {
|
|
240
|
-
for (const record of batch.records ?? []) {
|
|
241
|
-
if (record.body && typeof record.body === "string") {
|
|
242
|
-
record.body = decodeFromBase64(record.body);
|
|
243
|
-
}
|
|
244
|
-
if (record.headers) {
|
|
245
|
-
record.headers = record.headers.map((header) => header.map((h) => typeof h === "string" ? decodeFromBase64(h) : h));
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
if (batch.tail) {
|
|
250
|
-
this._streamPosition = batch.tail;
|
|
251
|
-
}
|
|
252
|
-
return { done: false, batch: true, value: batch.records ?? [] };
|
|
253
|
-
}
|
|
254
|
-
if (msg.event === "error") {
|
|
255
|
-
// Handle error events
|
|
256
|
-
throw new S2Error({ message: msg.data ?? "Unknown error" });
|
|
257
|
-
}
|
|
258
|
-
// Skip ping events and other events
|
|
259
|
-
return { done: false };
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
get streamPosition() {
|
|
263
|
-
return this._streamPosition;
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
class AcksStream extends ReadableStream {
|
|
267
|
-
constructor(setController) {
|
|
268
|
-
super({
|
|
269
|
-
start: (controller) => {
|
|
270
|
-
setController(controller);
|
|
271
|
-
},
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
async [Symbol.asyncDispose]() {
|
|
275
|
-
await this.cancel("disposed");
|
|
276
|
-
}
|
|
277
|
-
// Polyfill for older browsers
|
|
278
|
-
[Symbol.asyncIterator]() {
|
|
279
|
-
const fn = ReadableStream.prototype[Symbol.asyncIterator];
|
|
280
|
-
if (typeof fn === "function")
|
|
281
|
-
return fn.call(this);
|
|
282
|
-
const reader = this.getReader();
|
|
283
|
-
return {
|
|
284
|
-
next: async () => {
|
|
285
|
-
const r = await reader.read();
|
|
286
|
-
if (r.done) {
|
|
287
|
-
reader.releaseLock();
|
|
288
|
-
return { done: true, value: undefined };
|
|
289
|
-
}
|
|
290
|
-
return { done: false, value: r.value };
|
|
291
|
-
},
|
|
292
|
-
throw: async (e) => {
|
|
293
|
-
await reader.cancel(e);
|
|
294
|
-
reader.releaseLock();
|
|
295
|
-
return { done: true, value: undefined };
|
|
296
|
-
},
|
|
297
|
-
return: async () => {
|
|
298
|
-
await reader.cancel("done");
|
|
299
|
-
reader.releaseLock();
|
|
300
|
-
return { done: true, value: undefined };
|
|
301
|
-
},
|
|
302
|
-
[Symbol.asyncIterator]() {
|
|
303
|
-
return this;
|
|
304
|
-
},
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* Batches individual records and submits them to an AppendSession.
|
|
310
|
-
* Handles linger duration, batch size limits, and auto-incrementing match_seq_num.
|
|
311
|
-
*/
|
|
312
|
-
class Batcher extends WritableStream {
|
|
313
|
-
session;
|
|
314
|
-
currentBatch = [];
|
|
315
|
-
currentBatchResolvers = [];
|
|
316
|
-
lingerTimer = null;
|
|
317
|
-
closed = false;
|
|
318
|
-
maxBatchSize;
|
|
319
|
-
lingerDuration;
|
|
320
|
-
fencing_token;
|
|
321
|
-
next_match_seq_num;
|
|
322
|
-
constructor(session, args) {
|
|
323
|
-
let writableController;
|
|
324
|
-
super({
|
|
325
|
-
start: (controller) => {
|
|
326
|
-
writableController = controller;
|
|
327
|
-
},
|
|
328
|
-
write: (chunk) => {
|
|
329
|
-
const records = Array.isArray(chunk) ? chunk : [chunk];
|
|
330
|
-
this.submit(records);
|
|
331
|
-
},
|
|
332
|
-
close: () => {
|
|
333
|
-
this.closed = true;
|
|
334
|
-
this.flush();
|
|
335
|
-
this.cleanup();
|
|
336
|
-
},
|
|
337
|
-
abort: (reason) => {
|
|
338
|
-
this.closed = true;
|
|
339
|
-
// Reject all pending promises in the current batch
|
|
340
|
-
const error = new S2Error({
|
|
341
|
-
message: `Batcher was aborted: ${reason}`,
|
|
342
|
-
});
|
|
343
|
-
for (const resolver of this.currentBatchResolvers) {
|
|
344
|
-
resolver.reject(error);
|
|
345
|
-
}
|
|
346
|
-
this.currentBatch = [];
|
|
347
|
-
this.currentBatchResolvers = [];
|
|
348
|
-
this.cleanup();
|
|
349
|
-
},
|
|
350
|
-
});
|
|
351
|
-
this.session = session;
|
|
352
|
-
this.maxBatchSize = args?.maxBatchSize ?? 1000;
|
|
353
|
-
this.lingerDuration = args?.lingerDuration ?? 5;
|
|
354
|
-
this.fencing_token = args?.fencing_token;
|
|
355
|
-
this.next_match_seq_num = args?.match_seq_num;
|
|
356
|
-
}
|
|
357
|
-
async [Symbol.asyncDispose]() {
|
|
358
|
-
await this.close();
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Submit one or more records to be batched.
|
|
362
|
-
* For array submits, the entire array is treated as an atomic unit and will never be split across batches.
|
|
363
|
-
* If it doesn't fit in the current batch, the current batch is flushed and the array is queued in the next batch.
|
|
364
|
-
* Returns a promise that resolves when the batch containing these records is acknowledged.
|
|
365
|
-
*/
|
|
366
|
-
submit(records) {
|
|
367
|
-
if (this.closed) {
|
|
368
|
-
return Promise.reject(new S2Error({ message: "Batcher is closed" }));
|
|
369
|
-
}
|
|
370
|
-
return new Promise((resolve, reject) => {
|
|
371
|
-
const recordsArray = Array.isArray(records) ? records : [records];
|
|
372
|
-
const isArraySubmit = Array.isArray(records) && records.length > 1;
|
|
373
|
-
// Start linger timer on first record added to an empty batch
|
|
374
|
-
if (this.currentBatch.length === 0 && this.lingerDuration > 0) {
|
|
375
|
-
this.startLingerTimer();
|
|
376
|
-
}
|
|
377
|
-
if (isArraySubmit) {
|
|
378
|
-
// Treat the entire array as atomic: if it doesn't fit, flush current batch first
|
|
379
|
-
if (this.currentBatch.length > 0 &&
|
|
380
|
-
this.currentBatch.length + recordsArray.length > this.maxBatchSize) {
|
|
381
|
-
this.flush();
|
|
382
|
-
// After flush, if linger is enabled, restart the timer for the new batch
|
|
383
|
-
if (this.lingerDuration > 0) {
|
|
384
|
-
this.startLingerTimer();
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
// Add the entire array (even if it exceeds maxBatchSize) as a single batch unit
|
|
388
|
-
this.currentBatch.push(...recordsArray);
|
|
389
|
-
this.currentBatchResolvers.push({ resolve, reject });
|
|
390
|
-
// Do not auto-flush here; allow linger timer or explicit flush to send the batch
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
// Single record submit — normal behavior
|
|
394
|
-
if (this.currentBatch.length >= this.maxBatchSize) {
|
|
395
|
-
this.flush();
|
|
396
|
-
if (this.lingerDuration > 0) {
|
|
397
|
-
this.startLingerTimer();
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
this.currentBatch.push(recordsArray[0]);
|
|
401
|
-
this.currentBatchResolvers.push({ resolve, reject });
|
|
402
|
-
if (this.currentBatch.length >= this.maxBatchSize) {
|
|
403
|
-
this.flush();
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
}
|
|
408
|
-
/**
|
|
409
|
-
* Flush the current batch to the session.
|
|
410
|
-
*/
|
|
411
|
-
flush() {
|
|
412
|
-
this.cancelLingerTimer();
|
|
413
|
-
if (this.currentBatch.length === 0) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
const args = {
|
|
417
|
-
records: this.currentBatch,
|
|
418
|
-
fencing_token: this.fencing_token,
|
|
419
|
-
match_seq_num: this.next_match_seq_num,
|
|
420
|
-
};
|
|
421
|
-
// Auto-increment match_seq_num for next batch
|
|
422
|
-
if (this.next_match_seq_num !== undefined) {
|
|
423
|
-
this.next_match_seq_num += this.currentBatch.length;
|
|
424
|
-
}
|
|
425
|
-
// Capture resolvers for this batch
|
|
426
|
-
const batchResolvers = this.currentBatchResolvers;
|
|
427
|
-
this.currentBatchResolvers = [];
|
|
428
|
-
this.currentBatch = [];
|
|
429
|
-
// Submit to session and handle promise
|
|
430
|
-
const promise = this.session.submit(args.records, {
|
|
431
|
-
fencing_token: args.fencing_token,
|
|
432
|
-
match_seq_num: args.match_seq_num,
|
|
433
|
-
});
|
|
434
|
-
// Resolve/reject all resolvers for this batch when the ack comes back
|
|
435
|
-
promise.then((ack) => {
|
|
436
|
-
for (const resolver of batchResolvers) {
|
|
437
|
-
resolver.resolve(ack);
|
|
438
|
-
}
|
|
439
|
-
}, (error) => {
|
|
440
|
-
for (const resolver of batchResolvers) {
|
|
441
|
-
resolver.reject(error);
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
startLingerTimer() {
|
|
446
|
-
this.cancelLingerTimer();
|
|
447
|
-
this.lingerTimer = setTimeout(() => {
|
|
448
|
-
this.lingerTimer = null;
|
|
449
|
-
if (!this.closed && this.currentBatch.length > 0) {
|
|
450
|
-
this.flush();
|
|
451
|
-
}
|
|
452
|
-
}, this.lingerDuration);
|
|
453
|
-
}
|
|
454
|
-
cancelLingerTimer() {
|
|
455
|
-
if (this.lingerTimer) {
|
|
456
|
-
clearTimeout(this.lingerTimer);
|
|
457
|
-
this.lingerTimer = null;
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
cleanup() {
|
|
461
|
-
this.cancelLingerTimer();
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
/**
|
|
465
|
-
* Session for appending records to a stream.
|
|
466
|
-
* Queues append requests and ensures only one is in-flight at a time.
|
|
467
|
-
*/
|
|
468
|
-
class AppendSession extends WritableStream {
|
|
469
|
-
_lastSeenPosition = undefined;
|
|
470
|
-
queue = [];
|
|
471
|
-
pendingResolvers = [];
|
|
472
|
-
inFlight = false;
|
|
473
|
-
options;
|
|
474
|
-
stream;
|
|
475
|
-
acksController;
|
|
476
|
-
_acksStream;
|
|
477
|
-
closed = false;
|
|
478
|
-
processingPromise = null;
|
|
479
|
-
static async create(stream, options) {
|
|
480
|
-
return new AppendSession(stream, options);
|
|
481
|
-
}
|
|
482
|
-
constructor(stream, options) {
|
|
483
|
-
let writableController;
|
|
484
|
-
super({
|
|
485
|
-
start: (controller) => {
|
|
486
|
-
writableController = controller;
|
|
487
|
-
},
|
|
488
|
-
write: (chunk) => {
|
|
489
|
-
this.submit(chunk.records, {
|
|
490
|
-
fencing_token: chunk.fencing_token,
|
|
491
|
-
match_seq_num: chunk.match_seq_num,
|
|
492
|
-
});
|
|
493
|
-
},
|
|
494
|
-
close: async () => {
|
|
495
|
-
this.closed = true;
|
|
496
|
-
await this.waitForDrain();
|
|
497
|
-
},
|
|
498
|
-
abort: async (reason) => {
|
|
499
|
-
this.closed = true;
|
|
500
|
-
this.queue = [];
|
|
501
|
-
// Reject all pending promises
|
|
502
|
-
const error = new S2Error({
|
|
503
|
-
message: `AppendSession was aborted: ${reason}`,
|
|
504
|
-
});
|
|
505
|
-
for (const resolver of this.pendingResolvers) {
|
|
506
|
-
resolver.reject(error);
|
|
507
|
-
}
|
|
508
|
-
this.pendingResolvers = [];
|
|
509
|
-
},
|
|
510
|
-
});
|
|
511
|
-
this.options = options;
|
|
512
|
-
this.stream = stream;
|
|
513
|
-
}
|
|
514
|
-
async [Symbol.asyncDispose]() {
|
|
515
|
-
await this.close();
|
|
516
|
-
}
|
|
517
|
-
/**
|
|
518
|
-
* Create a batcher that batches individual records and submits them to this session.
|
|
519
|
-
*/
|
|
520
|
-
makeBatcher(args) {
|
|
521
|
-
return new Batcher(this, args);
|
|
522
|
-
}
|
|
523
|
-
/**
|
|
524
|
-
* Get a stream of acknowledgements for appends.
|
|
525
|
-
*/
|
|
526
|
-
acks() {
|
|
527
|
-
if (!this._acksStream) {
|
|
528
|
-
this._acksStream = new AcksStream((controller) => {
|
|
529
|
-
this.acksController = controller;
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
return this._acksStream;
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* Submit an append request to the session.
|
|
536
|
-
* The request will be queued and sent when no other request is in-flight.
|
|
537
|
-
* Returns a promise that resolves when the append is acknowledged or rejects on error.
|
|
538
|
-
*/
|
|
539
|
-
submit(records, args) {
|
|
540
|
-
if (this.closed) {
|
|
541
|
-
return Promise.reject(new S2Error({ message: "AppendSession is closed" }));
|
|
542
|
-
}
|
|
543
|
-
return new Promise((resolve, reject) => {
|
|
544
|
-
this.queue.push({
|
|
545
|
-
records: Array.isArray(records) ? records : [records],
|
|
546
|
-
...args,
|
|
547
|
-
});
|
|
548
|
-
this.pendingResolvers.push({ resolve, reject });
|
|
549
|
-
// Start processing if not already running
|
|
550
|
-
if (!this.processingPromise) {
|
|
551
|
-
this.processingPromise = this.processLoop();
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
/**
|
|
556
|
-
* Main processing loop that sends queued requests one at a time.
|
|
557
|
-
*/
|
|
558
|
-
async processLoop() {
|
|
559
|
-
while (this.queue.length > 0) {
|
|
560
|
-
this.inFlight = true;
|
|
561
|
-
const args = this.queue.shift();
|
|
562
|
-
const resolver = this.pendingResolvers.shift();
|
|
563
|
-
try {
|
|
564
|
-
const ack = await this.stream.append(args.records, {
|
|
565
|
-
fencing_token: args.fencing_token,
|
|
566
|
-
match_seq_num: args.match_seq_num,
|
|
567
|
-
}, this.options);
|
|
568
|
-
this._lastSeenPosition = ack;
|
|
569
|
-
// Emit ack to the acks stream if it exists
|
|
570
|
-
if (this.acksController) {
|
|
571
|
-
this.acksController.enqueue(ack);
|
|
572
|
-
}
|
|
573
|
-
// Resolve the promise for this request
|
|
574
|
-
resolver.resolve(ack);
|
|
575
|
-
}
|
|
576
|
-
catch (error) {
|
|
577
|
-
this.inFlight = false;
|
|
578
|
-
this.processingPromise = null;
|
|
579
|
-
// Reject the promise for this request
|
|
580
|
-
resolver.reject(error);
|
|
581
|
-
// Reject all remaining pending promises
|
|
582
|
-
for (const pendingResolver of this.pendingResolvers) {
|
|
583
|
-
pendingResolver.reject(error);
|
|
584
|
-
}
|
|
585
|
-
this.pendingResolvers = [];
|
|
586
|
-
// Clear the queue
|
|
587
|
-
this.queue = [];
|
|
588
|
-
// Do not rethrow here to avoid unhandled rejection; callers already received rejection
|
|
589
|
-
}
|
|
590
|
-
this.inFlight = false;
|
|
591
|
-
}
|
|
592
|
-
this.processingPromise = null;
|
|
593
|
-
}
|
|
594
|
-
async waitForDrain() {
|
|
595
|
-
// Wait for processing to complete
|
|
596
|
-
if (this.processingPromise) {
|
|
597
|
-
await this.processingPromise;
|
|
598
|
-
}
|
|
599
|
-
// Wait until queue is empty and nothing is in flight
|
|
600
|
-
while (this.queue.length > 0 || this.inFlight) {
|
|
601
|
-
await new Promise((resolve) => setTimeout(resolve, 10));
|
|
602
|
-
}
|
|
603
|
-
// Close the acks stream if it exists
|
|
604
|
-
if (this.acksController) {
|
|
605
|
-
this.acksController.close();
|
|
606
|
-
}
|
|
607
|
-
}
|
|
608
|
-
get lastSeenPosition() {
|
|
609
|
-
return this._lastSeenPosition;
|
|
92
|
+
async appendSession(sessionOptions, requestOptions) {
|
|
93
|
+
const transport = await this.getTransport();
|
|
94
|
+
return await transport.makeAppendSession(this.name, sessionOptions, requestOptions);
|
|
610
95
|
}
|
|
611
96
|
}
|
|
612
97
|
//# sourceMappingURL=stream.js.map
|
package/dist/esm/stream.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/stream.ts"],"names":[],"mappings":"AACA,OAAO,EACN,yBAAyB,EACzB,wBAAwB,EACxB,OAAO,EACP,mBAAmB,GACnB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAEN,MAAM,EACN,SAAS,EAMT,IAAI,GAEJ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,MAAM,OAAO,QAAQ;IACH,MAAM,CAAS;IAEhB,IAAI,CAAS;IAE7B,YAAY,IAAY,EAAE,MAAc;QACvC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;;;OAIG;IAC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