diff --git a/src/manifest-store.js b/src/manifest-store.js index 129b4d8..23225d1 100644 --- a/src/manifest-store.js +++ b/src/manifest-store.js @@ -16,13 +16,17 @@ const ManifestStore = async ({ ipfs, storage } = {}) => { */ storage = storage || await ComposedStorage( - await LRUStorage({ size: 1000 }), + await LRUStorage({ size: 100000 }), await IPFSBlockStorage({ ipfs, pin: true }) ) const get = async (address) => { const bytes = await storage.get(address) const { value } = await Block.decode({ bytes, codec, hasher }) + if (value) { + // Write to storage to make sure it gets pinned on IPFS + await storage.put(address, bytes) + } return value } diff --git a/src/oplog/log.js b/src/oplog/log.js index dd76c8c..8ce693f 100644 --- a/src/oplog/log.js +++ b/src/oplog/log.js @@ -318,6 +318,8 @@ const Log = async (identity, { logId, logHeads, access, entryStorage, headsStora /* 6. Add the new entry to heads (=union with current heads) */ await _heads.add(entry) + await _entries.put(entry.hash, entry.bytes) + return true }