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

fix: use correct datastores #3820

Merged
merged 2 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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