Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion ci/Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
javascript()
javascript(['nodejs_versions': ['8.11.1','9.2.0','10.0.0']])
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
"browser": {
"rimraf": false,
"datastore-fs": "datastore-level",
"leveldown": "level-js",
"./src/lock.js": "./src/lock-memory.js",
"./src/default-options.js": "./src/default-options-browser.js"
},
Expand Down Expand Up @@ -59,14 +58,12 @@
"big.js": "^5.0.3",
"cids": "~0.5.3",
"datastore-core": "~0.4.0",
"datastore-fs": "~0.4.2",
"datastore-level": "~0.7.0",
"datastore-fs": "github:ipfs/js-datastore-fs#fix/node10",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has been merged and released, the dep can be updated.

"datastore-level": "github:ipfs/js-datastore-level#fix/node10",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: needs ipfs/js-datastore-level#7

"debug": "^3.1.0",
"interface-datastore": "~0.4.2",
"ipfs-block": "~0.7.1",
"level-js": "timkuijsten/level.js#idbunwrapper",
"leveldown": "^1.7.2",
"lock-me": "^1.0.3",
"lock-me": "github:jacobheun/lock-me#fix/windows",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get this PR up so that @dignifiedquire can review and merge?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We've already gotten that merged and released with lock-me 1.0.4.

datastore-level is the only thing left to be merged, and then I will update all the deps for this. I will get the feedback for that resolved so we can get it merged in.

"lodash.get": "^4.4.2",
"lodash.has": "^4.5.2",
"lodash.set": "^4.3.2",
Expand Down
10 changes: 2 additions & 8 deletions src/default-options-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ module.exports = {
},
storageBackendOptions: {
root: {
db: require('level-js'),
extension: ''
},
blocks: {
sharding: false,
db: require('level-js')
sharding: false
},
keys: {
sharding: false,
db: require('level-js')
},
datastore: {
db: require('level-js')
sharding: false
}
}
}
3 changes: 3 additions & 0 deletions src/errors/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
'use strict'

exports.ERR_REPO_NOT_INITIALIZED = 'ERR_REPO_NOT_INITIALIZED'
11 changes: 7 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const config = require('./config')
const apiAddr = require('./api-addr')
const blockstore = require('./blockstore')
const defaultOptions = require('./default-options')
const ERRORS = require('./errors')

const log = debug('repo')

Expand Down Expand Up @@ -212,14 +213,14 @@ class IpfsRepo {
},
(err, res) => {
log('init', err, res)
if (err) {
if (err && !res.config) {
return callback(Object.assign(new Error('repo is not initialized yet'),
{
code: 'ERR_REPO_NOT_INITIALIZED',
code: ERRORS.ERR_REPO_NOT_INITIALIZED,
path: this.path
}))
}
callback()
callback(err)
}
)
}
Expand Down Expand Up @@ -355,7 +356,9 @@ function ignoringAlreadyOpened (cb) {
}

function ignoringNotFound (cb) {
return ignoringIf((err) => err.message.startsWith('ENOENT'), cb)
return ignoringIf((err) => {
return err && (err.code === ERRORS.ERR_REPO_NOT_INITIALIZED || err.message.startsWith('ENOENT'))
}, cb)
}

function buildOptions (_options) {
Expand Down
6 changes: 0 additions & 6 deletions test/options-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,9 @@ function expectedRepoOptions () {
}

if (process.browser) {
options.storageBackendOptions.root.db = require('leveldown')
options.storageBackendOptions.keys.db = require('leveldown')
options.storageBackendOptions.keys.sharding = false
options.storageBackendOptions.blocks.db = require('leveldown')
delete options.storageBackendOptions.blocks.extension
options.storageBackendOptions.blocks.sharding = false
options.storageBackendOptions.datastore = {
db: require('leveldown')
}
}
return options
}