@fireproof/core 0.5.15 → 0.5.17
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/dist/src/blockstore.js +3 -3
- package/dist/src/clock.js +2 -2
- package/dist/src/fireproof.js +340 -336
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +340 -336
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/src/prolly.js +3 -0
- package/dist/src/sync.js +4 -3
- package/package.json +1 -1
- package/src/blockstore.js +3 -3
- package/src/clock.js +2 -2
- package/src/prolly.js +3 -0
- package/src/sync.js +4 -3
package/dist/src/blockstore.js
CHANGED
@@ -115,8 +115,8 @@ export class TransactionBlockstore {
|
|
115
115
|
*/
|
116
116
|
async *entries() {
|
117
117
|
for (const transaction of this.inflightTransactions) {
|
118
|
-
for (const [
|
119
|
-
yield { cid:
|
118
|
+
for (const [cid, bytes] of transaction.entries()) { // test for this?
|
119
|
+
yield { cid: cid.toString(), bytes };
|
120
120
|
}
|
121
121
|
}
|
122
122
|
for (const [str, bytes] of this.committedBlocks) {
|
@@ -164,7 +164,7 @@ export class TransactionBlockstore {
|
|
164
164
|
doCommit = async (innerBlockstore) => {
|
165
165
|
const cids = new Set();
|
166
166
|
for (const { cid, bytes } of innerBlockstore.entries()) {
|
167
|
-
const stringCid = cid.toString();
|
167
|
+
const stringCid = cid.toString();
|
168
168
|
if (this.committedBlocks.has(stringCid)) {
|
169
169
|
// console.log('Duplicate block: ' + stringCid) // todo some of this can be avoided, cost is extra size on car files
|
170
170
|
}
|
package/dist/src/clock.js
CHANGED
@@ -223,11 +223,11 @@ export async function findEventsToSync(blocks, head) {
|
|
223
223
|
// console.time(callTag + '.findCommonAncestorWithSortedEvents')
|
224
224
|
const { ancestor, sorted } = await findCommonAncestorWithSortedEvents(events, head);
|
225
225
|
// console.timeEnd(callTag + '.findCommonAncestorWithSortedEvents')
|
226
|
-
// console.log('sorted', !!ancestor, sorted
|
226
|
+
// console.log('sorted', !!ancestor, sorted)
|
227
227
|
// console.time(callTag + '.contains')
|
228
228
|
const toSync = ancestor ? await asyncFilter(sorted, async (uks) => !(await contains(events, ancestor, uks.cid))) : sorted;
|
229
229
|
// console.timeEnd(callTag + '.contains')
|
230
|
-
console.log('
|
230
|
+
console.log('optimize sorted', !!ancestor, sorted.length - toSync.length);
|
231
231
|
return { cids: events, events: toSync };
|
232
232
|
}
|
233
233
|
const asyncFilter = async (arr, predicate) => Promise.all(arr.map(predicate)).then(results => arr.filter((_v, index) => results[index]));
|