Skip to content

Commit

Permalink
Label async functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Zane Starr committed Feb 26, 2019
1 parent f90aef7 commit 18bbbe9
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/api-addr.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ module.exports = (store) => {
* @param {Object} value - the api address to be written
* @returns {Promise<void>}
*/
set (value) {
async set (value) {
return store.put(apiFile, Buffer.from(value.toString()))
},
/**
* Deletes api file
*
* @returns {Promise<void>}
*/
delete () {
async delete () {
return store.delete(apiFile)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = (store) => {
* @param {String} key - the config key to get
* @returns {Promise<Object>}
*/
get (key) {
async get (key) {
if (!key) {
key = undefined
}
Expand Down Expand Up @@ -61,7 +61,7 @@ module.exports = (store) => {
*
* @returns {Promise<bool>}
*/
exists () {
async exists () {
return store.has(configKey)
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class IpfsRepo {
*
* @returns {Promise<void>}
*/
_closeLock () {
async _closeLock () {
if (this.lockfile) {
return this.lockfile.close()
}
Expand Down
2 changes: 1 addition & 1 deletion src/lock-memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const LOCKS = {}
* @param {string} dir
* @returns {Promise<Object>}
*/
exports.lock = (dir) => {
exports.lock = async (dir) => {
const file = dir + '/' + lockFile
log('locking %s', file)
LOCKS[file] = true
Expand Down
2 changes: 1 addition & 1 deletion src/lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const STALE_TIME = 20000
* Lock the repo in the given dir.
*
* @param {string} dir
* @returns {Object}
* @returns {Promise<Object>}
*/
exports.lock = async (dir) => {
const file = path.join(dir, lockFile)
Expand Down
10 changes: 5 additions & 5 deletions src/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ module.exports = (store) => {
*
* @returns {Promise<bool>}
*/
exists () {
async exists () {
return store.has(specKey)
},
/**
* Get the current datastore spec.
*
* @returns {Promise<Buffer>}
*/
get () {
return store.get()
.then(buf => JSON.parse(buf.toString()))
async get () {
const buf = await store.get()
return JSON.parse(buf.toString())
},
/**
* Set the datastore spec of the repo, writing it to the underlying store.
* TODO unclear on what the type should be or if it's required
* @param {number} spec
* @returns {Promise<void>}
*/
set (spec) {
async set (spec) {
return store.put(specKey, Buffer.from(JSON.stringify(sortKeys(spec, { deep: true }))))
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ module.exports = (store) => {
*
* @returns {Promise<bool>}
*/
exists () {
async exists () {
return store.has(versionKey)
},
/**
* Get the current version.
*
* @returns {Promise<Integer>}
*/
get () {
return this.get(versionKey)
.then(buf => parseInt(buf.toString().trim(), 10))
async get () {
const buf =await this.get(versionKey)
return parseInt(buf.toString().trim(), 10)
},
/**
* Set the version of the repo, writing it to the underlying store.
*
* @param {number} version
* @returns {void}
* @returns {Promise<void>}
*/
set (version) {
async set (version) {
return store.put(versionKey, Buffer.from(String(version)))
},
/**
Expand Down

0 comments on commit 18bbbe9

Please sign in to comment.