@fireproof/core 0.7.2-dev.4 → 0.7.2-dev.6
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/database.js +7 -1
- package/dist/prolly.js +2 -2
- package/dist/src/fireproof.d.ts +2 -0
- package/dist/src/fireproof.js +25042 -24979
- package/dist/src/fireproof.js.map +1 -1
- package/dist/src/fireproof.mjs +25042 -24979
- package/dist/src/fireproof.mjs.map +1 -1
- package/dist/storage/base.js +149 -4
- package/dist/sync.js +2 -2
- package/dist/valet.js +20 -114
- package/package.json +1 -1
- package/src/database.js +8 -1
- package/src/prolly.js +2 -2
- package/src/storage/base.js +156 -4
- package/src/sync.js +3 -2
- package/src/valet.js +22 -118
package/dist/database.js
CHANGED
@@ -59,7 +59,7 @@ export class Database {
|
|
59
59
|
clock: {
|
60
60
|
byId: byId ? parseCID(byId) : null,
|
61
61
|
byKey: byKey ? parseCID(byKey) : null,
|
62
|
-
db:
|
62
|
+
db: db && db.length > 0 ? db.map(c => parseCID(c)) : null
|
63
63
|
},
|
64
64
|
code,
|
65
65
|
name
|
@@ -124,6 +124,12 @@ export class Database {
|
|
124
124
|
await this.ready;
|
125
125
|
await this.notifyListeners({ _reset: true, _clock: this.clockToJSON() });
|
126
126
|
}
|
127
|
+
async compact() {
|
128
|
+
if (this.name && this.blocks.valet) {
|
129
|
+
await this.blocks.valet.compact(this.clock);
|
130
|
+
await this.blocks.valet.saveHeader(this.toHeader());
|
131
|
+
}
|
132
|
+
}
|
127
133
|
/**
|
128
134
|
* Returns the changes made to the Fireproof instance since the specified event.
|
129
135
|
* @function changesSince
|
package/dist/prolly.js
CHANGED
@@ -99,11 +99,11 @@ const makeGetAndPutBlock = inBlocks => {
|
|
99
99
|
// const mblocks = new MemoryBlockstore()
|
100
100
|
// const blocks = new MultiBlockFetcher(mblocks, inBlocks)
|
101
101
|
const { getBlock, cids } = makeGetBlock(inBlocks);
|
102
|
-
const put = inBlocks.put.bind(inBlocks)
|
102
|
+
// const put = inBlocks.put.bind(inBlocks)
|
103
103
|
const bigPut = async (block, additions) => {
|
104
104
|
// console.log('bigPut', block.cid.toString())
|
105
105
|
const { cid, bytes } = block;
|
106
|
-
put(cid, bytes);
|
106
|
+
inBlocks.put(cid, bytes);
|
107
107
|
// mblocks.putSync(cid, bytes)
|
108
108
|
if (additions) {
|
109
109
|
additions.set(cid.toString(), block);
|
package/dist/src/fireproof.d.ts
CHANGED
@@ -14,6 +14,7 @@ declare class Valet {
|
|
14
14
|
secondary: any;
|
15
15
|
ready: Promise<any[]>;
|
16
16
|
saveHeader(header: any): Promise<any>;
|
17
|
+
compact(clock: any): Promise<void>;
|
17
18
|
/**
|
18
19
|
* Group the blocks into a car and write it to the valet.
|
19
20
|
* @param {import('./blockstore.js').InnerBlockstore} innerBlockstore
|
@@ -198,6 +199,7 @@ declare class Database {
|
|
198
199
|
* @instance
|
199
200
|
*/
|
200
201
|
notifyReset(): Promise<void>;
|
202
|
+
compact(): Promise<void>;
|
201
203
|
/**
|
202
204
|
* Returns the changes made to the Fireproof instance since the specified event.
|
203
205
|
* @function changesSince
|