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

Commit 479e09e

Browse files
authoredAug 17, 2021
fix: use correct datastores (#3820)
- keys is a fs datastore - mfs uses the root datastore though it should really use the datastore datastore
1 parent 1343708 commit 479e09e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed
 

‎packages/ipfs-core/src/components/files/utils/update-mfs-root.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const updateMfsRoot = async (context, cid, options) => {
2222

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

25-
await context.repo.datastore.put(MFS_ROOT_KEY, cid.bytes)
25+
await context.repo.root.put(MFS_ROOT_KEY, cid.bytes)
2626

2727
return cid
2828
}

‎packages/ipfs-core/src/components/files/utils/with-mfs-root.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ const loadMfsRoot = async (context, options) => {
2525
}
2626

2727
// Open the repo if it's been closed
28-
await context.repo.datastore.open()
28+
await context.repo.root.open()
2929

3030
// Load the MFS root CID
3131
let cid
3232

3333
try {
34-
const buf = await context.repo.datastore.get(MFS_ROOT_KEY)
34+
const buf = await context.repo.root.get(MFS_ROOT_KEY)
3535

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

55-
await context.repo.datastore.put(MFS_ROOT_KEY, cid.bytes)
55+
await context.repo.root.put(MFS_ROOT_KEY, cid.bytes)
5656
}
5757

5858
log(`Loaded MFS root /ipfs/${cid}`)

‎packages/ipfs-core/src/runtime/repo-nodejs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ module.exports = (print, codecs, options = {}) => {
5353
)
5454
),
5555
datastore: new DatastoreLevel(`${repoPath}/datastore`),
56-
keys: new DatastoreLevel(`${repoPath}/keys`),
56+
keys: new DatastoreFS(`${repoPath}/keys`),
5757
pins: new DatastoreLevel(`${repoPath}/pins`)
5858
}, {
5959
autoMigrate: options.autoMigrate != null ? options.autoMigrate : true,

0 commit comments

Comments
 (0)
This repository has been archived.