@dxos/feed-store 0.3.11-next.e28df4f → 0.3.11-next.ee2b64c
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/package.json +15 -15
- package/src/feed-set-iterator.test.ts +37 -31
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/feed-store",
|
|
3
|
-
"version": "0.3.11-next.
|
|
3
|
+
"version": "0.3.11-next.ee2b64c",
|
|
4
4
|
"description": "A consistent store for hypercore feeds.",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -23,24 +23,24 @@
|
|
|
23
23
|
"race-as-promised": "^0.0.2",
|
|
24
24
|
"random-access-storage": "^3.0.0",
|
|
25
25
|
"streamx": "^2.12.5",
|
|
26
|
-
"@dxos/async": "0.3.11-next.
|
|
27
|
-
"@dxos/codec-protobuf": "0.3.11-next.
|
|
28
|
-
"@dxos/
|
|
29
|
-
"@dxos/debug": "0.3.11-next.
|
|
30
|
-
"@dxos/
|
|
31
|
-
"@dxos/
|
|
32
|
-
"@dxos/
|
|
33
|
-
"@dxos/
|
|
34
|
-
"@dxos/
|
|
35
|
-
"@dxos/node-std": "0.3.11-next.
|
|
36
|
-
"@dxos/
|
|
37
|
-
"@dxos/
|
|
38
|
-
"@dxos/util": "0.3.11-next.
|
|
26
|
+
"@dxos/async": "0.3.11-next.ee2b64c",
|
|
27
|
+
"@dxos/codec-protobuf": "0.3.11-next.ee2b64c",
|
|
28
|
+
"@dxos/crypto": "0.3.11-next.ee2b64c",
|
|
29
|
+
"@dxos/debug": "0.3.11-next.ee2b64c",
|
|
30
|
+
"@dxos/hypercore": "0.3.11-next.ee2b64c",
|
|
31
|
+
"@dxos/invariant": "0.3.11-next.ee2b64c",
|
|
32
|
+
"@dxos/context": "0.3.11-next.ee2b64c",
|
|
33
|
+
"@dxos/keyring": "0.3.11-next.ee2b64c",
|
|
34
|
+
"@dxos/log": "0.3.11-next.ee2b64c",
|
|
35
|
+
"@dxos/node-std": "0.3.11-next.ee2b64c",
|
|
36
|
+
"@dxos/keys": "0.3.11-next.ee2b64c",
|
|
37
|
+
"@dxos/random-access-storage": "0.3.11-next.ee2b64c",
|
|
38
|
+
"@dxos/util": "0.3.11-next.ee2b64c"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@faker-js/faker": "^8.3.1",
|
|
42
42
|
"@types/lodash.defaultsdeep": "^4.6.6",
|
|
43
|
-
"@dxos/keys": "0.3.11-next.
|
|
43
|
+
"@dxos/keys": "0.3.11-next.ee2b64c"
|
|
44
44
|
},
|
|
45
45
|
"optionalDependencies": {
|
|
46
46
|
"@faker-js/faker": "^8.3.1"
|
|
@@ -104,28 +104,31 @@ describe('FeedSetIterator', () => {
|
|
|
104
104
|
const iterator = new FeedSetIterator(randomFeedBlockSelector);
|
|
105
105
|
|
|
106
106
|
// Write blocks.
|
|
107
|
-
setTimeout(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
107
|
+
setTimeout(
|
|
108
|
+
async () => {
|
|
109
|
+
// Create feeds.
|
|
110
|
+
// TODO(burdon): Test adding feeds on-the-fly.
|
|
111
|
+
const writers = await Promise.all(
|
|
112
|
+
Array.from(Array(numFeeds)).map(async () => {
|
|
113
|
+
const key = await builder.keyring.createKey();
|
|
114
|
+
const feed = await feedStore.openFeed(key, { writable: true });
|
|
115
|
+
await iterator.addFeed(feed);
|
|
116
|
+
return feed.createFeedWriter();
|
|
117
|
+
}),
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
expect(iterator.size).to.eq(numFeeds);
|
|
121
|
+
|
|
122
|
+
for (const _ of Array.from(Array(numBlocks))) {
|
|
123
|
+
const writer = faker.helpers.arrayElement(writers);
|
|
124
|
+
const receipts = await builder.generator.writeBlocks(writer, {
|
|
125
|
+
count: 1,
|
|
126
|
+
});
|
|
127
|
+
log('wrote', receipts);
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
faker.number.int({ min: 0, max: 100 }),
|
|
131
|
+
);
|
|
129
132
|
|
|
130
133
|
// Open and start iterator.
|
|
131
134
|
await iterator.open();
|
|
@@ -134,16 +137,19 @@ describe('FeedSetIterator', () => {
|
|
|
134
137
|
|
|
135
138
|
// Read blocks.
|
|
136
139
|
const [readAll, read] = latch({ count: numBlocks });
|
|
137
|
-
setTimeout(
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
setTimeout(
|
|
141
|
+
async () => {
|
|
142
|
+
for await (const block of iterator) {
|
|
143
|
+
const { feedKey, seq } = block;
|
|
144
|
+
const count = read();
|
|
145
|
+
log('read', { feedKey, seq, count });
|
|
146
|
+
if (count === numBlocks) {
|
|
147
|
+
await iterator.stop();
|
|
148
|
+
}
|
|
144
149
|
}
|
|
145
|
-
}
|
|
146
|
-
|
|
150
|
+
},
|
|
151
|
+
faker.number.int({ min: 0, max: 100 }),
|
|
152
|
+
);
|
|
147
153
|
|
|
148
154
|
// Wait until all written and read.
|
|
149
155
|
const count = await readAll();
|