camusdb 0.2.0 → 0.3.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/README.md +65 -4
- package/dist/auth/rest-login-client.d.ts.map +1 -1
- package/dist/auth/rest-login-client.js +15 -1
- package/dist/auth/rest-login-client.js.map +1 -1
- package/dist/auth/token-provider.d.ts +14 -0
- package/dist/auth/token-provider.d.ts.map +1 -1
- package/dist/auth/token-provider.js +39 -11
- package/dist/auth/token-provider.js.map +1 -1
- package/dist/client.d.ts +24 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +78 -8
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +20 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +42 -8
- package/dist/json.js.map +1 -1
- package/dist/own-record.d.ts +16 -0
- package/dist/own-record.d.ts.map +1 -0
- package/dist/own-record.js +18 -0
- package/dist/own-record.js.map +1 -0
- package/dist/query-stream.d.ts +4 -4
- package/dist/query-stream.js +4 -4
- package/dist/result-set.d.ts +4 -2
- package/dist/result-set.d.ts.map +1 -1
- package/dist/result-set.js +25 -8
- package/dist/result-set.js.map +1 -1
- package/dist/retry.d.ts +4 -1
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +16 -4
- package/dist/retry.js.map +1 -1
- package/dist/runtime.js +2 -0
- package/dist/runtime.js.map +1 -1
- package/dist/sequence.d.ts +62 -0
- package/dist/sequence.d.ts.map +1 -0
- package/dist/sequence.js +70 -0
- package/dist/sequence.js.map +1 -0
- package/dist/sql-syntax.d.ts +21 -1
- package/dist/sql-syntax.d.ts.map +1 -1
- package/dist/sql-syntax.js +30 -1
- package/dist/sql-syntax.js.map +1 -1
- package/dist/statements.d.ts.map +1 -1
- package/dist/statements.js +5 -0
- package/dist/statements.js.map +1 -1
- package/dist/transport/grpc/batch-frames.d.ts +67 -0
- package/dist/transport/grpc/batch-frames.d.ts.map +1 -0
- package/dist/transport/grpc/batch-frames.js +111 -0
- package/dist/transport/grpc/batch-frames.js.map +1 -0
- package/dist/transport/grpc/batcher.d.ts +132 -3
- package/dist/transport/grpc/batcher.d.ts.map +1 -1
- package/dist/transport/grpc/batcher.js +389 -30
- package/dist/transport/grpc/batcher.js.map +1 -1
- package/dist/transport/grpc/grpc-transport.d.ts +8 -1
- package/dist/transport/grpc/grpc-transport.d.ts.map +1 -1
- package/dist/transport/grpc/grpc-transport.js +59 -8
- package/dist/transport/grpc/grpc-transport.js.map +1 -1
- package/dist/transport/grpc/messages.d.ts +18 -2
- package/dist/transport/grpc/messages.d.ts.map +1 -1
- package/dist/transport/grpc/messages.js +6 -0
- package/dist/transport/grpc/messages.js.map +1 -1
- package/dist/transport/grpc/proto.d.ts +1 -1
- package/dist/transport/grpc/proto.d.ts.map +1 -1
- package/dist/transport/grpc/proto.js.map +1 -1
- package/dist/transport/http.d.ts.map +1 -1
- package/dist/transport/http.js +5 -1
- package/dist/transport/http.js.map +1 -1
- package/dist/transport/ndjson-row-source.d.ts.map +1 -1
- package/dist/transport/ndjson-row-source.js +16 -3
- package/dist/transport/ndjson-row-source.js.map +1 -1
- package/dist/transport/rest-transport.d.ts.map +1 -1
- package/dist/transport/rest-transport.js +5 -2
- package/dist/transport/rest-transport.js.map +1 -1
- package/dist/transport/transport.d.ts +4 -3
- package/dist/transport/transport.d.ts.map +1 -1
- package/dist/transport/transport.js.map +1 -1
- package/dist/values/encode.d.ts.map +1 -1
- package/dist/values/encode.js +7 -2
- package/dist/values/encode.js.map +1 -1
- package/dist/values/typed.d.ts.map +1 -1
- package/dist/values/typed.js +22 -1
- package/dist/values/typed.js.map +1 -1
- package/dist/values/uuid.d.ts +7 -1
- package/dist/values/uuid.d.ts.map +1 -1
- package/dist/values/uuid.js +15 -6
- package/dist/values/uuid.js.map +1 -1
- package/package.json +1 -1
- package/proto/camus_sql.proto +39 -2
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { CamusError } from '../../errors.js';
|
|
8
8
|
import { CamusErrorCode } from '../../error-codes.js';
|
|
9
9
|
import { sanitizeErrorText } from '../error-text.js';
|
|
10
|
+
import { FRAME_MAX_BYTES, FRAME_MAX_ITEMS, frameCost } from './batch-frames.js';
|
|
10
11
|
import { decodeCacheMetadata, decodeRoutingAdvice, fromWire } from './codec.js';
|
|
11
12
|
import { GrpcBatchStatementKind } from './messages.js';
|
|
12
13
|
export const EMPTY_CAUSAL_TOKEN = Object.freeze({ n: 0, l: 0n, c: 0n });
|
|
@@ -30,27 +31,76 @@ export class PreparedStatementStaleError extends Error {
|
|
|
30
31
|
* share a transaction go to one stream, in arrival order, so the server sees them in the order the
|
|
31
32
|
* caller wrote them; autocommit statements are free to use any stream.
|
|
32
33
|
*
|
|
34
|
+
* Operations that wait together travel together. The pump writes the operations it drained for one
|
|
35
|
+
* stream as a single stream message — a frame — when that stream's server announced that it reads
|
|
36
|
+
* one, and it reads a response frame at any time. A frame never waits: it packs only the
|
|
37
|
+
* operations that already sit in the inbox, and a lone operation stays the plain single message it
|
|
38
|
+
* always was. It is a transport optimization alone. It gives no atomicity and no ordering that the
|
|
39
|
+
* stream does not already give.
|
|
40
|
+
*
|
|
33
41
|
* A stream that faults is rebuilt by the next write, and every operation that was in flight on the
|
|
34
42
|
* old one is failed so its caller can decide whether to replay it. Prepared statements are scoped
|
|
35
43
|
* to the stream that registered them, and a handle from a stream that is gone is refused at the
|
|
36
44
|
* last moment before it would be written.
|
|
45
|
+
*
|
|
46
|
+
* A stream is rotated when the credential it opened under is superseded. A stream presents its
|
|
47
|
+
* bearer token once, in its opening metadata, and then outlives it: the provider renews the token
|
|
48
|
+
* every few minutes, and the stream is meant to last a session. Whether the server tolerates that
|
|
49
|
+
* is the server's decision, and a server that re-checks the opening token per operation ends the
|
|
50
|
+
* stream at that token's expiry, with every transaction on it. The client does not rely on it.
|
|
51
|
+
*
|
|
52
|
+
* When the next unbound operation of a slot finds the credential changed, the slot opens a fresh
|
|
53
|
+
* stream under the new token, and the old one is retired. A retired stream takes no new work. It
|
|
54
|
+
* keeps serving the transactions that began on it, because a transaction cannot change streams,
|
|
55
|
+
* and the server rolls a transaction back when its stream closes. It is closed as soon as the last
|
|
56
|
+
* of them ends, or after `streamDrainTimeoutMs`. Rotation happens on the write path, so an idle
|
|
57
|
+
* client rotates on its first operation after the renewal, before that operation is sent.
|
|
37
58
|
*/
|
|
38
59
|
export class GrpcBatcher {
|
|
39
60
|
options;
|
|
40
61
|
streamFactory;
|
|
62
|
+
/**
|
|
63
|
+
* Reports the credential a stream opened now would carry, which in practice is the current
|
|
64
|
+
* bearer token. It is compared, never inspected: a value that differs from the one a stream
|
|
65
|
+
* opened under is what retires that stream. Undefined means that a stream carries no credential
|
|
66
|
+
* that can change, and that nothing is ever rotated.
|
|
67
|
+
*/
|
|
68
|
+
credentialStamp;
|
|
41
69
|
slots;
|
|
42
70
|
pending = new Map();
|
|
71
|
+
/**
|
|
72
|
+
* The stream each open transaction began on, by handle. An entry is written when a start is
|
|
73
|
+
* answered, and removed when the server answers the commit or the rollback, or when that stream
|
|
74
|
+
* ends. It is what lets a transaction keep its stream across a rotation of its slot.
|
|
75
|
+
*/
|
|
76
|
+
openTransactions = new Map();
|
|
77
|
+
/**
|
|
78
|
+
* Retired streams that still drain, so disposal can reach them: a slot references its current
|
|
79
|
+
* stream alone.
|
|
80
|
+
*/
|
|
81
|
+
retiring = new Set();
|
|
43
82
|
requestIdSeq = 0;
|
|
44
83
|
roundRobin = -1;
|
|
45
84
|
transportIdSeq = 0;
|
|
46
85
|
disposed = false;
|
|
47
|
-
constructor(options, streamFactory) {
|
|
86
|
+
constructor(options, streamFactory, credentialStamp) {
|
|
48
87
|
this.options = options;
|
|
49
88
|
this.streamFactory = streamFactory;
|
|
89
|
+
this.credentialStamp = credentialStamp;
|
|
50
90
|
const poolSize = Math.max(1, options.channelPoolSize);
|
|
51
91
|
this.slots = new Array(poolSize);
|
|
52
92
|
for (let i = 0; i < poolSize; i++) {
|
|
53
|
-
this.slots[i] = {
|
|
93
|
+
this.slots[i] = {
|
|
94
|
+
index: i,
|
|
95
|
+
inbox: [],
|
|
96
|
+
run: [],
|
|
97
|
+
runLease: undefined,
|
|
98
|
+
runBytes: -1,
|
|
99
|
+
pumping: false,
|
|
100
|
+
scheduled: false,
|
|
101
|
+
current: undefined,
|
|
102
|
+
prepared: new Map(),
|
|
103
|
+
};
|
|
54
104
|
}
|
|
55
105
|
}
|
|
56
106
|
/** Reserves a stream for a transaction, so all of its operations land in one ordering chain. */
|
|
@@ -96,7 +146,7 @@ export class GrpcBatcher {
|
|
|
96
146
|
forget(slot, key, existing);
|
|
97
147
|
continue;
|
|
98
148
|
}
|
|
99
|
-
if (entry.transportId === slot.stream
|
|
149
|
+
if (entry.transportId === slot.current?.stream.id)
|
|
100
150
|
return entry;
|
|
101
151
|
// The slot's stream was rebuilt since this was registered, so the handle died with it.
|
|
102
152
|
forget(slot, key, existing);
|
|
@@ -171,8 +221,11 @@ export class GrpcBatcher {
|
|
|
171
221
|
return new Promise((resolve, reject) => {
|
|
172
222
|
const op = {
|
|
173
223
|
requestId,
|
|
224
|
+
kind,
|
|
225
|
+
transaction: handleKey(request.txnHandle),
|
|
174
226
|
settled: false,
|
|
175
227
|
transportId: 0,
|
|
228
|
+
lease: undefined,
|
|
176
229
|
resolve: (value) => resolve({ result: value, transportId: op.transportId }),
|
|
177
230
|
reject,
|
|
178
231
|
};
|
|
@@ -187,6 +240,23 @@ export class GrpcBatcher {
|
|
|
187
240
|
}
|
|
188
241
|
this.pending.set(requestId, op);
|
|
189
242
|
slot.inbox.push({ request: { requestId, kind, request }, op, expectedTransportId });
|
|
243
|
+
this.schedule(slot);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Starts the slot's pump after the current turn, and not inside it.
|
|
248
|
+
*
|
|
249
|
+
* A caller that issues several statements at once — one `Promise.all` over six of them — queues
|
|
250
|
+
* them all in one synchronous turn. A pump that ran inside `enqueue` would write the first
|
|
251
|
+
* before the second was queued, and every operation would then travel alone. One microtask of
|
|
252
|
+
* delay costs no round trip, and it lets the operations that were issued together share a frame.
|
|
253
|
+
*/
|
|
254
|
+
schedule(slot) {
|
|
255
|
+
if (slot.pumping || slot.scheduled)
|
|
256
|
+
return;
|
|
257
|
+
slot.scheduled = true;
|
|
258
|
+
queueMicrotask(() => {
|
|
259
|
+
slot.scheduled = false;
|
|
190
260
|
void this.pump(slot);
|
|
191
261
|
});
|
|
192
262
|
}
|
|
@@ -206,14 +276,16 @@ export class GrpcBatcher {
|
|
|
206
276
|
const item = slot.inbox.shift();
|
|
207
277
|
if (item === undefined)
|
|
208
278
|
break;
|
|
209
|
-
this.
|
|
279
|
+
this.stage(slot, item);
|
|
210
280
|
drained++;
|
|
211
281
|
}
|
|
282
|
+
this.flush(slot);
|
|
212
283
|
// Coalescing: after writing a small burst, pause briefly so more operations accumulate
|
|
213
284
|
// before the next drain writes them together. It applies only after a drain of two or
|
|
214
285
|
// more. A one-item drain is a request-and-reply exchange — one caller, whose next
|
|
215
|
-
// statement cannot arrive until this one is answered — and
|
|
216
|
-
// whole delay to every round trip
|
|
286
|
+
// statement cannot arrive until this one is answered — and a pause there would add the
|
|
287
|
+
// whole delay to every round trip for nothing. Operations that wait together already share
|
|
288
|
+
// a frame without any pause, so the pause only makes the next frame fuller.
|
|
217
289
|
if (drained >= 2 &&
|
|
218
290
|
this.options.coalescingThreshold > 1 &&
|
|
219
291
|
drained < this.options.coalescingThreshold &&
|
|
@@ -224,6 +296,15 @@ export class GrpcBatcher {
|
|
|
224
296
|
return;
|
|
225
297
|
}
|
|
226
298
|
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
// Staging and flushing report their own failures per operation, so this is not expected. An
|
|
301
|
+
// item left in the run would otherwise wait for an answer to a message nothing ever wrote.
|
|
302
|
+
const failure = toError(error);
|
|
303
|
+
for (const item of slot.run.splice(0))
|
|
304
|
+
this.fault(item.op, failure);
|
|
305
|
+
slot.runLease = undefined;
|
|
306
|
+
slot.runBytes = -1;
|
|
307
|
+
}
|
|
227
308
|
finally {
|
|
228
309
|
slot.pumping = false;
|
|
229
310
|
// An item queued while the pump was finishing must not be left waiting for the next caller.
|
|
@@ -231,40 +312,280 @@ export class GrpcBatcher {
|
|
|
231
312
|
void this.pump(slot);
|
|
232
313
|
}
|
|
233
314
|
}
|
|
234
|
-
|
|
315
|
+
/**
|
|
316
|
+
* Prepares one operation for the wire, then either writes it alone or adds it to the slot's run.
|
|
317
|
+
*
|
|
318
|
+
* A run is the set of operations that will share the next stream message. It holds consecutive
|
|
319
|
+
* operations bound for one stream. The operations of one drain can belong to different streams,
|
|
320
|
+
* so an operation for another stream flushes the run first. Operations are never reordered to
|
|
321
|
+
* fill a frame: the server chains the operations of a transaction by arrival order, and inbox
|
|
322
|
+
* order is the only order the callers gave.
|
|
323
|
+
*/
|
|
324
|
+
stage(slot, item) {
|
|
325
|
+
// Cancelled while it sat in the inbox: it holds nothing yet, so it is simply left out.
|
|
326
|
+
if (!this.mustStillBeWritten(item))
|
|
327
|
+
return;
|
|
328
|
+
let lease;
|
|
235
329
|
try {
|
|
236
|
-
|
|
330
|
+
lease = this.route(slot, item.op);
|
|
237
331
|
// A prepared execution names a handle that exists only on the stream that registered it.
|
|
238
332
|
// This is the last moment the two can be compared — check any earlier and the stream could
|
|
239
333
|
// still be rebuilt in between — so refuse here rather than send an operation the server can
|
|
240
334
|
// only answer with "unknown statement".
|
|
241
|
-
if (item.expectedTransportId !== undefined && stream.id !== item.expectedTransportId) {
|
|
335
|
+
if (item.expectedTransportId !== undefined && lease.stream.id !== item.expectedTransportId) {
|
|
242
336
|
throw new PreparedStatementStaleError();
|
|
243
337
|
}
|
|
244
|
-
item.op.transportId = stream.id;
|
|
245
|
-
stream.
|
|
338
|
+
item.op.transportId = lease.stream.id;
|
|
339
|
+
// The hold this operation keeps on its stream, so a retired stream is not closed under it.
|
|
340
|
+
lease.inFlight++;
|
|
341
|
+
item.op.lease = lease;
|
|
246
342
|
}
|
|
247
343
|
catch (error) {
|
|
248
|
-
this.fault(item.op,
|
|
344
|
+
this.fault(item.op, toError(error));
|
|
345
|
+
return;
|
|
249
346
|
}
|
|
347
|
+
// A frame goes only to a server that announced one on this very stream. The announcement is
|
|
348
|
+
// read, never awaited: until it arrives, and for good against a server that makes none, every
|
|
349
|
+
// operation is its own message.
|
|
350
|
+
const framed = this.options.requestFrames && lease.stream.framesAnnounced;
|
|
351
|
+
if (slot.run.length > 0 && (!framed || slot.runLease !== lease))
|
|
352
|
+
this.flush(slot);
|
|
353
|
+
if (!framed) {
|
|
354
|
+
this.send(lease.stream, item.request, item.op);
|
|
355
|
+
return;
|
|
356
|
+
}
|
|
357
|
+
if (slot.run.length === 0) {
|
|
358
|
+
// A lone operation is never measured. It travels as the plain message whatever its size.
|
|
359
|
+
slot.run.push(item);
|
|
360
|
+
slot.runLease = lease;
|
|
361
|
+
slot.runBytes = -1;
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
if (slot.runBytes < 0)
|
|
365
|
+
slot.runBytes = frameCost(slot.run[0].request);
|
|
366
|
+
const cost = frameCost(item.request);
|
|
367
|
+
// Both limits are the sender's duty, and the byte budget most of all. A message over the limit
|
|
368
|
+
// of the transport is refused before the server parses it, which resets the stream that every
|
|
369
|
+
// other operation shares. An operation over the budget ends up alone in its run, and so travels
|
|
370
|
+
// as a single message.
|
|
371
|
+
if (slot.run.length >= FRAME_MAX_ITEMS || slot.runBytes + cost > FRAME_MAX_BYTES) {
|
|
372
|
+
this.flush(slot);
|
|
373
|
+
slot.run.push(item);
|
|
374
|
+
slot.runLease = lease;
|
|
375
|
+
slot.runBytes = cost;
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
slot.run.push(item);
|
|
379
|
+
slot.runBytes += cost;
|
|
250
380
|
}
|
|
251
|
-
|
|
381
|
+
/**
|
|
382
|
+
* Writes the slot's run: one frame, or the plain single message when one operation is left in
|
|
383
|
+
* it, so a quiet stream stays byte-identical to a stream without frames.
|
|
384
|
+
*
|
|
385
|
+
* A frame is never resent. A frame whose write failed may or may not have reached the server,
|
|
386
|
+
* which is true of every operation in it, so every one of them faults with the transport error.
|
|
387
|
+
* The retry contract above the batcher then decides, exactly as it does for the operations of a
|
|
388
|
+
* stream that faulted.
|
|
389
|
+
*/
|
|
390
|
+
flush(slot) {
|
|
391
|
+
const run = slot.run.splice(0);
|
|
392
|
+
const lease = slot.runLease;
|
|
393
|
+
slot.runLease = undefined;
|
|
394
|
+
slot.runBytes = -1;
|
|
395
|
+
if (run.length === 0 || lease === undefined)
|
|
396
|
+
return;
|
|
397
|
+
// Cancelled since it was staged: nothing awaits an answer, so leave it out.
|
|
398
|
+
const items = run.filter((item) => this.mustStillBeWritten(item)).map((item) => item.request);
|
|
399
|
+
if (items.length === 0)
|
|
400
|
+
return;
|
|
401
|
+
try {
|
|
402
|
+
if (items.length === 1) {
|
|
403
|
+
lease.stream.send(items[0]);
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
lease.stream.send({ requestId: 0, kind: GrpcBatchStatementKind.Frame, items });
|
|
407
|
+
}
|
|
408
|
+
catch (error) {
|
|
409
|
+
const failure = toError(error);
|
|
410
|
+
for (const item of run)
|
|
411
|
+
this.fault(item.op, failure);
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
send(stream, request, op) {
|
|
415
|
+
try {
|
|
416
|
+
stream.send(request);
|
|
417
|
+
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
this.fault(op, toError(error));
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* False for an operation whose caller left — it was cancelled, or it timed out — before the
|
|
424
|
+
* operation was written. The server is never asked to run it.
|
|
425
|
+
*
|
|
426
|
+
* A rollback and a close are written whatever happens. Each one only releases what the server
|
|
427
|
+
* holds, which is a transaction's locks or a statement handle, and nothing else would.
|
|
428
|
+
*/
|
|
429
|
+
mustStillBeWritten(item) {
|
|
430
|
+
const kind = item.request.kind;
|
|
431
|
+
return (kind === GrpcBatchStatementKind.Rollback ||
|
|
432
|
+
kind === GrpcBatchStatementKind.Close ||
|
|
433
|
+
this.pending.has(item.op.requestId));
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* The stream one operation belongs on.
|
|
437
|
+
*
|
|
438
|
+
* A transaction stays on the stream it began on, whatever the slot has moved to since. Anything
|
|
439
|
+
* else takes the slot's current stream, and that is where a credential change is noticed.
|
|
440
|
+
*/
|
|
441
|
+
route(slot, op) {
|
|
442
|
+
if (op.transaction !== undefined && op.kind !== GrpcBatchStatementKind.Start) {
|
|
443
|
+
const home = this.openTransactions.get(op.transaction);
|
|
444
|
+
if (home !== undefined)
|
|
445
|
+
return home;
|
|
446
|
+
}
|
|
447
|
+
const current = slot.current;
|
|
448
|
+
if (current === undefined)
|
|
449
|
+
return this.connect(slot);
|
|
450
|
+
// An undefined stamp is "no token right now": one was invalidated and its replacement is not
|
|
451
|
+
// minted yet. That is no reason to trade a working stream for one opened with no credential.
|
|
452
|
+
const stamp = this.credentialStamp?.();
|
|
453
|
+
if (stamp !== undefined && stamp !== current.stamp) {
|
|
454
|
+
this.retire(current);
|
|
455
|
+
return this.connect(slot);
|
|
456
|
+
}
|
|
457
|
+
return current;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Opens a fresh stream for a slot and makes it the current one.
|
|
461
|
+
*
|
|
462
|
+
* The stamp is read before the factory reads the credential itself. If the credential is renewed
|
|
463
|
+
* in between, the stream is stamped older than it is, and it rotates once more than it needs to.
|
|
464
|
+
* Read afterwards, it could be stamped newer than it is, and would never rotate at all.
|
|
465
|
+
*/
|
|
466
|
+
connect(slot) {
|
|
467
|
+
const stamp = this.credentialStamp?.();
|
|
252
468
|
const stream = this.streamFactory(++this.transportIdSeq);
|
|
253
|
-
|
|
469
|
+
const lease = {
|
|
470
|
+
slot,
|
|
471
|
+
stream,
|
|
472
|
+
stamp,
|
|
473
|
+
inFlight: 0,
|
|
474
|
+
openTransactions: 0,
|
|
475
|
+
retired: false,
|
|
476
|
+
closed: false,
|
|
477
|
+
drainTimer: undefined,
|
|
478
|
+
};
|
|
479
|
+
slot.current = lease;
|
|
254
480
|
stream.listen({
|
|
255
481
|
onMessage: (response) => this.demux(response),
|
|
256
|
-
onClose: (error) =>
|
|
257
|
-
// Only clear the slot when this stream is still the current one: a later reconnect must
|
|
258
|
-
// not be undone by an older stream's close event.
|
|
259
|
-
if (slot.stream === stream)
|
|
260
|
-
slot.stream = undefined;
|
|
261
|
-
this.failStreamPending(stream.id, error);
|
|
262
|
-
},
|
|
482
|
+
onClose: (error) => this.close(lease, error),
|
|
263
483
|
});
|
|
264
|
-
return
|
|
484
|
+
return lease;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Takes a stream out of rotation.
|
|
488
|
+
*
|
|
489
|
+
* It stays open for the transactions that began on it, and it closes when the last one ends — or
|
|
490
|
+
* after `streamDrainTimeoutMs`, because a transaction its caller abandoned would otherwise hold
|
|
491
|
+
* the stream, and its locks, open for good. Closing the stream is what makes the server roll
|
|
492
|
+
* such a transaction back.
|
|
493
|
+
*/
|
|
494
|
+
retire(lease) {
|
|
495
|
+
lease.retired = true;
|
|
496
|
+
this.retiring.add(lease);
|
|
497
|
+
this.closeIfDrained(lease);
|
|
498
|
+
if (lease.closed)
|
|
499
|
+
return;
|
|
500
|
+
lease.drainTimer = setTimeout(() => this.close(lease), Math.max(0, this.options.streamDrainTimeoutMs));
|
|
501
|
+
lease.drainTimer.unref?.();
|
|
502
|
+
}
|
|
503
|
+
closeIfDrained(lease) {
|
|
504
|
+
if (lease.retired && lease.inFlight <= 0 && lease.openTransactions <= 0)
|
|
505
|
+
this.close(lease);
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* Closes a stream once, and forgets everything that was riding on it.
|
|
509
|
+
*
|
|
510
|
+
* It runs whichever end closes the stream first: this client, when a retired stream has drained,
|
|
511
|
+
* or the server, through the stream's own close event.
|
|
512
|
+
*/
|
|
513
|
+
close(lease, error) {
|
|
514
|
+
if (lease.closed)
|
|
515
|
+
return;
|
|
516
|
+
lease.closed = true;
|
|
517
|
+
if (lease.drainTimer !== undefined) {
|
|
518
|
+
clearTimeout(lease.drainTimer);
|
|
519
|
+
lease.drainTimer = undefined;
|
|
520
|
+
}
|
|
521
|
+
// Only when it is still the slot's stream: a retired one was replaced long before it ended.
|
|
522
|
+
if (lease.slot.current === lease)
|
|
523
|
+
lease.slot.current = undefined;
|
|
524
|
+
this.retiring.delete(lease);
|
|
525
|
+
// The server rolls back a transaction whose stream closed, so none of these is open any more.
|
|
526
|
+
for (const [handle, home] of this.openTransactions) {
|
|
527
|
+
if (home === lease)
|
|
528
|
+
this.openTransactions.delete(handle);
|
|
529
|
+
}
|
|
530
|
+
try {
|
|
531
|
+
lease.stream.close();
|
|
532
|
+
}
|
|
533
|
+
catch {
|
|
534
|
+
// Best effort: the stream may already be broken.
|
|
535
|
+
}
|
|
536
|
+
this.failStreamPending(lease.stream.id, error ?? streamClosedError());
|
|
537
|
+
}
|
|
538
|
+
/** Drops an operation's hold on its stream, once however many paths race to do it. */
|
|
539
|
+
release(op) {
|
|
540
|
+
const lease = op.lease;
|
|
541
|
+
if (lease === undefined)
|
|
542
|
+
return;
|
|
543
|
+
op.lease = undefined;
|
|
544
|
+
lease.inFlight--;
|
|
545
|
+
if (lease.inFlight <= 0)
|
|
546
|
+
this.closeIfDrained(lease);
|
|
547
|
+
}
|
|
548
|
+
transactionBegan(handle, lease) {
|
|
549
|
+
// A handle is unique, so one is never counted twice.
|
|
550
|
+
if (lease === undefined || this.openTransactions.has(handle))
|
|
551
|
+
return;
|
|
552
|
+
this.openTransactions.set(handle, lease);
|
|
553
|
+
lease.openTransactions++;
|
|
554
|
+
}
|
|
555
|
+
transactionEnded(handle) {
|
|
556
|
+
if (handle === undefined)
|
|
557
|
+
return;
|
|
558
|
+
const lease = this.openTransactions.get(handle);
|
|
559
|
+
if (lease === undefined)
|
|
560
|
+
return;
|
|
561
|
+
this.openTransactions.delete(handle);
|
|
562
|
+
lease.openTransactions--;
|
|
563
|
+
if (lease.openTransactions <= 0)
|
|
564
|
+
this.closeIfDrained(lease);
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* True when a transaction began on a stream that was rotated out, and is finishing there.
|
|
568
|
+
*
|
|
569
|
+
* Such a transaction must not run prepared. A slot keeps one registration per statement, and
|
|
570
|
+
* that registration belongs to the slot's current stream, where this transaction does not write.
|
|
571
|
+
* To register the statement on the retired stream instead would evict the entry every autocommit
|
|
572
|
+
* caller is using, and the two would re-prepare against each other until the old stream closes.
|
|
573
|
+
* To run the statement inline is always correct, and the window is short.
|
|
574
|
+
*/
|
|
575
|
+
isBoundToRetiredStream(txnIdPT, txnIdCounter) {
|
|
576
|
+
return this.openTransactions.get(transactionKey(txnIdPT, txnIdCounter))?.retired === true;
|
|
265
577
|
}
|
|
266
578
|
// ─── Demultiplex ──────────────────────────────────────────────────────────
|
|
267
579
|
demux(response) {
|
|
580
|
+
// A response frame. Each item is handled exactly as if it had arrived alone, in order, so the
|
|
581
|
+
// messages of one request id keep theirs. A frame inside a frame is dropped, never followed.
|
|
582
|
+
if (response.payload === 'frame') {
|
|
583
|
+
for (const item of response.frame?.items ?? []) {
|
|
584
|
+
if (item.payload !== 'frame')
|
|
585
|
+
this.demux(item);
|
|
586
|
+
}
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
268
589
|
const op = this.pending.get(response.requestId);
|
|
269
590
|
// Cancelled, timed out, or already settled. Drop it.
|
|
270
591
|
if (op === undefined)
|
|
@@ -333,13 +654,33 @@ export class GrpcBatcher {
|
|
|
333
654
|
complete(op, result) {
|
|
334
655
|
if (!this.settle(op))
|
|
335
656
|
return;
|
|
657
|
+
// Before the operation lets go of its stream: a start that was just answered is the only thing
|
|
658
|
+
// that holds a retired stream open until its transaction is on the books.
|
|
659
|
+
if (op.kind === GrpcBatchStatementKind.Start) {
|
|
660
|
+
const handle = result;
|
|
661
|
+
if (handle !== undefined)
|
|
662
|
+
this.transactionBegan(handleKey(handle), op.lease);
|
|
663
|
+
}
|
|
664
|
+
else if (this.finalizesTransaction(op)) {
|
|
665
|
+
this.transactionEnded(op.transaction);
|
|
666
|
+
}
|
|
667
|
+
this.release(op);
|
|
336
668
|
op.resolve(result);
|
|
337
669
|
}
|
|
338
670
|
fault(op, error) {
|
|
339
671
|
if (!this.settle(op))
|
|
340
672
|
return;
|
|
673
|
+
// Only an answer from the server ends a transaction. A commit that timed out, or that its
|
|
674
|
+
// caller cancelled, may still be open there, and the rollback that usually follows it must
|
|
675
|
+
// find its stream.
|
|
676
|
+
if (CamusError.is(error) && this.finalizesTransaction(op))
|
|
677
|
+
this.transactionEnded(op.transaction);
|
|
678
|
+
this.release(op);
|
|
341
679
|
op.reject(error);
|
|
342
680
|
}
|
|
681
|
+
finalizesTransaction(op) {
|
|
682
|
+
return op.kind === GrpcBatchStatementKind.Commit || op.kind === GrpcBatchStatementKind.Rollback;
|
|
683
|
+
}
|
|
343
684
|
settle(op) {
|
|
344
685
|
if (op.settled)
|
|
345
686
|
return false;
|
|
@@ -365,23 +706,41 @@ export class GrpcBatcher {
|
|
|
365
706
|
if (this.disposed)
|
|
366
707
|
return;
|
|
367
708
|
this.disposed = true;
|
|
709
|
+
const leases = [...this.retiring];
|
|
368
710
|
for (const slot of this.slots) {
|
|
369
|
-
|
|
370
|
-
|
|
711
|
+
if (slot.current !== undefined)
|
|
712
|
+
leases.push(slot.current);
|
|
713
|
+
slot.current = undefined;
|
|
371
714
|
slot.inbox.length = 0;
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
catch {
|
|
376
|
-
// Best effort: the stream may already be broken.
|
|
377
|
-
}
|
|
715
|
+
slot.run.length = 0;
|
|
716
|
+
slot.runLease = undefined;
|
|
717
|
+
slot.runBytes = -1;
|
|
378
718
|
}
|
|
379
719
|
const closed = new CamusError(CamusErrorCode.Generic, 'This gRPC transport is closed.');
|
|
720
|
+
for (const lease of leases)
|
|
721
|
+
this.close(lease, closed);
|
|
722
|
+
this.retiring.clear();
|
|
723
|
+
this.openTransactions.clear();
|
|
380
724
|
for (const op of [...this.pending.values()])
|
|
381
725
|
this.fault(op, closed);
|
|
382
726
|
await Promise.resolve();
|
|
383
727
|
}
|
|
384
728
|
}
|
|
729
|
+
/** The key one transaction is booked under. A handle is a pair, so both parts are in the key. */
|
|
730
|
+
function transactionKey(txnIdPT, txnIdCounter) {
|
|
731
|
+
return `${txnIdPT}:${txnIdCounter}`;
|
|
732
|
+
}
|
|
733
|
+
function handleKey(handle) {
|
|
734
|
+
return handle === null || handle === undefined
|
|
735
|
+
? undefined
|
|
736
|
+
: transactionKey(handle.txnIdPt, handle.txnIdCounter);
|
|
737
|
+
}
|
|
738
|
+
function streamClosedError() {
|
|
739
|
+
return new CamusError(CamusErrorCode.Generic, 'The gRPC batch stream closed.');
|
|
740
|
+
}
|
|
741
|
+
function toError(error) {
|
|
742
|
+
return error instanceof Error ? error : new Error(String(error));
|
|
743
|
+
}
|
|
385
744
|
function forget(slot, key, expected) {
|
|
386
745
|
if (slot.prepared.get(key) === expected)
|
|
387
746
|
slot.prepared.delete(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batcher.js","sourceRoot":"","sources":["../../../src/transport/grpc/batcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAUhF,OAAO,EAAE,s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,YAAoB;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAChD,KAAK,CAAC,KAAK,EAAE,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -87,6 +87,11 @@ export declare class GrpcTransport implements CamusTransport, CamusLoginClient {
|
|
|
87
87
|
*
|
|
88
88
|
* The batcher rebuilds a faulted stream on its own, so the token is read here, at open time,
|
|
89
89
|
* rather than captured once. A stream re-opened after a token refresh carries the new token.
|
|
90
|
+
*
|
|
91
|
+
* Frames are negotiated per stream. The opening metadata says which contract version this client
|
|
92
|
+
* reads, and the server's response headers say whether it reads one in turn. The announcement is
|
|
93
|
+
* watched off the operation path: every operation is its own message until it arrives, and for
|
|
94
|
+
* good against a server that makes none.
|
|
90
95
|
*/
|
|
91
96
|
private createBatchStream;
|
|
92
97
|
private unary;
|
|
@@ -115,7 +120,9 @@ export declare class GrpcTransport implements CamusTransport, CamusLoginClient {
|
|
|
115
120
|
private buildHandle;
|
|
116
121
|
/**
|
|
117
122
|
* Merges a reply's token, keeping the clock maximum — physical component first, then the logical
|
|
118
|
-
* counter — so the token this session threads advances whatever order replies
|
|
123
|
+
* counter, then the node id — so the token this session threads advances whatever order replies
|
|
124
|
+
* arrive in. The node id is the tie-breaker `buildHandle` documents, so it decides a merge that
|
|
125
|
+
* the first two components leave equal.
|
|
119
126
|
*/
|
|
120
127
|
private observeToken;
|
|
121
128
|
/**
|