Merge pull request #1201 from orbitdb/fix/manifest-store

Test
This commit is contained in:
Hayden Young 2024-11-01 06:52:28 +08:00 committed by GitHub
commit 90dc85077c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 1 deletions

View File

@ -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
}

View File

@ -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
}