@zukhruf/checkpoint 0.0.0-stage → 0.8.165
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/LICENSE +21 -0
- package/README.md +436 -2
- package/dist/checkpoint-store.d.ts +34 -0
- package/dist/checkpoint-store.d.ts.map +1 -0
- package/dist/checkpoint-store.js +2 -0
- package/dist/checkpoint-store.js.map +1 -0
- package/dist/checkpoint.d.ts +60 -0
- package/dist/checkpoint.d.ts.map +1 -0
- package/dist/checkpoint.js +2 -0
- package/dist/checkpoint.js.map +1 -0
- package/dist/consumer-group.d.ts +30 -0
- package/dist/consumer-group.d.ts.map +1 -0
- package/dist/consumer-group.js +56 -0
- package/dist/consumer-group.js.map +1 -0
- package/dist/errors.d.ts +34 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +46 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/map-state.d.ts +36 -0
- package/dist/map-state.d.ts.map +1 -0
- package/dist/map-state.js +82 -0
- package/dist/map-state.js.map +1 -0
- package/dist/memory-checkpoint-store.d.ts +25 -0
- package/dist/memory-checkpoint-store.d.ts.map +1 -0
- package/dist/memory-checkpoint-store.js +107 -0
- package/dist/memory-checkpoint-store.js.map +1 -0
- package/dist/partition-context.d.ts +36 -0
- package/dist/partition-context.d.ts.map +1 -0
- package/dist/partition-context.js +80 -0
- package/dist/partition-context.js.map +1 -0
- package/package.json +48 -4
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { IncompatibleCheckpointError } from './errors.js';
|
|
2
|
+
import { PartitionContext } from './partition-context.js';
|
|
3
|
+
/**
|
|
4
|
+
* One reader of a stream, by name, as Kafka's `group.id` (ADR 0003). It claims
|
|
5
|
+
* partitions, and it lists and resets their checkpoints.
|
|
6
|
+
*/
|
|
7
|
+
export class ConsumerGroup {
|
|
8
|
+
name;
|
|
9
|
+
#store;
|
|
10
|
+
constructor(name, store) {
|
|
11
|
+
this.name = name;
|
|
12
|
+
this.#store = store;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Takes the partition with a new epoch, which fences each older claim, and
|
|
16
|
+
* reads its checkpoint (ADRs 0005 and 0008).
|
|
17
|
+
*/
|
|
18
|
+
async claim(partition, format, options) {
|
|
19
|
+
options?.signal?.throwIfAborted();
|
|
20
|
+
const key = {
|
|
21
|
+
consumerGroup: this.name,
|
|
22
|
+
stream: partition.stream,
|
|
23
|
+
partition: partition.partition,
|
|
24
|
+
};
|
|
25
|
+
const epoch = await this.#store.claim(key, options);
|
|
26
|
+
const stored = await this.#store.read(key, options);
|
|
27
|
+
return new PartitionContext(this.#store, key, epoch, format, stored === undefined
|
|
28
|
+
? undefined
|
|
29
|
+
: {
|
|
30
|
+
position: decode(key, format, stored),
|
|
31
|
+
checkpointId: stored.checkpointId,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** The partitions of this group that have a checkpoint (ADR 0009). */
|
|
35
|
+
async *list(options) {
|
|
36
|
+
options?.signal?.throwIfAborted();
|
|
37
|
+
yield* this.#store.list(this.name, options);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Removes the checkpoint and the map states of one partition, or of each
|
|
41
|
+
* partition of a stream, and fences their live owners (ADR 0009).
|
|
42
|
+
*/
|
|
43
|
+
async reset(target, options) {
|
|
44
|
+
options?.signal?.throwIfAborted();
|
|
45
|
+
await this.#store.reset(this.name, target, options);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function decode(key, format, stored) {
|
|
49
|
+
try {
|
|
50
|
+
return format.decode(stored.version, stored.json);
|
|
51
|
+
}
|
|
52
|
+
catch (cause) {
|
|
53
|
+
throw new IncompatibleCheckpointError(key, stored.version, cause);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=consumer-group.js.map
|
|
@@ -0,0 +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,CAAC;QAClC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,KAAK,CACT,MAAgE,EAChE,OAAsB;QAEtB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;QAClC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC;CACF;AAED,SAAS,MAAM,CACb,GAAkB,EAClB,MAAiB,EACjB,MAAwB;IAExB,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACpD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,2BAA2B,CAAC,GAAG,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { FencingToken } from '@zukhruf/fencing';
|
|
2
|
+
import type { CheckpointKey } from './checkpoint.ts';
|
|
3
|
+
/**
|
|
4
|
+
* A commit found a newer epoch: a newer claim or a reset took the partition,
|
|
5
|
+
* and the commit wrote nothing (ADR 0008). The reader stops.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CheckpointFencedError extends Error {
|
|
8
|
+
readonly name = "CheckpointFencedError";
|
|
9
|
+
readonly key: CheckpointKey;
|
|
10
|
+
/** The epoch of the claim that can no longer commit. */
|
|
11
|
+
readonly epoch: FencingToken;
|
|
12
|
+
constructor(key: CheckpointKey, epoch: FencingToken);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* `decode` of a format threw for a stored version (ADR 0004). Migrate the
|
|
16
|
+
* version in `decode`, or reset the partition.
|
|
17
|
+
*/
|
|
18
|
+
export declare class IncompatibleCheckpointError extends Error {
|
|
19
|
+
readonly name = "IncompatibleCheckpointError";
|
|
20
|
+
readonly key: CheckpointKey;
|
|
21
|
+
/** The version that the stored value was written with. */
|
|
22
|
+
readonly version: number;
|
|
23
|
+
constructor(key: CheckpointKey, version: number, cause: unknown);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A stored checkpoint or value is not a valid record of its store. Only a
|
|
27
|
+
* reset repairs it (ADR 0012).
|
|
28
|
+
*/
|
|
29
|
+
export declare class CorruptCheckpointError extends Error {
|
|
30
|
+
readonly name = "CorruptCheckpointError";
|
|
31
|
+
readonly key: CheckpointKey;
|
|
32
|
+
constructor(key: CheckpointKey, detail: string);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAMrD;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,KAAK;IAC9C,SAAkB,IAAI,2BAA2B;IACjD,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAE7B,YAAY,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,YAAY,EAMlD;CACF;AAED;;;GAGG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,SAAkB,IAAI,iCAAiC;IACvD,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,YAAY,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAO9D;CACF;AAED;;;GAGG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAkB,IAAI,4BAA4B;IAClD,QAAQ,CAAC,GAAG,EAAE,aAAa,CAAC;IAE5B,YAAY,GAAG,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAG7C;CACF"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
function describe(key) {
|
|
2
|
+
return `${key.consumerGroup}/${key.stream}/${key.partition}`;
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* A commit found a newer epoch: a newer claim or a reset took the partition,
|
|
6
|
+
* and the commit wrote nothing (ADR 0008). The reader stops.
|
|
7
|
+
*/
|
|
8
|
+
export class CheckpointFencedError extends Error {
|
|
9
|
+
name = 'CheckpointFencedError';
|
|
10
|
+
key;
|
|
11
|
+
/** The epoch of the claim that can no longer commit. */
|
|
12
|
+
epoch;
|
|
13
|
+
constructor(key, epoch) {
|
|
14
|
+
super(`Checkpoint ${describe(key)} was claimed or reset after epoch ${epoch.toString()}, so this claim cannot commit`);
|
|
15
|
+
this.key = key;
|
|
16
|
+
this.epoch = epoch;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* `decode` of a format threw for a stored version (ADR 0004). Migrate the
|
|
21
|
+
* version in `decode`, or reset the partition.
|
|
22
|
+
*/
|
|
23
|
+
export class IncompatibleCheckpointError extends Error {
|
|
24
|
+
name = 'IncompatibleCheckpointError';
|
|
25
|
+
key;
|
|
26
|
+
/** The version that the stored value was written with. */
|
|
27
|
+
version;
|
|
28
|
+
constructor(key, version, cause) {
|
|
29
|
+
super(`Checkpoint ${describe(key)} holds a value of version ${version} that its format cannot read`, { cause });
|
|
30
|
+
this.key = key;
|
|
31
|
+
this.version = version;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A stored checkpoint or value is not a valid record of its store. Only a
|
|
36
|
+
* reset repairs it (ADR 0012).
|
|
37
|
+
*/
|
|
38
|
+
export class CorruptCheckpointError extends Error {
|
|
39
|
+
name = 'CorruptCheckpointError';
|
|
40
|
+
key;
|
|
41
|
+
constructor(key, detail) {
|
|
42
|
+
super(`Checkpoint ${describe(key)} is corrupt: ${detail}`);
|
|
43
|
+
this.key = key;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAIA,SAAS,QAAQ,CAAC,GAAkB;IAClC,OAAO,GAAG,GAAG,CAAC,aAAa,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;AAC/D,CAAC;AAED;;;GAGG;AACH,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC5B,IAAI,GAAG,uBAAuB,CAAC;IACxC,GAAG,CAAgB;IAC5B,wDAAwD;IAC/C,KAAK,CAAe;IAE7B,YAAY,GAAkB,EAAE,KAAmB;QACjD,KAAK,CACH,cAAc,QAAQ,CAAC,GAAG,CAAC,qCAAqC,KAAK,CAAC,QAAQ,EAAE,+BAA+B,CAChH,CAAC;QACF,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAClC,IAAI,GAAG,6BAA6B,CAAC;IAC9C,GAAG,CAAgB;IAC5B,0DAA0D;IACjD,OAAO,CAAS;IAEzB,YAAY,GAAkB,EAAE,OAAe,EAAE,KAAc;QAC7D,KAAK,CACH,cAAc,QAAQ,CAAC,GAAG,CAAC,6BAA6B,OAAO,8BAA8B,EAC7F,EAAE,KAAK,EAAE,CACV,CAAC;QACF,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IAC7B,IAAI,GAAG,wBAAwB,CAAC;IACzC,GAAG,CAAgB;IAE5B,YAAY,GAAkB,EAAE,MAAc;QAC5C,KAAK,CAAC,cAAc,QAAQ,CAAC,GAAG,CAAC,gBAAgB,MAAM,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type { Checkpoint, CheckpointKey, CheckpointSummary, Format, Json, SignalOption, StateChanges, StoredCheckpoint, StoredValue, StreamPartition, } from './checkpoint.ts';
|
|
2
|
+
export type { CheckpointStore } from './checkpoint-store.ts';
|
|
3
|
+
export { ConsumerGroup } from './consumer-group.ts';
|
|
4
|
+
export { CheckpointFencedError, CorruptCheckpointError, IncompatibleCheckpointError, } from './errors.ts';
|
|
5
|
+
export type { MapState } from './map-state.ts';
|
|
6
|
+
export { MemoryCheckpointStore } from './memory-checkpoint-store.ts';
|
|
7
|
+
export { PartitionContext } from './partition-context.ts';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,WAAW,EACX,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { ConsumerGroup } from './consumer-group.js';
|
|
2
|
+
export { CheckpointFencedError, CorruptCheckpointError, IncompatibleCheckpointError, } from './errors.js';
|
|
3
|
+
export { MemoryCheckpointStore } from './memory-checkpoint-store.js';
|
|
4
|
+
export { PartitionContext } from './partition-context.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { CheckpointStore } from './checkpoint-store.ts';
|
|
2
|
+
import type { CheckpointKey, Format, SignalOption, StoredValue } from './checkpoint.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The values of one name in a partition, one value for each key (ADR 0006).
|
|
5
|
+
* Reads give the committed values with this context's changes over them.
|
|
6
|
+
* Changes stay in memory until the next commit.
|
|
7
|
+
*/
|
|
8
|
+
export interface MapState<V> {
|
|
9
|
+
get(key: string, options?: SignalOption): Promise<V | undefined>;
|
|
10
|
+
has(key: string, options?: SignalOption): Promise<boolean>;
|
|
11
|
+
entries(options?: SignalOption): AsyncIterable<[key: string, value: V]>;
|
|
12
|
+
set(key: string, value: V): void;
|
|
13
|
+
delete(key: string): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The changes of one map state since the last commit, encoded as the store
|
|
18
|
+
* keeps them; `null` is a deleted key. `over` lays them over the committed
|
|
19
|
+
* values. `replace` is the state after a clear: the committed values are gone.
|
|
20
|
+
*/
|
|
21
|
+
export type PendingChanges = {
|
|
22
|
+
readonly kind: 'over' | 'replace';
|
|
23
|
+
readonly values: Map<string, StoredValue | null>;
|
|
24
|
+
};
|
|
25
|
+
/** One typed view of a map state; the context holds its changes. */
|
|
26
|
+
export declare class MapStateView<V, W> implements MapState<V> {
|
|
27
|
+
#private;
|
|
28
|
+
constructor(store: CheckpointStore<W>, key: CheckpointKey, name: string, format: Format<V>, pending: Map<string, PendingChanges>);
|
|
29
|
+
get(key: string, options?: SignalOption): Promise<V | undefined>;
|
|
30
|
+
has(key: string, options?: SignalOption): Promise<boolean>;
|
|
31
|
+
entries(options?: SignalOption): AsyncIterable<[string, V]>;
|
|
32
|
+
set(key: string, value: V): void;
|
|
33
|
+
delete(key: string): void;
|
|
34
|
+
clear(): void;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=map-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-state.d.ts","sourceRoot":"","sources":["../src/map-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EACV,aAAa,EACb,MAAM,EACN,YAAY,EACZ,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAGzB;;;;GAIG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC;IACzB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IACjE,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC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,CAExB;IAED,KAAK,IAAI,IAAI,CAEZ;CAiBF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { IncompatibleCheckpointError } from './errors.js';
|
|
2
|
+
/** One typed view of a map state; the context holds its changes. */
|
|
3
|
+
export class MapStateView {
|
|
4
|
+
#store;
|
|
5
|
+
#key;
|
|
6
|
+
#name;
|
|
7
|
+
#format;
|
|
8
|
+
#pending;
|
|
9
|
+
constructor(store, key, name, format, pending) {
|
|
10
|
+
this.#store = store;
|
|
11
|
+
this.#key = key;
|
|
12
|
+
this.#name = name;
|
|
13
|
+
this.#format = format;
|
|
14
|
+
this.#pending = pending;
|
|
15
|
+
}
|
|
16
|
+
async get(key, options) {
|
|
17
|
+
options?.signal?.throwIfAborted();
|
|
18
|
+
const pending = this.#pending.get(this.#name);
|
|
19
|
+
const change = pending?.values.get(key);
|
|
20
|
+
if (change !== undefined)
|
|
21
|
+
return change === null ? undefined : this.#decode(change);
|
|
22
|
+
if (pending?.kind === 'replace')
|
|
23
|
+
return undefined;
|
|
24
|
+
const stored = await this.#store.get(this.#key, this.#name, [key], options);
|
|
25
|
+
const value = stored.get(key);
|
|
26
|
+
return value === undefined ? undefined : this.#decode(value);
|
|
27
|
+
}
|
|
28
|
+
async has(key, options) {
|
|
29
|
+
options?.signal?.throwIfAborted();
|
|
30
|
+
const pending = this.#pending.get(this.#name);
|
|
31
|
+
const change = pending?.values.get(key);
|
|
32
|
+
if (change !== undefined)
|
|
33
|
+
return change !== null;
|
|
34
|
+
if (pending?.kind === 'replace')
|
|
35
|
+
return false;
|
|
36
|
+
const stored = await this.#store.get(this.#key, this.#name, [key], options);
|
|
37
|
+
return stored.has(key);
|
|
38
|
+
}
|
|
39
|
+
async *entries(options) {
|
|
40
|
+
options?.signal?.throwIfAborted();
|
|
41
|
+
const pending = this.#pending.get(this.#name);
|
|
42
|
+
if (pending?.kind !== 'replace') {
|
|
43
|
+
for await (const [key, value] of this.#store.scan(this.#key, this.#name, options)) {
|
|
44
|
+
if (!pending?.values.has(key))
|
|
45
|
+
yield [key, this.#decode(value)];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
for (const [key, change] of pending?.values ?? []) {
|
|
49
|
+
if (change !== null)
|
|
50
|
+
yield [key, this.#decode(change)];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
set(key, value) {
|
|
54
|
+
this.#changes().set(key, {
|
|
55
|
+
version: this.#format.version,
|
|
56
|
+
json: this.#format.encode(value),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
delete(key) {
|
|
60
|
+
this.#changes().set(key, null);
|
|
61
|
+
}
|
|
62
|
+
clear() {
|
|
63
|
+
this.#pending.set(this.#name, { kind: 'replace', values: new Map() });
|
|
64
|
+
}
|
|
65
|
+
#changes() {
|
|
66
|
+
const pending = this.#pending.get(this.#name);
|
|
67
|
+
if (pending !== undefined)
|
|
68
|
+
return pending.values;
|
|
69
|
+
const values = new Map();
|
|
70
|
+
this.#pending.set(this.#name, { kind: 'over', values });
|
|
71
|
+
return values;
|
|
72
|
+
}
|
|
73
|
+
#decode(value) {
|
|
74
|
+
try {
|
|
75
|
+
return this.#format.decode(value.version, value.json);
|
|
76
|
+
}
|
|
77
|
+
catch (cause) {
|
|
78
|
+
throw new IncompatibleCheckpointError(this.#key, value.version, cause);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=map-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"map-state.js","sourceRoot":"","sources":["../src/map-state.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AA0B1D,oEAAoE;AACpE,MAAM,OAAO,YAAY;IACd,MAAM,CAAqB;IAC3B,IAAI,CAAgB;IACpB,KAAK,CAAS;IACd,OAAO,CAAY;IACnB,QAAQ,CAA8B;IAE/C,YACE,KAAyB,EACzB,GAAkB,EAClB,IAAY,EACZ,M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,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { FencingToken } from '@zukhruf/fencing';
|
|
2
|
+
import type { CheckpointStore } from './checkpoint-store.ts';
|
|
3
|
+
import type { CheckpointKey, CheckpointSummary, SignalOption, StateChanges, StoredCheckpoint, StoredValue } from './checkpoint.ts';
|
|
4
|
+
/**
|
|
5
|
+
* Keeps checkpoints in the memory of this process (ADR 0011). A commit has no
|
|
6
|
+
* transaction for an output, so it takes no `write`.
|
|
7
|
+
*/
|
|
8
|
+
export declare class MemoryCheckpointStore implements CheckpointStore<never> {
|
|
9
|
+
#private;
|
|
10
|
+
claim(key: CheckpointKey, options?: SignalOption): Promise<FencingToken>;
|
|
11
|
+
read(key: CheckpointKey, options?: SignalOption): Promise<StoredCheckpoint | undefined>;
|
|
12
|
+
get(key: CheckpointKey, state: string, keys: readonly string[], options?: SignalOption): Promise<ReadonlyMap<string, StoredValue>>;
|
|
13
|
+
scan(key: CheckpointKey, state: string, options?: SignalOption): AsyncIterable<readonly [string, StoredValue]>;
|
|
14
|
+
commit(key: CheckpointKey, epoch: FencingToken, checkpoint: StoredCheckpoint, changes: StateChanges, options?: SignalOption & {
|
|
15
|
+
readonly write?: never;
|
|
16
|
+
}): Promise<void>;
|
|
17
|
+
list(consumerGroup: string, options?: SignalOption & {
|
|
18
|
+
readonly stream?: string;
|
|
19
|
+
}): AsyncIterable<CheckpointSummary>;
|
|
20
|
+
reset(consumerGroup: string, target: {
|
|
21
|
+
readonly stream: string;
|
|
22
|
+
readonly partition?: string;
|
|
23
|
+
}, options?: SignalOption): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=memory-checkpoint-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-checkpoint-store.d.ts","sourceRoot":"","sources":["../src/memory-checkpoint-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAA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ACT,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,EAChE,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,IAAI,CAAC,CAYf;CAeF"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { FencingToken } from '@zukhruf/fencing';
|
|
2
|
+
import { CheckpointFencedError } from './errors.js';
|
|
3
|
+
/**
|
|
4
|
+
* Keeps checkpoints in the memory of this process (ADR 0011). A commit has no
|
|
5
|
+
* transaction for an output, so it takes no `write`.
|
|
6
|
+
*/
|
|
7
|
+
export class MemoryCheckpointStore {
|
|
8
|
+
#rows = new Map();
|
|
9
|
+
async claim(key, options) {
|
|
10
|
+
options?.signal?.throwIfAborted();
|
|
11
|
+
const row = this.#row(key);
|
|
12
|
+
row.epoch += 1n;
|
|
13
|
+
return new FencingToken(row.epoch);
|
|
14
|
+
}
|
|
15
|
+
async read(key, options) {
|
|
16
|
+
options?.signal?.throwIfAborted();
|
|
17
|
+
return this.#rows.get(id(key))?.checkpoint;
|
|
18
|
+
}
|
|
19
|
+
async get(key, state, keys, options) {
|
|
20
|
+
options?.signal?.throwIfAborted();
|
|
21
|
+
const values = this.#rows.get(id(key))?.states.get(state);
|
|
22
|
+
const found = new Map();
|
|
23
|
+
for (const name of keys) {
|
|
24
|
+
const value = values?.get(name);
|
|
25
|
+
if (value !== undefined)
|
|
26
|
+
found.set(name, value);
|
|
27
|
+
}
|
|
28
|
+
return found;
|
|
29
|
+
}
|
|
30
|
+
async *scan(key, state, options) {
|
|
31
|
+
options?.signal?.throwIfAborted();
|
|
32
|
+
const values = this.#rows.get(id(key))?.states.get(state);
|
|
33
|
+
if (values !== undefined)
|
|
34
|
+
yield* [...values];
|
|
35
|
+
}
|
|
36
|
+
async commit(key, epoch, checkpoint, changes, options) {
|
|
37
|
+
options?.signal?.throwIfAborted();
|
|
38
|
+
const row = this.#rows.get(id(key));
|
|
39
|
+
if (row === undefined || row.epoch !== epoch.value)
|
|
40
|
+
throw new CheckpointFencedError(key, epoch);
|
|
41
|
+
for (const name of changes.cleared)
|
|
42
|
+
row.states.delete(name);
|
|
43
|
+
for (const [name, keys] of changes.deleted) {
|
|
44
|
+
const values = row.states.get(name);
|
|
45
|
+
for (const deleted of keys)
|
|
46
|
+
values?.delete(deleted);
|
|
47
|
+
}
|
|
48
|
+
for (const [name, values] of changes.set) {
|
|
49
|
+
const stored = row.states.get(name) ?? new Map();
|
|
50
|
+
for (const [value, json] of values)
|
|
51
|
+
stored.set(value, json);
|
|
52
|
+
row.states.set(name, stored);
|
|
53
|
+
}
|
|
54
|
+
row.checkpoint = checkpoint;
|
|
55
|
+
}
|
|
56
|
+
async *list(consumerGroup, options) {
|
|
57
|
+
options?.signal?.throwIfAborted();
|
|
58
|
+
for (const row of this.#rows.values()) {
|
|
59
|
+
const { stream, partition } = row.key;
|
|
60
|
+
if (row.key.consumerGroup !== consumerGroup)
|
|
61
|
+
continue;
|
|
62
|
+
if (row.checkpoint === undefined)
|
|
63
|
+
continue;
|
|
64
|
+
if (options?.stream !== undefined && stream !== options.stream)
|
|
65
|
+
continue;
|
|
66
|
+
yield {
|
|
67
|
+
stream,
|
|
68
|
+
partition,
|
|
69
|
+
checkpointId: row.checkpoint.checkpointId,
|
|
70
|
+
epoch: new FencingToken(row.epoch),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async reset(consumerGroup, target, options) {
|
|
75
|
+
options?.signal?.throwIfAborted();
|
|
76
|
+
for (const row of this.#rows.values()) {
|
|
77
|
+
const { stream, partition } = row.key;
|
|
78
|
+
if (row.key.consumerGroup !== consumerGroup)
|
|
79
|
+
continue;
|
|
80
|
+
if (stream !== target.stream)
|
|
81
|
+
continue;
|
|
82
|
+
if (target.partition !== undefined && partition !== target.partition)
|
|
83
|
+
continue;
|
|
84
|
+
row.epoch += 1n;
|
|
85
|
+
row.checkpoint = undefined;
|
|
86
|
+
row.states.clear();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
#row(key) {
|
|
90
|
+
const rowId = id(key);
|
|
91
|
+
const existing = this.#rows.get(rowId);
|
|
92
|
+
if (existing !== undefined)
|
|
93
|
+
return existing;
|
|
94
|
+
const row = {
|
|
95
|
+
key,
|
|
96
|
+
epoch: 0n,
|
|
97
|
+
checkpoint: undefined,
|
|
98
|
+
states: new Map(),
|
|
99
|
+
};
|
|
100
|
+
this.#rows.set(rowId, row);
|
|
101
|
+
return row;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
function id(key) {
|
|
105
|
+
return JSON.stringify([key.consumerGroup, key.stream, key.partition]);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=memory-checkpoint-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-checkpoint-store.js","sourceRoot":"","sources":["../src/memory-checkpoint-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAWhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AASpD;;;GAGG;AACH,MAAM,OAAO,qBAAqB;IACvB,KAAK,GAAG,IAAI,GAAG,EAAe,CAAC;IAExC,KAAK,CAAC,KAAK,CACT,GAAkB,EAClB,OAAsB;QAEtB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC3B,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,IAAI,CACR,GAAkB,EAClB,OAAsB;QAEtB,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC,KAAK,C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GAAG,GAAQ;YACf,GAAG;YACH,KAAK,EAAE,EAAE;YACT,UAAU,EAAE,SAAS;YACrB,MAAM,EAAE,IAAI,GAAG,EAAE;SAClB,CAAC;QACF,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC;IACb,CAAC;CACF;AAED,SAAS,EAAE,CAAC,GAAkB;IAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FencingToken } from '@zukhruf/fencing';
|
|
2
|
+
import type { CheckpointStore } from './checkpoint-store.ts';
|
|
3
|
+
import type { Checkpoint, CheckpointKey, Format, SignalOption } from './checkpoint.ts';
|
|
4
|
+
import { type MapState } from './map-state.ts';
|
|
5
|
+
/**
|
|
6
|
+
* What a claim gives (ADR 0005): the checkpoint key, the epoch of the claim,
|
|
7
|
+
* the checkpoint that the claim read, the map states and the commit.
|
|
8
|
+
*/
|
|
9
|
+
export declare class PartitionContext<P, W> {
|
|
10
|
+
#private;
|
|
11
|
+
readonly consumerGroup: string;
|
|
12
|
+
readonly stream: string;
|
|
13
|
+
readonly partition: string;
|
|
14
|
+
readonly epoch: FencingToken;
|
|
15
|
+
/**
|
|
16
|
+
* The checkpoint that the claim read, or undefined when the partition had
|
|
17
|
+
* none. A commit gives the new checkpoint.
|
|
18
|
+
*/
|
|
19
|
+
readonly checkpoint: Checkpoint<P> | undefined;
|
|
20
|
+
constructor(store: CheckpointStore<W>, key: CheckpointKey, epoch: FencingToken, format: Format<P>, checkpoint: Checkpoint<P> | undefined);
|
|
21
|
+
/**
|
|
22
|
+
* The map state of `name` in this partition (ADR 0006). Each call gives a
|
|
23
|
+
* view over the same values and changes, read and written with `format`.
|
|
24
|
+
*/
|
|
25
|
+
state<V>(name: string, format: Format<V>): MapState<V>;
|
|
26
|
+
/**
|
|
27
|
+
* Saves the position, the changes of each map state and the next checkpoint
|
|
28
|
+
* id, all of them or none (ADR 0007). With `write`, the store runs it in the
|
|
29
|
+
* same transaction, after it checks the epoch. A commit that throws keeps
|
|
30
|
+
* the changes, so that a retry commits them.
|
|
31
|
+
*/
|
|
32
|
+
commit(position: P, options?: SignalOption & {
|
|
33
|
+
readonly write?: W;
|
|
34
|
+
}): Promise<Checkpoint<P>>;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=partition-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partition-context.d.ts","sourceRoot":"","sources":["../src/partition-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EACV,UAAU,EACV,aAAa,EACb,MAAM,EACN,YAAY,EAGb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,KAAK,QAAQ,EAGd,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,qBAAa,gBAAgB,CAAC,CAAC,EAAE,CAAC;;IAChC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAO/C,YACE,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,EACzB,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EACjB,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,EAWtC;IAED;;;OAGG;IACH,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAQrD;IAED;;;;;OAKG;IACG,MAAM,CACV,QAAQ,EAAE,CAAC,EACX,OAAO,CAAC,EAAE,YAAY,GAAG;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;KAAE,GAC9C,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAiBxB;CAmBF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { MapStateView, } from './map-state.js';
|
|
2
|
+
/**
|
|
3
|
+
* What a claim gives (ADR 0005): the checkpoint key, the epoch of the claim,
|
|
4
|
+
* the checkpoint that the claim read, the map states and the commit.
|
|
5
|
+
*/
|
|
6
|
+
export class PartitionContext {
|
|
7
|
+
consumerGroup;
|
|
8
|
+
stream;
|
|
9
|
+
partition;
|
|
10
|
+
epoch;
|
|
11
|
+
/**
|
|
12
|
+
* The checkpoint that the claim read, or undefined when the partition had
|
|
13
|
+
* none. A commit gives the new checkpoint.
|
|
14
|
+
*/
|
|
15
|
+
checkpoint;
|
|
16
|
+
#store;
|
|
17
|
+
#key;
|
|
18
|
+
#format;
|
|
19
|
+
#pending = new Map();
|
|
20
|
+
#checkpointId;
|
|
21
|
+
constructor(store, key, epoch, format, checkpoint) {
|
|
22
|
+
this.#store = store;
|
|
23
|
+
this.#key = key;
|
|
24
|
+
this.consumerGroup = key.consumerGroup;
|
|
25
|
+
this.stream = key.stream;
|
|
26
|
+
this.partition = key.partition;
|
|
27
|
+
this.epoch = epoch;
|
|
28
|
+
this.#format = format;
|
|
29
|
+
this.checkpoint = checkpoint;
|
|
30
|
+
this.#checkpointId = checkpoint?.checkpointId ?? 0;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The map state of `name` in this partition (ADR 0006). Each call gives a
|
|
34
|
+
* view over the same values and changes, read and written with `format`.
|
|
35
|
+
*/
|
|
36
|
+
state(name, format) {
|
|
37
|
+
return new MapStateView(this.#store, this.#key, name, format, this.#pending);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Saves the position, the changes of each map state and the next checkpoint
|
|
41
|
+
* id, all of them or none (ADR 0007). With `write`, the store runs it in the
|
|
42
|
+
* same transaction, after it checks the epoch. A commit that throws keeps
|
|
43
|
+
* the changes, so that a retry commits them.
|
|
44
|
+
*/
|
|
45
|
+
async commit(position, options) {
|
|
46
|
+
options?.signal?.throwIfAborted();
|
|
47
|
+
const checkpointId = this.#checkpointId + 1;
|
|
48
|
+
await this.#store.commit(this.#key, this.epoch, {
|
|
49
|
+
checkpointId,
|
|
50
|
+
version: this.#format.version,
|
|
51
|
+
json: this.#format.encode(position),
|
|
52
|
+
}, this.#changes(), options);
|
|
53
|
+
this.#pending.clear();
|
|
54
|
+
this.#checkpointId = checkpointId;
|
|
55
|
+
return { position, checkpointId };
|
|
56
|
+
}
|
|
57
|
+
#changes() {
|
|
58
|
+
const cleared = new Set();
|
|
59
|
+
const deleted = new Map();
|
|
60
|
+
const set = new Map();
|
|
61
|
+
for (const [name, pending] of this.#pending) {
|
|
62
|
+
if (pending.kind === 'replace')
|
|
63
|
+
cleared.add(name);
|
|
64
|
+
const removed = new Set();
|
|
65
|
+
const written = new Map();
|
|
66
|
+
for (const [key, value] of pending.values) {
|
|
67
|
+
if (value === null)
|
|
68
|
+
removed.add(key);
|
|
69
|
+
else
|
|
70
|
+
written.set(key, value);
|
|
71
|
+
}
|
|
72
|
+
if (removed.size > 0)
|
|
73
|
+
deleted.set(name, removed);
|
|
74
|
+
if (written.size > 0)
|
|
75
|
+
set.set(name, written);
|
|
76
|
+
}
|
|
77
|
+
return { cleared, deleted, set };
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=partition-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partition-context.js","sourceRoot":"","sources":["../src/partition-context.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,YAAY,GAEb,MAAM,gBAAgB,CAAC;AAExB;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAClB,aAAa,CAAS;IACtB,MAAM,CAAS;IACf,SAAS,CAAS;IAClB,KAAK,CAAe;IAC7B;;;OAGG;IACM,UAAU,CAA4B;IACtC,MAAM,CAAqB;IAC3B,IAAI,CAAgB;IACpB,OAAO,CAAY;IACnB,QAAQ,GAAG,IAAI,GAAG,EAA0B,CAAC;IACtD,aAAa,CAAS;IAEtB,YACE,KAAyB,EACzB,GAAkB,EAClB,KAAmB,EACnB,MAAiB,EACjB,UAAqC;QAErC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;QAChB,IAAI,CAAC,aAAa,GAAG,GAAG,CAAC,aAAa,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;QACzB,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,UAAU,EAAE,YAAY,IAAI,CAAC,CAAC;IACrD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAI,IAAY,EAAE,MAAiB;QACtC,OAAO,IAAI,YAAY,CACrB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,IAAI,EACT,IAAI,EACJ,MAAM,EACN,IAAI,CAAC,QAAQ,CACd,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACV,QAAW,EACX,OAA+C;QAE/C,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;QAClC,MAAM,YAAY,GAAG,IA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CAAC,CAAC;YACjD,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC;gBAAE,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;IACnC,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zukhruf/checkpoint",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.8.165",
|
|
4
|
+
"description": "Keep how far a reader of a stream got: a checkpoint for each consumer group, stream and partition, with an opaque versioned position and map states that commit all or nothing, fenced against older claims, in memory, SQLite, Postgres or SQL Server.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/JanuaryLabs/zukhruf",
|
|
9
|
+
"directory": "packages/checkpoint"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/JanuaryLabs/zukhruf/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/JanuaryLabs/zukhruf/tree/main/packages/checkpoint#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"checkpoint",
|
|
17
|
+
"stream",
|
|
18
|
+
"offset",
|
|
19
|
+
"consumer-group",
|
|
20
|
+
"partition",
|
|
21
|
+
"resume",
|
|
22
|
+
"fencing",
|
|
23
|
+
"state"
|
|
24
|
+
],
|
|
25
|
+
"type": "module",
|
|
26
|
+
"exports": {
|
|
27
|
+
"./package.json": "./package.json",
|
|
28
|
+
".": {
|
|
29
|
+
"@zukhruf/source": "./src/index.ts",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"!dist/spec/**",
|
|
38
|
+
"!**/*.tsbuildinfo",
|
|
39
|
+
"!**/*.test.*"
|
|
40
|
+
],
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@zukhruf/fencing": "^0.8.165"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@zukhruf/parameterized-test": "^0.8.165"
|
|
49
|
+
}
|
|
50
|
+
}
|