Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: use correct datastores (#3820)
Browse files Browse the repository at this point in the history
- keys is a fs datastore
- mfs uses the root datastore though it should really use the datastore datastore
  • Loading branch information
achingbrain committed Aug 17, 2021
1 parent 1343708 commit 479e09e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Expand Up @@ -22,7 +22,7 @@ const updateMfsRoot = async (context, cid, options) => {

log(`New MFS root will be ${cid}`)

await context.repo.datastore.put(MFS_ROOT_KEY, cid.bytes)
await context.repo.root.put(MFS_ROOT_KEY, cid.bytes)

return cid
}
Expand Down
Expand Up @@ -25,13 +25,13 @@ const loadMfsRoot = async (context, options) => {
}

// Open the repo if it's been closed
await context.repo.datastore.open()
await context.repo.root.open()

// Load the MFS root CID
let cid

try {
const buf = await context.repo.datastore.get(MFS_ROOT_KEY)
const buf = await context.repo.root.get(MFS_ROOT_KEY)

cid = CID.decode(buf)
} catch (err) {
Expand All @@ -52,7 +52,7 @@ const loadMfsRoot = async (context, options) => {
throw errCode(new Error('Request aborted'), 'ERR_ABORTED', { name: 'Aborted' })
}

await context.repo.datastore.put(MFS_ROOT_KEY, cid.bytes)
await context.repo.root.put(MFS_ROOT_KEY, cid.bytes)
}

log(`Loaded MFS root /ipfs/${cid}`)
Expand Down
2 changes: 1 addition & 1 deletion packages/ipfs-core/src/runtime/repo-nodejs.js
Expand Up @@ -53,7 +53,7 @@ module.exports = (print, codecs, options = {}) => {
)
),
datastore: new DatastoreLevel(`${repoPath}/datastore`),
keys: new DatastoreLevel(`${repoPath}/keys`),
keys: new DatastoreFS(`${repoPath}/keys`),
pins: new DatastoreLevel(`${repoPath}/pins`)
}, {
autoMigrate: options.autoMigrate != null ? options.autoMigrate : true,
Expand Down

0 comments on commit 479e09e

Please sign in to comment.