camusdb 0.1.1 → 0.2.1
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 +94 -0
- package/dist/client.d.ts +25 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +28 -0
- package/dist/client.js.map +1 -1
- package/dist/column-storage.d.ts +70 -0
- package/dist/column-storage.d.ts.map +1 -0
- package/dist/column-storage.js +79 -0
- package/dist/column-storage.js.map +1 -0
- package/dist/config.d.ts +29 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +15 -0
- package/dist/config.js.map +1 -1
- package/dist/error-codes.d.ts +18 -2
- package/dist/error-codes.d.ts.map +1 -1
- package/dist/error-codes.js +18 -2
- package/dist/error-codes.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/runtime.js +2 -0
- package/dist/runtime.js.map +1 -1
- package/dist/transport/grpc/batch-frames.d.ts +61 -0
- package/dist/transport/grpc/batch-frames.d.ts.map +1 -0
- package/dist/transport/grpc/batch-frames.js +103 -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 +5 -0
- package/dist/transport/grpc/grpc-transport.d.ts.map +1 -1
- package/dist/transport/grpc/grpc-transport.js +47 -5
- 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/package.json +1 -1
- package/proto/camus_sql.proto +39 -2
package/dist/error-codes.d.ts
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* file that was distributed with this source code.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* The server error codes this driver reacts to. Every other `CADBxxxx` code reaches the
|
|
9
|
-
* unchanged on `CamusError.code`.
|
|
8
|
+
* The server error codes this driver reacts to or documents. Every other `CADBxxxx` code reaches the
|
|
9
|
+
* caller unchanged on `CamusError.code`.
|
|
10
10
|
*/
|
|
11
11
|
export declare const CamusErrorCode: {
|
|
12
12
|
/** The driver's own generic code, used when the far end supplied none. */
|
|
@@ -24,6 +24,11 @@ export declare const CamusErrorCode: {
|
|
|
24
24
|
readonly InvalidParameter: "CADB0400";
|
|
25
25
|
/** A byte payload read as a vector has a length that is not a multiple of four. */
|
|
26
26
|
readonly InvalidVector: "CADB0410";
|
|
27
|
+
/**
|
|
28
|
+
* A column storage strategy (`STORAGE PLAIN | MAIN | EXTERNAL | EXTENDED`) was given for a column
|
|
29
|
+
* whose type has no variable-length value. Only `string`, `bytes`, and array columns take one.
|
|
30
|
+
*/
|
|
31
|
+
readonly ColumnStorageNotApplicable: "CADB0414";
|
|
27
32
|
/** The database already exists. Also raised when `IF NOT EXISTS` loses a registration race. */
|
|
28
33
|
readonly DatabaseAlreadyExists: "CADB0012";
|
|
29
34
|
/**
|
|
@@ -48,6 +53,17 @@ export declare const CamusErrorCode: {
|
|
|
48
53
|
readonly PreparedStatementLimitExceeded: "CADB0521";
|
|
49
54
|
/** The statement runs in its own internal transaction and is refused inside an explicit one. */
|
|
50
55
|
readonly StatementNotAllowedInTransaction: "CADB0538";
|
|
56
|
+
/**
|
|
57
|
+
* A stored large value could not be read back. A compressed value failed to decompress, or an
|
|
58
|
+
* out-of-line value was missing or did not match its checksum. The server retries a concurrent
|
|
59
|
+
* update before it raises this code, so the code means damaged data, not a race.
|
|
60
|
+
*/
|
|
61
|
+
readonly LargeValueCorrupt: "CADB0540";
|
|
62
|
+
/**
|
|
63
|
+
* A server defect: a read path decoded a large value that it did not fetch. The server raises it so
|
|
64
|
+
* that no internal pointer reaches a result. Report it.
|
|
65
|
+
*/
|
|
66
|
+
readonly LargeValueNotResolved: "CADB0541";
|
|
51
67
|
};
|
|
52
68
|
export type CamusErrorCode = (typeof CamusErrorCode)[keyof typeof CamusErrorCode];
|
|
53
69
|
//# sourceMappingURL=error-codes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc;IACzB,0EAA0E;;IAG1E;;;;;;;OAOG;;IAGH,wFAAwF;;IAGxF,mFAAmF;;IAGnF,+FAA+F;;IAG/F;;;OAGG;;IAGH;;;OAGG;;IAGH,8FAA8F;;IAG9F,iGAAiG;;IAGjG,0FAA0F;;IAG1F,4FAA4F;;IAG5F,wDAAwD;;IAGxD,gGAAgG;;
|
|
1
|
+
{"version":3,"file":"error-codes.d.ts","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,cAAc;IACzB,0EAA0E;;IAG1E;;;;;;;OAOG;;IAGH,wFAAwF;;IAGxF,mFAAmF;;IAGnF;;;OAGG;;IAGH,+FAA+F;;IAG/F;;;OAGG;;IAGH;;;OAGG;;IAGH,8FAA8F;;IAG9F,iGAAiG;;IAGjG,0FAA0F;;IAG1F,4FAA4F;;IAG5F,wDAAwD;;IAGxD,gGAAgG;;IAGhG;;;;OAIG;;IAGH;;;OAGG;;CAEK,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC"}
|
package/dist/error-codes.js
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* file that was distributed with this source code.
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
8
|
-
* The server error codes this driver reacts to. Every other `CADBxxxx` code reaches the
|
|
9
|
-
* unchanged on `CamusError.code`.
|
|
8
|
+
* The server error codes this driver reacts to or documents. Every other `CADBxxxx` code reaches the
|
|
9
|
+
* caller unchanged on `CamusError.code`.
|
|
10
10
|
*/
|
|
11
11
|
export const CamusErrorCode = {
|
|
12
12
|
/** The driver's own generic code, used when the far end supplied none. */
|
|
@@ -24,6 +24,11 @@ export const CamusErrorCode = {
|
|
|
24
24
|
InvalidParameter: 'CADB0400',
|
|
25
25
|
/** A byte payload read as a vector has a length that is not a multiple of four. */
|
|
26
26
|
InvalidVector: 'CADB0410',
|
|
27
|
+
/**
|
|
28
|
+
* A column storage strategy (`STORAGE PLAIN | MAIN | EXTERNAL | EXTENDED`) was given for a column
|
|
29
|
+
* whose type has no variable-length value. Only `string`, `bytes`, and array columns take one.
|
|
30
|
+
*/
|
|
31
|
+
ColumnStorageNotApplicable: 'CADB0414',
|
|
27
32
|
/** The database already exists. Also raised when `IF NOT EXISTS` loses a registration race. */
|
|
28
33
|
DatabaseAlreadyExists: 'CADB0012',
|
|
29
34
|
/**
|
|
@@ -48,5 +53,16 @@ export const CamusErrorCode = {
|
|
|
48
53
|
PreparedStatementLimitExceeded: 'CADB0521',
|
|
49
54
|
/** The statement runs in its own internal transaction and is refused inside an explicit one. */
|
|
50
55
|
StatementNotAllowedInTransaction: 'CADB0538',
|
|
56
|
+
/**
|
|
57
|
+
* A stored large value could not be read back. A compressed value failed to decompress, or an
|
|
58
|
+
* out-of-line value was missing or did not match its checksum. The server retries a concurrent
|
|
59
|
+
* update before it raises this code, so the code means damaged data, not a race.
|
|
60
|
+
*/
|
|
61
|
+
LargeValueCorrupt: 'CADB0540',
|
|
62
|
+
/**
|
|
63
|
+
* A server defect: a read path decoded a large value that it did not fetch. The server raises it so
|
|
64
|
+
* that no internal pointer reaches a result. Report it.
|
|
65
|
+
*/
|
|
66
|
+
LargeValueNotResolved: 'CADB0541',
|
|
51
67
|
};
|
|
52
68
|
//# sourceMappingURL=error-codes.js.map
|
package/dist/error-codes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,0EAA0E;IAC1E,OAAO,EAAE,UAAU;IAEnB;;;;;;;OAOG;IACH,mBAAmB,EAAE,UAAU;IAE/B,wFAAwF;IACxF,gBAAgB,EAAE,UAAU;IAE5B,mFAAmF;IACnF,aAAa,EAAE,UAAU;IAEzB,+FAA+F;IAC/F,qBAAqB,EAAE,UAAU;IAEjC;;;OAGG;IACH,kBAAkB,EAAE,UAAU;IAE9B;;;OAGG;IACH,oBAAoB,EAAE,UAAU;IAEhC,8FAA8F;IAC9F,qBAAqB,EAAE,UAAU;IAEjC,iGAAiG;IACjG,mBAAmB,EAAE,UAAU;IAE/B,0FAA0F;IAC1F,iBAAiB,EAAE,UAAU;IAE7B,4FAA4F;IAC5F,wBAAwB,EAAE,UAAU;IAEpC,wDAAwD;IACxD,8BAA8B,EAAE,UAAU;IAE1C,gGAAgG;IAChG,gCAAgC,EAAE,UAAU;
|
|
1
|
+
{"version":3,"file":"error-codes.js","sourceRoot":"","sources":["../src/error-codes.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,0EAA0E;IAC1E,OAAO,EAAE,UAAU;IAEnB;;;;;;;OAOG;IACH,mBAAmB,EAAE,UAAU;IAE/B,wFAAwF;IACxF,gBAAgB,EAAE,UAAU;IAE5B,mFAAmF;IACnF,aAAa,EAAE,UAAU;IAEzB;;;OAGG;IACH,0BAA0B,EAAE,UAAU;IAEtC,+FAA+F;IAC/F,qBAAqB,EAAE,UAAU;IAEjC;;;OAGG;IACH,kBAAkB,EAAE,UAAU;IAE9B;;;OAGG;IACH,oBAAoB,EAAE,UAAU;IAEhC,8FAA8F;IAC9F,qBAAqB,EAAE,UAAU;IAEjC,iGAAiG;IACjG,mBAAmB,EAAE,UAAU;IAE/B,0FAA0F;IAC1F,iBAAiB,EAAE,UAAU;IAE7B,4FAA4F;IAC5F,wBAAwB,EAAE,UAAU;IAEpC,wDAAwD;IACxD,8BAA8B,EAAE,UAAU;IAE1C,gGAAgG;IAChG,gCAAgC,EAAE,UAAU;IAE5C;;;;OAIG;IACH,iBAAiB,EAAE,UAAU;IAE7B;;;OAGG;IACH,qBAAqB,EAAE,UAAU;CACzB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -37,6 +37,7 @@ export type { TypedParameter } from './values/typed.js';
|
|
|
37
37
|
export type { Parameters, ParameterValue } from './values/encode.js';
|
|
38
38
|
export type { DecodeOptions, Int64Mode } from './values/decode.js';
|
|
39
39
|
export { decodeValue } from './values/decode.js';
|
|
40
|
+
export { CamusColumnStorage, isColumnStorage, rewriteStorageStatement, setColumnStorageStatement, } from './column-storage.js';
|
|
40
41
|
export { CamusObjectId } from './object-id.js';
|
|
41
42
|
export { CamusVector } from './vector.js';
|
|
42
43
|
export { TICKS_PER_DAY, TICKS_PER_MILLISECOND, UNIX_EPOCH_TICKS, dateToDayTicks, dateToTicks, ticksToDate, } from './values/ticks.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EACV,0BAA0B,EAC1B,aAAa,EACb,WAAW,EACX,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OA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AAoB,CAAC;AAEjD,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EACL,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D,OAAO,EAAE,gBAAgB,EAAE,SAAS,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtG,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAIrD,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AACtF,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,YAAY,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAIlD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAInE,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ export { computeDelayMs, isRetryable, withRetry } from './retry.js';
|
|
|
32
32
|
export { ColumnType, columnTypeName, isColumnType } from './column-type.js';
|
|
33
33
|
export { camus } from './values/typed.js';
|
|
34
34
|
export { decodeValue } from './values/decode.js';
|
|
35
|
+
export { CamusColumnStorage, isColumnStorage, rewriteStorageStatement, setColumnStorageStatement, } from './column-storage.js';
|
|
35
36
|
export { CamusObjectId } from './object-id.js';
|
|
36
37
|
export { CamusVector } from './vector.js';
|
|
37
38
|
export { TICKS_PER_DAY, TICKS_PER_MILLISECOND, UNIX_EPOCH_TICKS, dateToDayTicks, dateToTicks, ticksToDate, } from './values/ticks.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AAEH,+EAA+E;AAE/E,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAQhD,+EAA+E;AAE/E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAGrF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEvF,OAAO,EACL,mBAAmB,EACnB,YAAY,EACZ,oBAAoB,EACpB,2BAA2B,EAC3B,8BAA8B,EAC9B,4BAA4B,GAC7B,MAAM,cAAc,CAAC;AAGtB,+EAA+E;AAE/E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAGpE,+EAA+E;AAE/E,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE5E,OA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G,+EAA+E;AAE/E,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGtF,+EAA+E;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAGrC,+EAA+E;AAE/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,+EAA+E;AAE/E,OAAO,EACL,iBAAiB,EACjB,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,iBAAiB,CAAC"}
|
package/dist/runtime.js
CHANGED
|
@@ -126,6 +126,8 @@ function transportKey(config, deployment) {
|
|
|
126
126
|
String(config.batch.channelPoolSize),
|
|
127
127
|
String(config.batch.coalescingThreshold),
|
|
128
128
|
String(config.batch.coalescingDelayMs),
|
|
129
|
+
String(config.batch.requestFrames),
|
|
130
|
+
String(config.batch.streamDrainTimeoutMs),
|
|
129
131
|
].join('|');
|
|
130
132
|
}
|
|
131
133
|
function isLoginClient(value) {
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,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IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAC7D,CAAC;IACJ,CAAC;CACF;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,MAAsB,EAAE,UAAkB;IAC9D,OAAO;QACL,kBAAkB,CAAC,UAAU,CAAC,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC;QAC7D,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC;QACpC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC;QACxC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC;QACtC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC;QAClC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,CAAC;KAC1C,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACd,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,OAAQ,KAA0B,CAAC,KAAK,KAAK,UAAU;QACvD,OAAQ,KAA0B,CAAC,MAAM,KAAK,UAAU,CACzD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of CamusDB
|
|
3
|
+
*
|
|
4
|
+
* For the full copyright and license information, please view the LICENSE.txt
|
|
5
|
+
* file that was distributed with this source code.
|
|
6
|
+
*/
|
|
7
|
+
import type { GrpcBatchExecuteRequest } from './messages.js';
|
|
8
|
+
/**
|
|
9
|
+
* The `BatchExecute` stream frame contract.
|
|
10
|
+
*
|
|
11
|
+
* A frame is one stream message that carries several complete operations, on the request side, or
|
|
12
|
+
* several complete responses, on the response side. The fixed cost of a stream message is then
|
|
13
|
+
* paid once per frame rather than once per operation or per row. A frame gives no atomicity and
|
|
14
|
+
* no ordering that the stream does not already give.
|
|
15
|
+
*
|
|
16
|
+
* The server keeps the same constants. The two must agree, as the two copies of `camus_sql.proto`
|
|
17
|
+
* must.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* The response header a server writes when a stream opens to say that it reads request frames.
|
|
21
|
+
* The value is the highest contract version the server reads.
|
|
22
|
+
*
|
|
23
|
+
* A server built before frames writes nothing, and runs an unknown kind as a non-query. A client
|
|
24
|
+
* therefore waits for this announcement and never probes for it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const FRAME_HEADER = "camusdb-batch-frames";
|
|
27
|
+
/**
|
|
28
|
+
* The request header a client writes when it opens a stream to say that it reads response frames.
|
|
29
|
+
* The value is the highest contract version the client reads.
|
|
30
|
+
*
|
|
31
|
+
* Without it, a server knows the client reads frames only once a request frame arrives. A single
|
|
32
|
+
* caller sends no request frame, so one large read would stay at one message per row. A server
|
|
33
|
+
* built before frames ignores the header.
|
|
34
|
+
*/
|
|
35
|
+
export declare const FRAME_ACCEPT_HEADER = "camusdb-batch-frames-accept";
|
|
36
|
+
/** The contract version this client writes, and the highest it reads. */
|
|
37
|
+
export declare const FRAME_VERSION = 1;
|
|
38
|
+
/** The most operations one frame carries. A server refuses the operations past it. */
|
|
39
|
+
export declare const FRAME_MAX_ITEMS = 256;
|
|
40
|
+
/**
|
|
41
|
+
* The most serialized operation bytes one frame carries.
|
|
42
|
+
*
|
|
43
|
+
* It sits far below the 4 MiB default message limit of gRPC, and on purpose. A message over the
|
|
44
|
+
* limit of the transport is refused before it is parsed, which resets the stream that every other
|
|
45
|
+
* operation shares. The sender must never build one. An operation larger than this budget on its
|
|
46
|
+
* own travels as a plain single message.
|
|
47
|
+
*/
|
|
48
|
+
export declare const FRAME_MAX_BYTES: number;
|
|
49
|
+
/** True when a header value announces a contract version this client writes. */
|
|
50
|
+
export declare function announcesFrames(value: string | undefined): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* An upper bound on the bytes one operation adds to a frame.
|
|
53
|
+
*
|
|
54
|
+
* `@grpc/proto-loader` builds a message as a plain object, which carries no serialized size. An
|
|
55
|
+
* exact figure costs a second serialization of every payload, and a large value now travels this
|
|
56
|
+
* path. The budget sits at a quarter of the message limit, so a generous estimate is the cheaper
|
|
57
|
+
* side of the trade: it fills a frame less than it could, and it never builds one the transport
|
|
58
|
+
* refuses.
|
|
59
|
+
*/
|
|
60
|
+
export declare function frameCost(request: GrpcBatchExecuteRequest): number;
|
|
61
|
+
//# sourceMappingURL=batch-frames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-frames.d.ts","sourceRoot":"","sources":["../../../src/transport/grpc/batch-frames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAA6B,MAAM,eAAe,CAAC;AAExF;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,yBAAyB,CAAC;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,gCAAgC,CAAC;AAEjE,yEAAyE;AACzE,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,sFAAsF;AACtF,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,QAAc,CAAC;AAE3C,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAMlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAElE"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of CamusDB
|
|
3
|
+
*
|
|
4
|
+
* For the full copyright and license information, please view the LICENSE.txt
|
|
5
|
+
* file that was distributed with this source code.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The `BatchExecute` stream frame contract.
|
|
9
|
+
*
|
|
10
|
+
* A frame is one stream message that carries several complete operations, on the request side, or
|
|
11
|
+
* several complete responses, on the response side. The fixed cost of a stream message is then
|
|
12
|
+
* paid once per frame rather than once per operation or per row. A frame gives no atomicity and
|
|
13
|
+
* no ordering that the stream does not already give.
|
|
14
|
+
*
|
|
15
|
+
* The server keeps the same constants. The two must agree, as the two copies of `camus_sql.proto`
|
|
16
|
+
* must.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* The response header a server writes when a stream opens to say that it reads request frames.
|
|
20
|
+
* The value is the highest contract version the server reads.
|
|
21
|
+
*
|
|
22
|
+
* A server built before frames writes nothing, and runs an unknown kind as a non-query. A client
|
|
23
|
+
* therefore waits for this announcement and never probes for it.
|
|
24
|
+
*/
|
|
25
|
+
export const FRAME_HEADER = 'camusdb-batch-frames';
|
|
26
|
+
/**
|
|
27
|
+
* The request header a client writes when it opens a stream to say that it reads response frames.
|
|
28
|
+
* The value is the highest contract version the client reads.
|
|
29
|
+
*
|
|
30
|
+
* Without it, a server knows the client reads frames only once a request frame arrives. A single
|
|
31
|
+
* caller sends no request frame, so one large read would stay at one message per row. A server
|
|
32
|
+
* built before frames ignores the header.
|
|
33
|
+
*/
|
|
34
|
+
export const FRAME_ACCEPT_HEADER = 'camusdb-batch-frames-accept';
|
|
35
|
+
/** The contract version this client writes, and the highest it reads. */
|
|
36
|
+
export const FRAME_VERSION = 1;
|
|
37
|
+
/** The most operations one frame carries. A server refuses the operations past it. */
|
|
38
|
+
export const FRAME_MAX_ITEMS = 256;
|
|
39
|
+
/**
|
|
40
|
+
* The most serialized operation bytes one frame carries.
|
|
41
|
+
*
|
|
42
|
+
* It sits far below the 4 MiB default message limit of gRPC, and on purpose. A message over the
|
|
43
|
+
* limit of the transport is refused before it is parsed, which resets the stream that every other
|
|
44
|
+
* operation shares. The sender must never build one. An operation larger than this budget on its
|
|
45
|
+
* own travels as a plain single message.
|
|
46
|
+
*/
|
|
47
|
+
export const FRAME_MAX_BYTES = 1024 * 1024;
|
|
48
|
+
/** True when a header value announces a contract version this client writes. */
|
|
49
|
+
export function announcesFrames(value) {
|
|
50
|
+
if (value === undefined)
|
|
51
|
+
return false;
|
|
52
|
+
const version = Number.parseInt(value, 10);
|
|
53
|
+
return Number.isInteger(version) && version >= FRAME_VERSION;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* An upper bound on the bytes one operation adds to a frame.
|
|
57
|
+
*
|
|
58
|
+
* `@grpc/proto-loader` builds a message as a plain object, which carries no serialized size. An
|
|
59
|
+
* exact figure costs a second serialization of every payload, and a large value now travels this
|
|
60
|
+
* path. The budget sits at a quarter of the message limit, so a generous estimate is the cheaper
|
|
61
|
+
* side of the trade: it fills a frame less than it could, and it never builds one the transport
|
|
62
|
+
* refuses.
|
|
63
|
+
*/
|
|
64
|
+
export function frameCost(request) {
|
|
65
|
+
return ENVELOPE_BYTES + MESSAGE_BYTES + sqlRequestCost(request.request);
|
|
66
|
+
}
|
|
67
|
+
/** What a protobuf tag and a length prefix add around one nested message or one string. */
|
|
68
|
+
const ENVELOPE_BYTES = 8;
|
|
69
|
+
/** What a message of small scalar fields costs. Generous on purpose. */
|
|
70
|
+
const MESSAGE_BYTES = 32;
|
|
71
|
+
function sqlRequestCost(request) {
|
|
72
|
+
if (request === undefined)
|
|
73
|
+
return 0;
|
|
74
|
+
let cost = MESSAGE_BYTES + textCost(request.database) + textCost(request.sql);
|
|
75
|
+
if (request.parameters !== undefined) {
|
|
76
|
+
for (const [name, value] of Object.entries(request.parameters)) {
|
|
77
|
+
cost += MESSAGE_BYTES + textCost(name) + valueCost(value);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (request.positionalParameters !== undefined) {
|
|
81
|
+
for (const value of request.positionalParameters)
|
|
82
|
+
cost += valueCost(value);
|
|
83
|
+
}
|
|
84
|
+
return cost;
|
|
85
|
+
}
|
|
86
|
+
function valueCost(value) {
|
|
87
|
+
let cost = MESSAGE_BYTES;
|
|
88
|
+
cost += textCost(value.stringValue);
|
|
89
|
+
cost += bytesCost(value.bytesValue);
|
|
90
|
+
cost += bytesCost(value.uuidValue);
|
|
91
|
+
if (value.arrayValue !== undefined) {
|
|
92
|
+
for (const item of value.arrayValue.items)
|
|
93
|
+
cost += valueCost(item);
|
|
94
|
+
}
|
|
95
|
+
return cost;
|
|
96
|
+
}
|
|
97
|
+
function textCost(text) {
|
|
98
|
+
return text === undefined ? 0 : ENVELOPE_BYTES + Buffer.byteLength(text, 'utf8');
|
|
99
|
+
}
|
|
100
|
+
function bytesCost(bytes) {
|
|
101
|
+
return bytes === undefined ? 0 : ENVELOPE_BYTES + bytes.length;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=batch-frames.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-frames.js","sourceRoot":"","sources":["../../../src/transport/grpc/batch-frames.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,6BAA6B,CAAC;AAEjE,yEAAyE;AACzE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAE/B,sFAAsF;AACtF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,gFAAgF;AAChF,MAAM,UAAU,eAAe,CAAC,KAAyB;IACvD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAEtC,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAE3C,OAAO,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,OAAO,IAAI,aAAa,CAAC;AAC/D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,OAAgC;IACxD,OAAO,cAAc,G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,KAAK;YAAE,IAAI,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;IACrE,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,IAAwB;IACxC,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,SAAS,CAAC,KAAyB;IAC1C,OAAO,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,cAAc,GAAG,KAAK,CAAC,MAAM,CAAC;AACjE,CAAC"}
|
|
@@ -48,6 +48,14 @@ export declare class PreparedStatementStaleError extends Error {
|
|
|
48
48
|
export interface BatchStream {
|
|
49
49
|
/** Identifies this stream. A handle registered on it is invalid on any other. */
|
|
50
50
|
readonly id: number;
|
|
51
|
+
/**
|
|
52
|
+
* True once this stream's server announced that it reads request frames.
|
|
53
|
+
*
|
|
54
|
+
* It never blocks, and it never goes back to false. It is false until the announcement arrives,
|
|
55
|
+
* and it stays false against a server that makes none. It belongs to one stream, so a rebuilt
|
|
56
|
+
* stream negotiates again on its own.
|
|
57
|
+
*/
|
|
58
|
+
readonly framesAnnounced: boolean;
|
|
51
59
|
send(request: GrpcBatchExecuteRequest): void;
|
|
52
60
|
/** Registers the callbacks that drive the reader loop. Called once, right after construction. */
|
|
53
61
|
listen(handlers: {
|
|
@@ -65,21 +73,59 @@ export interface BatchStream {
|
|
|
65
73
|
* share a transaction go to one stream, in arrival order, so the server sees them in the order the
|
|
66
74
|
* caller wrote them; autocommit statements are free to use any stream.
|
|
67
75
|
*
|
|
76
|
+
* Operations that wait together travel together. The pump writes the operations it drained for one
|
|
77
|
+
* stream as a single stream message — a frame — when that stream's server announced that it reads
|
|
78
|
+
* one, and it reads a response frame at any time. A frame never waits: it packs only the
|
|
79
|
+
* operations that already sit in the inbox, and a lone operation stays the plain single message it
|
|
80
|
+
* always was. It is a transport optimization alone. It gives no atomicity and no ordering that the
|
|
81
|
+
* stream does not already give.
|
|
82
|
+
*
|
|
68
83
|
* A stream that faults is rebuilt by the next write, and every operation that was in flight on the
|
|
69
84
|
* old one is failed so its caller can decide whether to replay it. Prepared statements are scoped
|
|
70
85
|
* to the stream that registered them, and a handle from a stream that is gone is refused at the
|
|
71
86
|
* last moment before it would be written.
|
|
87
|
+
*
|
|
88
|
+
* A stream is rotated when the credential it opened under is superseded. A stream presents its
|
|
89
|
+
* bearer token once, in its opening metadata, and then outlives it: the provider renews the token
|
|
90
|
+
* every few minutes, and the stream is meant to last a session. Whether the server tolerates that
|
|
91
|
+
* is the server's decision, and a server that re-checks the opening token per operation ends the
|
|
92
|
+
* stream at that token's expiry, with every transaction on it. The client does not rely on it.
|
|
93
|
+
*
|
|
94
|
+
* When the next unbound operation of a slot finds the credential changed, the slot opens a fresh
|
|
95
|
+
* stream under the new token, and the old one is retired. A retired stream takes no new work. It
|
|
96
|
+
* keeps serving the transactions that began on it, because a transaction cannot change streams,
|
|
97
|
+
* and the server rolls a transaction back when its stream closes. It is closed as soon as the last
|
|
98
|
+
* of them ends, or after `streamDrainTimeoutMs`. Rotation happens on the write path, so an idle
|
|
99
|
+
* client rotates on its first operation after the renewal, before that operation is sent.
|
|
72
100
|
*/
|
|
73
101
|
export declare class GrpcBatcher {
|
|
74
102
|
private readonly options;
|
|
75
103
|
private readonly streamFactory;
|
|
104
|
+
/**
|
|
105
|
+
* Reports the credential a stream opened now would carry, which in practice is the current
|
|
106
|
+
* bearer token. It is compared, never inspected: a value that differs from the one a stream
|
|
107
|
+
* opened under is what retires that stream. Undefined means that a stream carries no credential
|
|
108
|
+
* that can change, and that nothing is ever rotated.
|
|
109
|
+
*/
|
|
110
|
+
private readonly credentialStamp;
|
|
76
111
|
private readonly slots;
|
|
77
112
|
private readonly pending;
|
|
113
|
+
/**
|
|
114
|
+
* The stream each open transaction began on, by handle. An entry is written when a start is
|
|
115
|
+
* answered, and removed when the server answers the commit or the rollback, or when that stream
|
|
116
|
+
* ends. It is what lets a transaction keep its stream across a rotation of its slot.
|
|
117
|
+
*/
|
|
118
|
+
private readonly openTransactions;
|
|
119
|
+
/**
|
|
120
|
+
* Retired streams that still drain, so disposal can reach them: a slot references its current
|
|
121
|
+
* stream alone.
|
|
122
|
+
*/
|
|
123
|
+
private readonly retiring;
|
|
78
124
|
private requestIdSeq;
|
|
79
125
|
private roundRobin;
|
|
80
126
|
private transportIdSeq;
|
|
81
127
|
private disposed;
|
|
82
|
-
constructor(options: GrpcBatchOptions, streamFactory: (id: number) => BatchStream);
|
|
128
|
+
constructor(options: GrpcBatchOptions, streamFactory: (id: number) => BatchStream, credentialStamp?: () => unknown);
|
|
83
129
|
/** Reserves a stream for a transaction, so all of its operations land in one ordering chain. */
|
|
84
130
|
reserveSlot(): number;
|
|
85
131
|
enqueueQuery(request: GrpcSqlRequest, slotIndex: number | undefined, signal: AbortSignal | undefined, expectedTransportId?: number): Promise<BatchQueryResult>;
|
|
@@ -106,17 +152,100 @@ export declare class GrpcBatcher {
|
|
|
106
152
|
closePrepared(slotIndex: number, entry: PreparedSlotEntry, signal: AbortSignal | undefined): Promise<void>;
|
|
107
153
|
private enqueue;
|
|
108
154
|
private enqueueTracked;
|
|
155
|
+
/**
|
|
156
|
+
* Starts the slot's pump after the current turn, and not inside it.
|
|
157
|
+
*
|
|
158
|
+
* A caller that issues several statements at once — one `Promise.all` over six of them — queues
|
|
159
|
+
* them all in one synchronous turn. A pump that ran inside `enqueue` would write the first
|
|
160
|
+
* before the second was queued, and every operation would then travel alone. One microtask of
|
|
161
|
+
* delay costs no round trip, and it lets the operations that were issued together share a frame.
|
|
162
|
+
*/
|
|
163
|
+
private schedule;
|
|
109
164
|
/**
|
|
110
165
|
* Drains one slot's queue onto its stream.
|
|
111
166
|
*
|
|
112
167
|
* Only one pump runs per slot, so the slot's stream has exactly one writer and needs no lock.
|
|
113
168
|
*/
|
|
114
169
|
private pump;
|
|
115
|
-
|
|
116
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Prepares one operation for the wire, then either writes it alone or adds it to the slot's run.
|
|
172
|
+
*
|
|
173
|
+
* A run is the set of operations that will share the next stream message. It holds consecutive
|
|
174
|
+
* operations bound for one stream. The operations of one drain can belong to different streams,
|
|
175
|
+
* so an operation for another stream flushes the run first. Operations are never reordered to
|
|
176
|
+
* fill a frame: the server chains the operations of a transaction by arrival order, and inbox
|
|
177
|
+
* order is the only order the callers gave.
|
|
178
|
+
*/
|
|
179
|
+
private stage;
|
|
180
|
+
/**
|
|
181
|
+
* Writes the slot's run: one frame, or the plain single message when one operation is left in
|
|
182
|
+
* it, so a quiet stream stays byte-identical to a stream without frames.
|
|
183
|
+
*
|
|
184
|
+
* A frame is never resent. A frame whose write failed may or may not have reached the server,
|
|
185
|
+
* which is true of every operation in it, so every one of them faults with the transport error.
|
|
186
|
+
* The retry contract above the batcher then decides, exactly as it does for the operations of a
|
|
187
|
+
* stream that faulted.
|
|
188
|
+
*/
|
|
189
|
+
private flush;
|
|
190
|
+
private send;
|
|
191
|
+
/**
|
|
192
|
+
* False for an operation whose caller left — it was cancelled, or it timed out — before the
|
|
193
|
+
* operation was written. The server is never asked to run it.
|
|
194
|
+
*
|
|
195
|
+
* A rollback and a close are written whatever happens. Each one only releases what the server
|
|
196
|
+
* holds, which is a transaction's locks or a statement handle, and nothing else would.
|
|
197
|
+
*/
|
|
198
|
+
private mustStillBeWritten;
|
|
199
|
+
/**
|
|
200
|
+
* The stream one operation belongs on.
|
|
201
|
+
*
|
|
202
|
+
* A transaction stays on the stream it began on, whatever the slot has moved to since. Anything
|
|
203
|
+
* else takes the slot's current stream, and that is where a credential change is noticed.
|
|
204
|
+
*/
|
|
205
|
+
private route;
|
|
206
|
+
/**
|
|
207
|
+
* Opens a fresh stream for a slot and makes it the current one.
|
|
208
|
+
*
|
|
209
|
+
* The stamp is read before the factory reads the credential itself. If the credential is renewed
|
|
210
|
+
* in between, the stream is stamped older than it is, and it rotates once more than it needs to.
|
|
211
|
+
* Read afterwards, it could be stamped newer than it is, and would never rotate at all.
|
|
212
|
+
*/
|
|
213
|
+
private connect;
|
|
214
|
+
/**
|
|
215
|
+
* Takes a stream out of rotation.
|
|
216
|
+
*
|
|
217
|
+
* It stays open for the transactions that began on it, and it closes when the last one ends — or
|
|
218
|
+
* after `streamDrainTimeoutMs`, because a transaction its caller abandoned would otherwise hold
|
|
219
|
+
* the stream, and its locks, open for good. Closing the stream is what makes the server roll
|
|
220
|
+
* such a transaction back.
|
|
221
|
+
*/
|
|
222
|
+
private retire;
|
|
223
|
+
private closeIfDrained;
|
|
224
|
+
/**
|
|
225
|
+
* Closes a stream once, and forgets everything that was riding on it.
|
|
226
|
+
*
|
|
227
|
+
* It runs whichever end closes the stream first: this client, when a retired stream has drained,
|
|
228
|
+
* or the server, through the stream's own close event.
|
|
229
|
+
*/
|
|
230
|
+
private close;
|
|
231
|
+
/** Drops an operation's hold on its stream, once however many paths race to do it. */
|
|
232
|
+
private release;
|
|
233
|
+
private transactionBegan;
|
|
234
|
+
private transactionEnded;
|
|
235
|
+
/**
|
|
236
|
+
* True when a transaction began on a stream that was rotated out, and is finishing there.
|
|
237
|
+
*
|
|
238
|
+
* Such a transaction must not run prepared. A slot keeps one registration per statement, and
|
|
239
|
+
* that registration belongs to the slot's current stream, where this transaction does not write.
|
|
240
|
+
* To register the statement on the retired stream instead would evict the entry every autocommit
|
|
241
|
+
* caller is using, and the two would re-prepare against each other until the old stream closes.
|
|
242
|
+
* To run the statement inline is always correct, and the window is short.
|
|
243
|
+
*/
|
|
244
|
+
isBoundToRetiredStream(txnIdPT: bigint, txnIdCounter: number): boolean;
|
|
117
245
|
private demux;
|
|
118
246
|
private complete;
|
|
119
247
|
private fault;
|
|
248
|
+
private finalizesTransaction;
|
|
120
249
|
private settle;
|
|
121
250
|
/** Fails every operation still in flight on a stream that closed, so its caller can replay. */
|
|
122
251
|
private failStreamPending;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../src/transport/grpc/batcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"batcher.d.ts","sourceRoot":"","sources":["../../../src/transport/grpc/batcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAMxD,OAAO,KAAK,EACV,uBAAuB,EACvB,wBAAwB,EAExB,aAAa,EACb,gBAAgB,EAChB,cAAc,EACd,aAAa,EACd,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAElE,6FAA6F;AAC7F,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,kBAAkB,EAAE,gBAAwD,CAAC;AAE1F,yFAAyF;AACzF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,aAAa,EAAE,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,gBAAgB,CAAC;IACjC,QAAQ,CAAC,aAAa,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,kBAAkB,GAAG,SAAS,CAAC;CAClD;AAED,mCAAmC;AACnC,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KA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