tapeworm 0.5.0 → 0.6.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/LICENSE +22 -22
- package/README.md +332 -332
- package/biome.json +58 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/src/dispatch/dispatch_service.d.ts +8 -0
- package/dist/src/dispatch/dispatch_service.d.ts.map +1 -0
- package/dist/src/dispatch/dispatch_service.js +9 -0
- package/dist/src/dispatch/dispatch_service.js.map +1 -0
- package/dist/src/event.d.ts +10 -0
- package/dist/src/event.d.ts.map +1 -0
- package/dist/src/event.js +12 -0
- package/dist/src/event.js.map +1 -0
- package/dist/src/event_store.d.ts +29 -0
- package/dist/src/event_store.d.ts.map +1 -0
- package/dist/src/event_store.js +71 -0
- package/dist/src/event_store.js.map +1 -0
- package/dist/src/event_store_partition.d.ts +28 -0
- package/dist/src/event_store_partition.d.ts.map +1 -0
- package/dist/src/event_store_partition.js +130 -0
- package/dist/src/event_store_partition.js.map +1 -0
- package/dist/src/event_stream.d.ts +32 -0
- package/dist/src/event_stream.d.ts.map +1 -0
- package/dist/src/event_stream.js +142 -0
- package/dist/src/event_stream.js.map +1 -0
- package/dist/src/persistence/commit.d.ts +4 -0
- package/dist/src/persistence/commit.d.ts.map +1 -0
- package/dist/src/persistence/commit.js +11 -0
- package/dist/src/persistence/commit.js.map +1 -0
- package/dist/src/persistence/concurrency_error.d.ts +6 -0
- package/dist/src/persistence/concurrency_error.d.ts.map +1 -0
- package/dist/src/persistence/concurrency_error.js +13 -0
- package/dist/src/persistence/concurrency_error.js.map +1 -0
- package/dist/src/persistence/duplicate_commit_error.d.ts +6 -0
- package/dist/src/persistence/duplicate_commit_error.d.ts.map +1 -0
- package/dist/src/persistence/duplicate_commit_error.js +13 -0
- package/dist/src/persistence/duplicate_commit_error.js.map +1 -0
- package/dist/src/persistence/inmemory/inmemory_partition.d.ts +23 -0
- package/dist/src/persistence/inmemory/inmemory_partition.d.ts.map +1 -0
- package/dist/src/persistence/inmemory/inmemory_partition.js +138 -0
- package/dist/src/persistence/inmemory/inmemory_partition.js.map +1 -0
- package/dist/src/persistence/inmemory/inmemory_persistence.d.ts +13 -0
- package/dist/src/persistence/inmemory/inmemory_persistence.d.ts.map +1 -0
- package/dist/src/persistence/inmemory/inmemory_persistence.js +26 -0
- package/dist/src/persistence/inmemory/inmemory_persistence.js.map +1 -0
- package/dist/src/persistence/persistence_partition.d.ts +12 -0
- package/dist/src/persistence/persistence_partition.d.ts.map +1 -0
- package/dist/src/persistence/persistence_partition.js +21 -0
- package/dist/src/persistence/persistence_partition.js.map +1 -0
- package/dist/src/persistence/persistence_provider_template.d.ts +10 -0
- package/dist/src/persistence/persistence_provider_template.d.ts.map +1 -0
- package/dist/src/persistence/persistence_provider_template.js +11 -0
- package/dist/src/persistence/persistence_provider_template.js.map +1 -0
- package/dist/src/replication/master_replication_service.d.ts +7 -0
- package/dist/src/replication/master_replication_service.d.ts.map +1 -0
- package/dist/src/replication/master_replication_service.js +9 -0
- package/dist/src/replication/master_replication_service.js.map +1 -0
- package/dist/src/types.d.ts +68 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +3 -0
- package/dist/src/types.js.map +1 -0
- package/index.ts +21 -0
- package/package.json +44 -46
- package/scripts/postbuild.js +27 -0
- package/src/dispatch/dispatch_service.ts +14 -0
- package/src/event.ts +24 -0
- package/src/event_store.ts +82 -0
- package/src/event_store_partition.ts +270 -0
- package/src/event_stream.ts +184 -0
- package/src/persistence/commit.ts +24 -0
- package/src/persistence/concurrency_error.ts +16 -0
- package/src/persistence/duplicate_commit_error.ts +16 -0
- package/src/persistence/inmemory/inmemory_partition.ts +194 -0
- package/src/persistence/inmemory/inmemory_persistence.ts +35 -0
- package/src/persistence/persistence_partition.ts +34 -0
- package/src/persistence/persistence_provider_template.ts +20 -0
- package/src/replication/master_replication_service.ts +12 -0
- package/src/types.ts +128 -0
- package/test/event_partition.ts +151 -0
- package/test/event_store.ts +25 -0
- package/test/event_stream.ts +160 -0
- package/test/persistence/inmemory.ts +139 -0
- package/tsconfig.json +13 -0
- package/vitest.config.ts +13 -0
- package/.eslintrc +0 -4
- package/.travis.yml +0 -4
- package/checkstyle-result.xml +0 -1
- package/index.js +0 -1
- package/lib/dispatch/dispatch_service.js +0 -7
- package/lib/event.js +0 -10
- package/lib/event_store.js +0 -53
- package/lib/event_store_partition.js +0 -148
- package/lib/event_stream.js +0 -150
- package/lib/persistence/commit.js +0 -12
- package/lib/persistence/concurrency_error.js +0 -10
- package/lib/persistence/duplicate_commit_error.js +0 -10
- package/lib/persistence/inmemory/inmemory_partition.js +0 -146
- package/lib/persistence/inmemory/inmemory_persistence.js +0 -25
- package/lib/persistence/persistence_partition.js +0 -23
- package/lib/persistence/persistence_provider_template.js +0 -17
- package/lib/replication/master_replication_service.js +0 -7
- package/test/event_partition.js +0 -232
- package/test/event_store.js +0 -36
- package/test/event_stream.js +0 -214
- package/test/persistence/inmemory.js +0 -162
package/test/event_stream.js
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
var should = require('should');
|
|
2
|
-
var Promise = require('bluebird');
|
|
3
|
-
var uuid = require('uuid').v4;
|
|
4
|
-
|
|
5
|
-
var EventStore = require('..');
|
|
6
|
-
var EventStream = require('../lib/event_stream');
|
|
7
|
-
|
|
8
|
-
describe('event_stream', function () {
|
|
9
|
-
describe('#openStream', function (done) {
|
|
10
|
-
it('should return 0 commits for new stream', function (done) {
|
|
11
|
-
var es = new EventStore();
|
|
12
|
-
es.openPartition('location').call('openStream', '1').then(function (stream) {
|
|
13
|
-
stream.getCommittedEvents().length.should.equal(0);
|
|
14
|
-
done();
|
|
15
|
-
}).catch(function (err) {
|
|
16
|
-
done(err);
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
describe('#commit', function (done) {
|
|
21
|
-
it('should do nothing if nothing has been appended', function (done) {
|
|
22
|
-
var es = new EventStore();
|
|
23
|
-
es.openPartition('location').call('openStream', '1').then(function (stream) {
|
|
24
|
-
stream.commit(uuid());
|
|
25
|
-
stream.getCommittedEvents().length.should.equal(0);
|
|
26
|
-
done();
|
|
27
|
-
}).catch(function (err) {
|
|
28
|
-
done(err);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it('should call commit on partition', function (done) {
|
|
33
|
-
var mockPartition = {
|
|
34
|
-
called: false,
|
|
35
|
-
append: function (commit, callback) {
|
|
36
|
-
this.called = true;
|
|
37
|
-
return Promise.resolve().nodeify(callback);
|
|
38
|
-
},
|
|
39
|
-
_queryStream: function (streamId, callback) {
|
|
40
|
-
return Promise.resolve([]).nodeify(callback);
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
var stream = new EventStream(mockPartition, '11');
|
|
44
|
-
stream.append({ event: '123' });
|
|
45
|
-
stream.commit(uuid());
|
|
46
|
-
mockPartition.called.should.be.true;
|
|
47
|
-
done();
|
|
48
|
-
});
|
|
49
|
-
it('should keep track of uncommitted events', function (done) {
|
|
50
|
-
var es = new EventStore();
|
|
51
|
-
es.openPartition('location').call('openStream', '1').then(function (stream) {
|
|
52
|
-
stream.append({ event: '123' });
|
|
53
|
-
stream.getUncommittedEvents().length.should.equal(1);
|
|
54
|
-
done();
|
|
55
|
-
}).catch(function (err) {
|
|
56
|
-
done(err);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
it('should move uncommitted events to committed on commit', function (done) {
|
|
60
|
-
var es = new EventStore();
|
|
61
|
-
var stream;
|
|
62
|
-
es.openPartition('location').call('openStream', '1').then(function (stream1) {
|
|
63
|
-
stream = stream1;
|
|
64
|
-
stream.append({ event: '123' });
|
|
65
|
-
return stream.commit(uuid());
|
|
66
|
-
})
|
|
67
|
-
.then(function () {
|
|
68
|
-
stream.getUncommittedEvents().length.should.equal(0);
|
|
69
|
-
stream.getCommittedEvents().length.should.equal(1);
|
|
70
|
-
done();
|
|
71
|
-
}).catch(function (err) {
|
|
72
|
-
done(err);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
it('two events becomes one commit', function (done) {
|
|
76
|
-
var es = new EventStore();
|
|
77
|
-
var stream;
|
|
78
|
-
es.openPartition('location').call('openStream', '1').then(function (stream1) {
|
|
79
|
-
stream = stream1;
|
|
80
|
-
stream.append({ event: '123' });
|
|
81
|
-
stream.append({ event: '999' });
|
|
82
|
-
return stream.commit(uuid());
|
|
83
|
-
})
|
|
84
|
-
.then(function () {
|
|
85
|
-
stream.getCommittedEvents().length.should.equal(2);
|
|
86
|
-
stream._commitSequence.should.equal(0);
|
|
87
|
-
done();
|
|
88
|
-
}).catch(function (err) {
|
|
89
|
-
done(err);
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
it('two commits gets increasing commit sequence', function (done) {
|
|
93
|
-
var es = new EventStore();
|
|
94
|
-
var stream;
|
|
95
|
-
es.openPartition('location').call('openStream', '1').then(function (stream1) {
|
|
96
|
-
stream = stream1;
|
|
97
|
-
stream.append({ event: '123' });
|
|
98
|
-
stream.append({ event: '999' });
|
|
99
|
-
return stream.commit(uuid());
|
|
100
|
-
})
|
|
101
|
-
.then(function () {
|
|
102
|
-
stream.append({ event: '666' });
|
|
103
|
-
stream.append({ event: '777' });
|
|
104
|
-
return stream.commit(uuid());
|
|
105
|
-
})
|
|
106
|
-
.then(function () {
|
|
107
|
-
stream.getCommittedEvents().length.should.equal(4);
|
|
108
|
-
stream._commitSequence.should.equal(1);
|
|
109
|
-
done();
|
|
110
|
-
}).catch(function (err) {
|
|
111
|
-
done(err);
|
|
112
|
-
});
|
|
113
|
-
});
|
|
114
|
-
it('event stream writeOnly', function (done) {
|
|
115
|
-
var es = new EventStore();
|
|
116
|
-
var stream;
|
|
117
|
-
es.openPartition('location').then(function (partition) {
|
|
118
|
-
partition.openStream('1', true)
|
|
119
|
-
.then(function (stream1) {
|
|
120
|
-
stream = stream1;
|
|
121
|
-
stream.append({ event: '123' });
|
|
122
|
-
return stream.commit(uuid());
|
|
123
|
-
})
|
|
124
|
-
.then(function () {
|
|
125
|
-
stream._commitSequence.should.equal(0);
|
|
126
|
-
stream.append({ event: '666' });
|
|
127
|
-
stream.append({ event: '777' });
|
|
128
|
-
return stream.commit(uuid());
|
|
129
|
-
})
|
|
130
|
-
.then(function () {
|
|
131
|
-
stream._commitSequence.should.equal(1);
|
|
132
|
-
done();
|
|
133
|
-
})
|
|
134
|
-
.catch(function (err) {
|
|
135
|
-
done(err);
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
it('committed events should have increasing version', function (done) {
|
|
140
|
-
var es = new EventStore();
|
|
141
|
-
var stream;
|
|
142
|
-
es.openPartition('location').call('openStream', '1').then(function (stream1) {
|
|
143
|
-
stream = stream1;
|
|
144
|
-
stream.append({ event: '123' });
|
|
145
|
-
stream.append({ event: '999' });
|
|
146
|
-
return stream.commit(uuid());
|
|
147
|
-
})
|
|
148
|
-
.then(function () {
|
|
149
|
-
stream.append({ event: '666' });
|
|
150
|
-
stream.append({ event: '777' });
|
|
151
|
-
return stream.commit(uuid());
|
|
152
|
-
})
|
|
153
|
-
.then(function () {
|
|
154
|
-
stream.getCommittedEvents()[3].version.should.equal(3);
|
|
155
|
-
stream._version.should.equal(4);
|
|
156
|
-
done();
|
|
157
|
-
}).catch(function (err) {
|
|
158
|
-
done(err);
|
|
159
|
-
});
|
|
160
|
-
});
|
|
161
|
-
it('committed events should have increasing version (writeOnly)', function (done) {
|
|
162
|
-
var es = new EventStore();
|
|
163
|
-
var stream;
|
|
164
|
-
es.openPartition('location').then(function (partition) {
|
|
165
|
-
partition.openStream('1', true)
|
|
166
|
-
.then(function (stream1) {
|
|
167
|
-
stream = stream1;
|
|
168
|
-
stream.append({ event: '123' });
|
|
169
|
-
stream.append({ event: '999' });
|
|
170
|
-
return stream.commit(uuid());
|
|
171
|
-
})
|
|
172
|
-
.then(function () {
|
|
173
|
-
stream.append({ event: '666' });
|
|
174
|
-
stream.append({ event: '777' });
|
|
175
|
-
return stream.commit(uuid());
|
|
176
|
-
})
|
|
177
|
-
.then(function () {
|
|
178
|
-
stream._version.should.equal(4);
|
|
179
|
-
done();
|
|
180
|
-
})
|
|
181
|
-
.catch(function (err) {
|
|
182
|
-
done(err);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
});
|
|
186
|
-
it('published events should have increasing version', function (done) {
|
|
187
|
-
var commitCount = 0;
|
|
188
|
-
|
|
189
|
-
var es = new EventStore(null, function (commit) {
|
|
190
|
-
commit.events[0].should.have.property('version');
|
|
191
|
-
if (++commitCount == 2) {
|
|
192
|
-
done();
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
var stream;
|
|
196
|
-
es.openPartition('location').call('openStream', '1').then(function (stream1) {
|
|
197
|
-
stream = stream1;
|
|
198
|
-
stream.append({ event: '123' });
|
|
199
|
-
stream.append({ event: '999' });
|
|
200
|
-
return stream.commit(uuid());
|
|
201
|
-
})
|
|
202
|
-
.then(function () {
|
|
203
|
-
stream.append({ event: '666' });
|
|
204
|
-
stream.append({ event: '777' });
|
|
205
|
-
return stream.commit(uuid());
|
|
206
|
-
})
|
|
207
|
-
.then(function () {
|
|
208
|
-
stream.getCommittedEvents()[1].version.should.equal(1);
|
|
209
|
-
}).catch(function (err) {
|
|
210
|
-
done(err);
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
});
|
|
214
|
-
});
|
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
var should = require('should');
|
|
2
|
-
var uuid = require("uuid").v4;
|
|
3
|
-
var Promise = require("bluebird");
|
|
4
|
-
|
|
5
|
-
var Store = require('../../lib/persistence/inmemory/inmemory_persistence');
|
|
6
|
-
var Commit = require('../../lib/persistence/commit');
|
|
7
|
-
var Event = require('../../lib/event');
|
|
8
|
-
var PersistenceConcurrencyError = require('../../lib/persistence/concurrency_error');
|
|
9
|
-
var PersistenceDuplicateCommitError = require('../../lib/persistence/duplicate_commit_error');
|
|
10
|
-
|
|
11
|
-
describe('inmemory_persistence', function () {
|
|
12
|
-
describe('#commit', function () {
|
|
13
|
-
|
|
14
|
-
it('should accept a commit and store it', function (done) {
|
|
15
|
-
var store = new Store();
|
|
16
|
-
store.openPartition('1').then(function (partition) {
|
|
17
|
-
var events = [new Event(uuid(), 'type1', { test: 11 })];
|
|
18
|
-
var commit = new Commit(uuid(), 'master', '1', 0, events);
|
|
19
|
-
partition.append(commit).then(function () { return partition.queryAll() }).then(function (x) {
|
|
20
|
-
x.length.should.equal(1);
|
|
21
|
-
done();
|
|
22
|
-
}).catch(function (err) {
|
|
23
|
-
done(err);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('commit in one stream is not visible in other', function (done) {
|
|
29
|
-
var store = new Store();
|
|
30
|
-
store.openPartition('1').then(function (partition) {
|
|
31
|
-
var events = [new Event(uuid(), 'type1', { test: 11 })];
|
|
32
|
-
var commit = new Commit(uuid(), 'master', '1', 0, events);
|
|
33
|
-
partition.append(commit);
|
|
34
|
-
|
|
35
|
-
var events = [new Event(uuid(), 'type2', { test: 22 })];
|
|
36
|
-
var commit = new Commit(uuid(), 'master', '2', 0, events);
|
|
37
|
-
partition.append(commit);
|
|
38
|
-
|
|
39
|
-
Promise.join(partition.queryStream('1'), partition.queryStream('2'), function (r1, r2) {
|
|
40
|
-
r1.length.should.equal(1);
|
|
41
|
-
r2.length.should.equal(1);
|
|
42
|
-
done();
|
|
43
|
-
}).catch(function (err) {
|
|
44
|
-
done(err);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('two commits in one stream are visible', function () {
|
|
51
|
-
var store = new Store();
|
|
52
|
-
store.openPartition('1').then(function (partition) {
|
|
53
|
-
var events = [new Event(uuid(), 'type1', { test: 11 })];
|
|
54
|
-
var commit = new Commit(uuid(), 'master', '1', 0, events);
|
|
55
|
-
partition.append(commit);
|
|
56
|
-
var events = [new Event(uuid(), 'type2', { test: 22 })];
|
|
57
|
-
var commit = new Commit(uuid(), 'master', '1', 1, events);
|
|
58
|
-
partition.append(commit);
|
|
59
|
-
partition.queryAll().then(function (res) {
|
|
60
|
-
res.length.should.equal(2);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('should skip events', function () {
|
|
66
|
-
var store = new Store();
|
|
67
|
-
store.openPartition('1').then(function (partition) {
|
|
68
|
-
var events = [new Event(uuid(), 'type1', { test: 11 }), new Event(uuid(), 'type1', { test: 12})];
|
|
69
|
-
var commit = new Commit(uuid(), 'master', '1', 0, events);
|
|
70
|
-
partition.append(commit);
|
|
71
|
-
var events = [new Event(uuid(), 'type2', { test: 22 })];
|
|
72
|
-
var commit = new Commit(uuid(), 'master', '1', 1, events);
|
|
73
|
-
partition.append(commit);
|
|
74
|
-
partition.queryStream('1', 2).then(function (res) {
|
|
75
|
-
res.length.should.equal(1);
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
it('should skip events and split commit if inbetween', function () {
|
|
80
|
-
var store = new Store();
|
|
81
|
-
store.openPartition('1').then(function (partition) {
|
|
82
|
-
var events = [new Event(uuid(), 'type1', { test: 11 }), new Event(uuid(), 'type1', { test: 12})];
|
|
83
|
-
var commit = new Commit(uuid(), 'master', '1', 0, events);
|
|
84
|
-
partition.append(commit);
|
|
85
|
-
var events = [new Event(uuid(), 'type2', { test: 22 })];
|
|
86
|
-
var commit = new Commit(uuid(), 'master', '1', 1, events);
|
|
87
|
-
partition.append(commit);
|
|
88
|
-
partition.queryStream('1', 1).then(function (res) {
|
|
89
|
-
res.length.should.equal(2);
|
|
90
|
-
res[0].events.length.should.equal(1);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
});
|
|
95
|
-
describe('#concurrency', function () {
|
|
96
|
-
it('same commit sequence twice should throw', function (done) {
|
|
97
|
-
var store = new Store();
|
|
98
|
-
store.openPartition('1').then(function (partition) {
|
|
99
|
-
var events = [new Event(uuid(), 'type1', { test: 11 })];
|
|
100
|
-
var commit = new Commit(uuid(), 'master', '1', 0, events);
|
|
101
|
-
var commit2 = new Commit(uuid(), 'master', '1', 0, events);
|
|
102
|
-
return Promise.join(partition.append(commit), partition.append(commit2), function () {
|
|
103
|
-
done(new Error("Should have thrown concurrency error"));
|
|
104
|
-
});
|
|
105
|
-
}).catch(PersistenceConcurrencyError, function (err) {
|
|
106
|
-
done();
|
|
107
|
-
}).catch(function (err) {
|
|
108
|
-
console.log('err' + err);
|
|
109
|
-
done(err);
|
|
110
|
-
});
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
describe('#duplicateEvents', function () {
|
|
114
|
-
it('same commit twice should throw', function (done) {
|
|
115
|
-
var store = new Store();
|
|
116
|
-
store.openPartition('1').then(function (partition) {
|
|
117
|
-
var events = [new Event(uuid(), 'type1', { test: 11 })];
|
|
118
|
-
var commit = new Commit(uuid(), 'master', '1', 0, events);
|
|
119
|
-
partition.append(commit).then(function () {
|
|
120
|
-
return partition.append(commit);
|
|
121
|
-
})
|
|
122
|
-
.then(function () {
|
|
123
|
-
done(new Error("Should have DuplicateCommitError"));
|
|
124
|
-
}).catch(PersistenceDuplicateCommitError, function (err) {
|
|
125
|
-
done();
|
|
126
|
-
}).catch(function (err) {
|
|
127
|
-
done(err);
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
describe('#partition', function () {
|
|
133
|
-
it('getting the same partition twice should return same instance', function (done) {
|
|
134
|
-
var store = new Store();
|
|
135
|
-
Promise.join(store.openPartition('1'), store.openPartition('1'), function (p1, p2) {
|
|
136
|
-
p1.should.equal(p2);
|
|
137
|
-
done();
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
it('not indicating partition name should give master partition', function (done) {
|
|
141
|
-
var store = new Store();
|
|
142
|
-
Promise.join(store.openPartition(), store.openPartition('master'), function (p1, p2) {
|
|
143
|
-
p1.should.equal(p2);
|
|
144
|
-
done();
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
describe('#storeSnapshot', function () {
|
|
149
|
-
it('should return previously stored snapshot', function (done) {
|
|
150
|
-
var store = new Store();
|
|
151
|
-
store.openPartition('1').then(function (part) {
|
|
152
|
-
part.storeSnapshot('stream1', { iAmSnapshot: true }, 10).then(function (snapshot) {
|
|
153
|
-
part.loadSnapshot('stream1').then(function (newSnapshot) {
|
|
154
|
-
newSnapshot.should.equal(snapshot);
|
|
155
|
-
done();
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
});
|
|
162
|
-
});
|