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