tapeworm_persistence_store_hybrid 1.0.2 → 1.1.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/CHANGELOG.md +17 -0
- package/README +1 -1
- package/dist/HybridPartition.d.ts +22 -22
- package/dist/HybridPartition.d.ts.map +1 -0
- package/dist/HybridPartition.js +127 -127
- package/dist/HybridPartition.js.map +1 -1
- package/dist/HybridPersistence.d.ts +39 -38
- package/dist/HybridPersistence.d.ts.map +1 -0
- package/dist/HybridPersistence.js +48 -93
- package/dist/HybridPersistence.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +2 -24
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +2 -2
- package/package.json +36 -39
- package/src/HybridPartition.ts +158 -162
- package/src/HybridPersistence.ts +78 -82
- package/src/index.ts +4 -4
- package/src/utils.ts +2 -25
- package/vitest.config.ts +15 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# tapeworm_persistence_store_hybrid
|
|
2
|
+
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 855c605: Convert monorepo to TypeScript with full type definitions
|
|
8
|
+
|
|
9
|
+
- Convert all packages from JavaScript to TypeScript with complete type annotations
|
|
10
|
+
- Add shared type system (IBaseEvent, ICommit, ISnapshot, IPersistencePartition)
|
|
11
|
+
- Migrate all test suites to vitest
|
|
12
|
+
- Add CJS backward-compatibility shims to preserve existing require() API
|
|
13
|
+
- Fix \_partitions initialization bug and indexeddb loadSnapshot error handler
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Upgrade packages to fix vulnerabilities.
|
package/README
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
#tapeworm_persistence_store_hybrid
|
|
1
|
+
#tapeworm_persistence_store_hybrid
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import BluebirdPromise from 'bluebird';
|
|
2
|
-
import {
|
|
3
|
-
import { LoggingOptions, Partition, queryStreamCallback, truncateStreamFromCallback } from './HybridPersistence';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
private
|
|
7
|
-
private
|
|
8
|
-
private
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import BluebirdPromise from 'bluebird';
|
|
2
|
+
import type { ICommit, ISnapshot } from 'tapeworm';
|
|
3
|
+
import { LoggingOptions, Partition, queryStreamCallback, truncateStreamFromCallback } from './HybridPersistence';
|
|
4
|
+
declare class HybridPartition implements Partition {
|
|
5
|
+
private localPartition;
|
|
6
|
+
private remotePartition;
|
|
7
|
+
private snapshotLifeTime;
|
|
8
|
+
private loggingOptions;
|
|
9
|
+
constructor(localPartition: Partition, remotePartition: Partition, autoCleanLocalPartition: boolean, snapshotLifeTime: number, loggingOptions: LoggingOptions);
|
|
10
|
+
private cleanPartition;
|
|
11
|
+
open(): BluebirdPromise<this>;
|
|
12
|
+
append(commit: ICommit): BluebirdPromise<ICommit<import("tapeworm").IBaseEvent>[]>;
|
|
13
|
+
storeSnapshot(streamId: string, snapshot: ISnapshot['snapshot'], version: number): BluebirdPromise<void>;
|
|
14
|
+
private checkIsSnapshotToOld;
|
|
15
|
+
loadSnapshot(streamId: string, callback?: (err: Error | null, snapshot: ISnapshot) => void): BluebirdPromise<ISnapshot>;
|
|
16
|
+
queryStream(streamId: string, fromEventSequence?: number | queryStreamCallback, callback?: queryStreamCallback): BluebirdPromise<ICommit<import("tapeworm").IBaseEvent>[]>;
|
|
17
|
+
removeSnapshot(streamId: string): BluebirdPromise<void>;
|
|
18
|
+
truncateStreamFrom(streamId: string, commitSequence: number, remove: boolean | truncateStreamFromCallback, callback?: truncateStreamFromCallback): BluebirdPromise<void>;
|
|
19
|
+
applyCommitHeader(streamId: string, commit: ICommit, remove: any, callback: () => void): BluebirdPromise<void>;
|
|
20
|
+
}
|
|
21
|
+
export default HybridPartition;
|
|
22
|
+
//# sourceMappingURL=HybridPartition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HybridPartition.d.ts","sourceRoot":"","sources":["../src/HybridPartition.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAOjH,cAAM,eAAgB,YAAW,SAAS;IAWtC,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,eAAe;IAEvB,OAAO,CAAC,gBAAgB;IAb1B,OAAO,CAAC,cAAc,CAAiB;gBAU7B,cAAc,EAAE,SAAS,EACzB,eAAe,EAAE,SAAS,EAClC,uBAAuB,EAAE,OAAO,EACxB,gBAAgB,EAAE,MAAM,EAChC,cAAc,EAAE,cAAc;IAsBhC,OAAO,CAAC,cAAc;IAYtB,IAAI;IAIJ,MAAM,CAAC,MAAM,EAAE,OAAO;IAItB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,UAAU,CAAC,EAAE,OAAO,EAAE,MAAM;IAIhF,OAAO,CAAC,oBAAoB;IAkB5B,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,GAAG,IAAI,EAAE,QAAQ,EAAE,SAAS,KAAK,IAAI;IAoC1F,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,mBAAmB,EAAE,QAAQ,CAAC,EAAE,mBAAmB;IAoB9G,cAAc,CAAC,QAAQ,EAAE,MAAM;IAI/B,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,0BAA0B,EAAE,QAAQ,CAAC,EAAE,0BAA0B;IAIhJ,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,IAAI;CAGvF;AAED,eAAe,eAAe,CAAC"}
|
package/dist/HybridPartition.js
CHANGED
|
@@ -1,128 +1,128 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
this.
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
snapshotIdsToRemove.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
exports
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
7
|
+
const slf_1 = require("slf");
|
|
8
|
+
const log = slf_1.LoggerFactory.getLogger('tapeworm-persistence-hybrid:hybrid-partition');
|
|
9
|
+
const DEFAULT_LOAD_SNAPSHOT_MAX_TIME = 10;
|
|
10
|
+
class HybridPartition {
|
|
11
|
+
localPartition;
|
|
12
|
+
remotePartition;
|
|
13
|
+
snapshotLifeTime;
|
|
14
|
+
loggingOptions;
|
|
15
|
+
constructor(localPartition, remotePartition, autoCleanLocalPartition, snapshotLifeTime, loggingOptions) {
|
|
16
|
+
this.localPartition = localPartition;
|
|
17
|
+
this.remotePartition = remotePartition;
|
|
18
|
+
this.snapshotLifeTime = snapshotLifeTime;
|
|
19
|
+
this.loggingOptions = loggingOptions;
|
|
20
|
+
if (!this.loggingOptions.loadSnapshotMaxTime) {
|
|
21
|
+
this.loggingOptions.loadSnapshotMaxTime = DEFAULT_LOAD_SNAPSHOT_MAX_TIME;
|
|
22
|
+
}
|
|
23
|
+
if (autoCleanLocalPartition) {
|
|
24
|
+
if (!localPartition.querySnapshotsOlderThanMaxDate) {
|
|
25
|
+
throw new Error('Unable to start auto clean of local partition since it does not support it.');
|
|
26
|
+
}
|
|
27
|
+
log.info('Starting auto clean of local partition');
|
|
28
|
+
setInterval(() => {
|
|
29
|
+
this.cleanPartition();
|
|
30
|
+
}, 1000 * 60 * 30);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
cleanPartition() {
|
|
34
|
+
log.info('Auto cleaning partition');
|
|
35
|
+
const snapshotTTLDate = new Date();
|
|
36
|
+
snapshotTTLDate.setMinutes(snapshotTTLDate.getMinutes() - this.snapshotLifeTime);
|
|
37
|
+
this.localPartition.querySnapshotsOlderThanMaxDate(snapshotTTLDate.toISOString()).then((snapshots) => {
|
|
38
|
+
log.info('cleaning %s snapshots', snapshots.length);
|
|
39
|
+
const snapshotIdsToRemove = snapshots.map((snapshot) => snapshot.id);
|
|
40
|
+
this.localPartition.removeSnapshots(snapshotIdsToRemove);
|
|
41
|
+
snapshotIdsToRemove.forEach((snapshotId) => this.localPartition.truncateStreamFrom(snapshotId, 0, true));
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
open() {
|
|
45
|
+
return bluebird_1.default.resolve(this);
|
|
46
|
+
}
|
|
47
|
+
append(commit) {
|
|
48
|
+
return this.localPartition.append(commit);
|
|
49
|
+
}
|
|
50
|
+
storeSnapshot(streamId, snapshot, version) {
|
|
51
|
+
return this.localPartition.storeSnapshot(streamId, snapshot, version);
|
|
52
|
+
}
|
|
53
|
+
checkIsSnapshotToOld(snapshot) {
|
|
54
|
+
if (!snapshot) {
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
if (snapshot.storedDateTime) {
|
|
58
|
+
const storedDateEpoch = new Date(snapshot.storedDateTime).getTime();
|
|
59
|
+
const nowEpoch = new Date().getTime();
|
|
60
|
+
const elapsedTimeInMilliSeconds = nowEpoch - storedDateEpoch;
|
|
61
|
+
const snapshotLifetimeMilliSeconds = this.snapshotLifeTime * 60 * 1000;
|
|
62
|
+
return elapsedTimeInMilliSeconds > snapshotLifetimeMilliSeconds;
|
|
63
|
+
}
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
loadSnapshot(streamId, callback) {
|
|
67
|
+
const startTime = Date.now();
|
|
68
|
+
return new bluebird_1.default((resolve) => {
|
|
69
|
+
this.localPartition.loadSnapshot(streamId).then((localSnapshot) => {
|
|
70
|
+
const isSnapshotToOld = this.checkIsSnapshotToOld(localSnapshot);
|
|
71
|
+
if (localSnapshot && !isSnapshotToOld) {
|
|
72
|
+
log.info('loadSnapshot: Using local snapshot');
|
|
73
|
+
callback?.(null, localSnapshot);
|
|
74
|
+
resolve(localSnapshot);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
this.remotePartition
|
|
78
|
+
.loadSnapshot(streamId)
|
|
79
|
+
.then((remoteSnapshot) => {
|
|
80
|
+
log.info('loadSnapshot: Using remote snapshot');
|
|
81
|
+
if (remoteSnapshot) {
|
|
82
|
+
this.localPartition.storeSnapshot(remoteSnapshot.id, remoteSnapshot.snapshot, remoteSnapshot.version);
|
|
83
|
+
this.localPartition.truncateStreamFrom(remoteSnapshot.id, 0, true);
|
|
84
|
+
callback?.(null, remoteSnapshot);
|
|
85
|
+
}
|
|
86
|
+
resolve(remoteSnapshot);
|
|
87
|
+
})
|
|
88
|
+
.catch((error) => {
|
|
89
|
+
log.warn('Failed to load snapshot with stream id %s from remote partition', streamId);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}).finally(() => {
|
|
93
|
+
const endTime = Date.now();
|
|
94
|
+
const queryTime = (endTime - startTime) / 1000;
|
|
95
|
+
if (this.loggingOptions.loggingEnabled && queryTime > this.loggingOptions.loadSnapshotMaxTime) {
|
|
96
|
+
log.warn('Loading snapshot with id %s, took %s seconds. Allowed max time is %s seconds.', streamId, queryTime, this.loggingOptions.loadSnapshotMaxTime);
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
queryStream(streamId, fromEventSequence, callback) {
|
|
101
|
+
log.debug('queryStream, streamId %s ,fromEventSequence %s', streamId, fromEventSequence);
|
|
102
|
+
return new bluebird_1.default((resolve) => {
|
|
103
|
+
this.localPartition.loadSnapshot(streamId).then((localSnapshot) => {
|
|
104
|
+
let currentPartition = this.localPartition;
|
|
105
|
+
const isSnapshotToOld = this.checkIsSnapshotToOld(localSnapshot);
|
|
106
|
+
if (!localSnapshot || isSnapshotToOld) {
|
|
107
|
+
currentPartition = this.remotePartition;
|
|
108
|
+
}
|
|
109
|
+
currentPartition.queryStream(streamId, fromEventSequence).then((queryStream) => {
|
|
110
|
+
callback?.(null, queryStream);
|
|
111
|
+
resolve(queryStream);
|
|
112
|
+
return;
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
removeSnapshot(streamId) {
|
|
118
|
+
return this.localPartition.removeSnapshot(streamId);
|
|
119
|
+
}
|
|
120
|
+
truncateStreamFrom(streamId, commitSequence, remove, callback) {
|
|
121
|
+
return this.localPartition.truncateStreamFrom(streamId, commitSequence, remove, callback);
|
|
122
|
+
}
|
|
123
|
+
applyCommitHeader(streamId, commit, remove, callback) {
|
|
124
|
+
return this.localPartition.applyCommitHeader(streamId, commit, remove, callback);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.default = HybridPartition;
|
|
128
128
|
//# sourceMappingURL=HybridPartition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HybridPartition.js","sourceRoot":"","sources":["../src/HybridPartition.ts"],"names":[],"mappings":";;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"HybridPartition.js","sourceRoot":"","sources":["../src/HybridPartition.ts"],"names":[],"mappings":";;;;;AAAA,wDAAuC;AAGvC,6BAAoC;AAEpC,MAAM,GAAG,GAAG,mBAAa,CAAC,SAAS,CAAC,8CAA8C,CAAC,CAAC;AAEpF,MAAM,8BAA8B,GAAG,EAAE,CAAC;AAE1C,MAAM,eAAe;IAWT;IACA;IAEA;IAbF,cAAc,CAAiB;IASvC,YACU,cAAyB,EACzB,eAA0B,EAClC,uBAAgC,EACxB,gBAAwB,EAChC,cAA8B;QAJtB,mBAAc,GAAd,cAAc,CAAW;QACzB,oBAAe,GAAf,eAAe,CAAW;QAE1B,qBAAgB,GAAhB,gBAAgB,CAAQ;QAGhC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,mBAAmB,EAAE,CAAC;YAC7C,IAAI,CAAC,cAAc,CAAC,mBAAmB,GAAG,8BAA8B,CAAC;QAC3E,CAAC;QAED,IAAI,uBAAuB,EAAE,CAAC;YAC5B,IAAI,CAAC,cAAc,CAAC,8BAA8B,EAAE,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,6EAA6E,CAAC,CAAC;YACjG,CAAC;YAED,GAAG,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;YACnD,WAAW,CACT,GAAG,EAAE;gBACH,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,CAAC,EACD,IAAI,GAAG,EAAE,GAAG,EAAE,CACf,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,cAAc;QACpB,GAAG,CAAC,IAAI,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AC;oBACtC,gBAAgB,GAAG,IAAI,CAAC,eAAe,CAAC;gBAC1C,CAAC;gBAED,gBAAgB,CAAC,WAAW,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE;oBAC7E,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;oBAC9B,OAAO,CAAC,WAAW,CAAC,CAAC;oBACrB,OAAO;gBACT,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED,cAAc,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;IACtD,CAAC;IAED,kBAAkB,CAAC,QAAgB,EAAE,cAAsB,EAAE,MAA4C,EAAE,QAAqC;QAC9I,OAAO,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC5F,CAAC;IAED,iBAAiB,CAAC,QAAgB,EAAE,MAAe,EAAE,MAAW,EAAE,QAAoB;QACpF,OAAO,IAAI,CAAC,cAAc,CAAC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACnF,CAAC;CACF;AAED,kBAAe,eAAe,CAAC"}
|
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
import BluebirdPromise from 'bluebird';
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
open: () => BluebirdPromise<Partition>;
|
|
9
|
-
storeSnapshot: (streamId: string, snapshot:
|
|
10
|
-
loadSnapshot: (streamId: string, callback?: (err: Error, snapshot:
|
|
11
|
-
queryStream: QueryStream;
|
|
12
|
-
append: (commit:
|
|
13
|
-
removeSnapshot: (streamId: string) => BluebirdPromise<void>;
|
|
14
|
-
removeSnapshots?: (streamIds: string[]) => BluebirdPromise<void>;
|
|
15
|
-
truncateStreamFrom: TruncateStreamFrom;
|
|
16
|
-
applyCommitHeader: (streamId: string, commit:
|
|
17
|
-
querySnapshotsOlderThanMaxDate?: (dateTime: string) => BluebirdPromise<
|
|
18
|
-
};
|
|
19
|
-
export interface LoggingOptions {
|
|
20
|
-
loggingEnabled: boolean;
|
|
21
|
-
loadSnapshotMaxTime?: number;
|
|
22
|
-
}
|
|
23
|
-
export
|
|
24
|
-
openPartition: (partitionId?: string) => BluebirdPromise<Partition>;
|
|
25
|
-
};
|
|
26
|
-
declare class HybridPersistence {
|
|
27
|
-
private localPersistence;
|
|
28
|
-
private remotePersistence;
|
|
29
|
-
private autoCleanLocalPartition;
|
|
30
|
-
private snapshotLifeTime;
|
|
31
|
-
private loggingOptions;
|
|
32
|
-
private partitions;
|
|
33
|
-
constructor(localPersistence: Persistence, remotePersistence: Persistence, autoCleanLocalPartition: boolean, snapshotLifeTime: number, loggingOptions: LoggingOptions);
|
|
34
|
-
openPartition(partitionId?: string): BluebirdPromise<unknown>;
|
|
35
|
-
private getPartition;
|
|
36
|
-
private setPartition;
|
|
37
|
-
}
|
|
38
|
-
export default HybridPersistence;
|
|
1
|
+
import BluebirdPromise from 'bluebird';
|
|
2
|
+
import type { ICommit, ISnapshot } from 'tapeworm';
|
|
3
|
+
export type truncateStreamFromCallback = (error: Error | null, result: Record<string, any>) => void;
|
|
4
|
+
type TruncateStreamFrom = (streamId: string, commitSequence: number, remove: boolean | truncateStreamFromCallback, callback?: truncateStreamFromCallback) => BluebirdPromise<void>;
|
|
5
|
+
export type queryStreamCallback = (err: Error | null, steam: ICommit[]) => void;
|
|
6
|
+
type QueryStream = (streamId: string, fromEventSequence?: number | queryStreamCallback, callback?: queryStreamCallback) => BluebirdPromise<ICommit[]>;
|
|
7
|
+
export type Partition = {
|
|
8
|
+
open: () => BluebirdPromise<Partition>;
|
|
9
|
+
storeSnapshot: (streamId: string, snapshot: ISnapshot['snapshot'], version: number) => BluebirdPromise<void>;
|
|
10
|
+
loadSnapshot: (streamId: string, callback?: (err: Error | null, snapshot: ISnapshot | undefined) => void) => BluebirdPromise<ISnapshot | undefined>;
|
|
11
|
+
queryStream: QueryStream;
|
|
12
|
+
append: (commit: ICommit) => BluebirdPromise<ICommit[]>;
|
|
13
|
+
removeSnapshot: (streamId: string) => BluebirdPromise<void>;
|
|
14
|
+
removeSnapshots?: (streamIds: string[]) => BluebirdPromise<void>;
|
|
15
|
+
truncateStreamFrom: TruncateStreamFrom;
|
|
16
|
+
applyCommitHeader: (streamId: string, commit: ICommit, remove: any, callback: () => void) => BluebirdPromise<void>;
|
|
17
|
+
querySnapshotsOlderThanMaxDate?: (dateTime: string) => BluebirdPromise<ISnapshot[]>;
|
|
18
|
+
};
|
|
19
|
+
export interface LoggingOptions {
|
|
20
|
+
loggingEnabled: boolean;
|
|
21
|
+
loadSnapshotMaxTime?: number;
|
|
22
|
+
}
|
|
23
|
+
export type Persistence = {
|
|
24
|
+
openPartition: (partitionId?: string) => BluebirdPromise<Partition>;
|
|
25
|
+
};
|
|
26
|
+
declare class HybridPersistence {
|
|
27
|
+
private localPersistence;
|
|
28
|
+
private remotePersistence;
|
|
29
|
+
private autoCleanLocalPartition;
|
|
30
|
+
private snapshotLifeTime;
|
|
31
|
+
private loggingOptions;
|
|
32
|
+
private partitions;
|
|
33
|
+
constructor(localPersistence: Persistence, remotePersistence: Persistence, autoCleanLocalPartition: boolean, snapshotLifeTime: number, loggingOptions: LoggingOptions);
|
|
34
|
+
openPartition(partitionId?: string): BluebirdPromise<unknown>;
|
|
35
|
+
private getPartition;
|
|
36
|
+
private setPartition;
|
|
37
|
+
}
|
|
38
|
+
export default HybridPersistence;
|
|
39
|
+
//# sourceMappingURL=HybridPersistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HybridPersistence.d.ts","sourceRoot":"","sources":["../src/HybridPersistence.ts"],"names":[],"mappings":"AA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2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
this.autoCleanLocalPartition = autoCleanLocalPartition;
|
|
50
|
-
this.snapshotLifeTime = snapshotLifeTime;
|
|
51
|
-
this.loggingOptions = loggingOptions;
|
|
52
|
-
this.partitions = {};
|
|
53
|
-
}
|
|
54
|
-
HybridPersistence.prototype.openPartition = function (partitionId) {
|
|
55
|
-
var _this = this;
|
|
56
|
-
if (partitionId === void 0) { partitionId = DEFAULT_PARTITION; }
|
|
57
|
-
return new bluebird_1["default"](function (resolve) { return __awaiter(_this, void 0, void 0, function () {
|
|
58
|
-
var partition, localPartition, remotePartition, newPartition_1;
|
|
59
|
-
return __generator(this, function (_a) {
|
|
60
|
-
switch (_a.label) {
|
|
61
|
-
case 0:
|
|
62
|
-
partition = this.getPartition(partitionId);
|
|
63
|
-
if (!partition) return [3, 1];
|
|
64
|
-
resolve(partition);
|
|
65
|
-
return [3, 4];
|
|
66
|
-
case 1: return [4, this.localPersistence.openPartition(partitionId)];
|
|
67
|
-
case 2:
|
|
68
|
-
localPartition = _a.sent();
|
|
69
|
-
return [4, this.remotePersistence.openPartition(partitionId)];
|
|
70
|
-
case 3:
|
|
71
|
-
remotePartition = _a.sent();
|
|
72
|
-
newPartition_1 = new HybridPartition_1["default"](localPartition, remotePartition, this.autoCleanLocalPartition, this.snapshotLifeTime, this.loggingOptions);
|
|
73
|
-
this.setPartition(partitionId, newPartition_1);
|
|
74
|
-
newPartition_1.open().then(function () {
|
|
75
|
-
resolve(newPartition_1);
|
|
76
|
-
});
|
|
77
|
-
_a.label = 4;
|
|
78
|
-
case 4: return [2];
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
}); });
|
|
82
|
-
};
|
|
83
|
-
HybridPersistence.prototype.getPartition = function (partitionId) {
|
|
84
|
-
if (partitionId === void 0) { partitionId = DEFAULT_PARTITION; }
|
|
85
|
-
return this.partitions[partitionId];
|
|
86
|
-
};
|
|
87
|
-
HybridPersistence.prototype.setPartition = function (partitionId, partition) {
|
|
88
|
-
this.partitions[partitionId || DEFAULT_PARTITION] = partition;
|
|
89
|
-
return partition;
|
|
90
|
-
};
|
|
91
|
-
return HybridPersistence;
|
|
92
|
-
}());
|
|
93
|
-
exports["default"] = HybridPersistence;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const bluebird_1 = __importDefault(require("bluebird"));
|
|
7
|
+
const HybridPartition_1 = __importDefault(require("./HybridPartition"));
|
|
8
|
+
const DEFAULT_PARTITION = 'master';
|
|
9
|
+
class HybridPersistence {
|
|
10
|
+
localPersistence;
|
|
11
|
+
remotePersistence;
|
|
12
|
+
autoCleanLocalPartition;
|
|
13
|
+
snapshotLifeTime;
|
|
14
|
+
loggingOptions;
|
|
15
|
+
partitions = {};
|
|
16
|
+
constructor(localPersistence, remotePersistence, autoCleanLocalPartition, snapshotLifeTime, loggingOptions) {
|
|
17
|
+
this.localPersistence = localPersistence;
|
|
18
|
+
this.remotePersistence = remotePersistence;
|
|
19
|
+
this.autoCleanLocalPartition = autoCleanLocalPartition;
|
|
20
|
+
this.snapshotLifeTime = snapshotLifeTime;
|
|
21
|
+
this.loggingOptions = loggingOptions;
|
|
22
|
+
}
|
|
23
|
+
openPartition(partitionId = DEFAULT_PARTITION) {
|
|
24
|
+
return new bluebird_1.default(async (resolve) => {
|
|
25
|
+
const partition = this.getPartition(partitionId);
|
|
26
|
+
if (partition) {
|
|
27
|
+
resolve(partition);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const localPartition = await this.localPersistence.openPartition(partitionId);
|
|
31
|
+
const remotePartition = await this.remotePersistence.openPartition(partitionId);
|
|
32
|
+
const newPartition = new HybridPartition_1.default(localPartition, remotePartition, this.autoCleanLocalPartition, this.snapshotLifeTime, this.loggingOptions);
|
|
33
|
+
this.setPartition(partitionId, newPartition);
|
|
34
|
+
newPartition.open().then(() => {
|
|
35
|
+
resolve(newPartition);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
getPartition(partitionId = DEFAULT_PARTITION) {
|
|
41
|
+
return this.partitions[partitionId];
|
|
42
|
+
}
|
|
43
|
+
setPartition(partitionId, partition) {
|
|
44
|
+
this.partitions[partitionId] = partition;
|
|
45
|
+
return partition;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.default = HybridPersistence;
|
|
94
49
|
//# sourceMappingURL=HybridPersistence.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HybridPersistence.js","sourceRoot":"","sources":["../src/HybridPersistence.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HybridPersistence.js","sourceRoot":"","sources":["../src/HybridPersistence.ts"],"names":[],"mappings":";;;;;AAAA,wDAAuC;AACvC,wEAAgD;AAoChD,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAEnC,MAAM,iBAAiB;IAIX;IAC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