File tree 7 files changed +18
-18
lines changed
7 files changed +18
-18
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,15 @@ module.exports = (store) => {
22
22
* @param {Object } value - the api address to be written
23
23
* @returns {Promise<void> }
24
24
*/
25
- set ( value ) {
25
+ async set ( value ) {
26
26
return store . put ( apiFile , Buffer . from ( value . toString ( ) ) )
27
27
} ,
28
28
/**
29
29
* Deletes api file
30
30
*
31
31
* @returns {Promise<void> }
32
32
*/
33
- delete ( ) {
33
+ async delete ( ) {
34
34
return store . delete ( apiFile )
35
35
}
36
36
}
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ module.exports = (store) => {
20
20
* @param {String } key - the config key to get
21
21
* @returns {Promise<Object> }
22
22
*/
23
- get ( key ) {
23
+ async get ( key ) {
24
24
if ( ! key ) {
25
25
key = undefined
26
26
}
@@ -61,7 +61,7 @@ module.exports = (store) => {
61
61
*
62
62
* @returns {Promise<bool> }
63
63
*/
64
- exists ( ) {
64
+ async exists ( ) {
65
65
return store . has ( configKey )
66
66
}
67
67
}
Original file line number Diff line number Diff line change @@ -147,7 +147,7 @@ class IpfsRepo {
147
147
*
148
148
* @returns {Promise<void> }
149
149
*/
150
- _closeLock ( ) {
150
+ async _closeLock ( ) {
151
151
if ( this . lockfile ) {
152
152
return this . lockfile . close ( )
153
153
}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ const LOCKS = {}
14
14
* @param {string } dir
15
15
* @returns {Promise<Object> }
16
16
*/
17
- exports . lock = ( dir ) => {
17
+ exports . lock = async ( dir ) => {
18
18
const file = dir + '/' + lockFile
19
19
log ( 'locking %s' , file )
20
20
LOCKS [ file ] = true
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ const STALE_TIME = 20000
22
22
* Lock the repo in the given dir.
23
23
*
24
24
* @param {string } dir
25
- * @returns {Object }
25
+ * @returns {Promise< Object> }
26
26
*/
27
27
exports . lock = async ( dir ) => {
28
28
const file = path . join ( dir , lockFile )
Original file line number Diff line number Diff line change @@ -12,25 +12,25 @@ module.exports = (store) => {
12
12
*
13
13
* @returns {Promise<bool> }
14
14
*/
15
- exists ( ) {
15
+ async exists ( ) {
16
16
return store . has ( specKey )
17
17
} ,
18
18
/**
19
19
* Get the current datastore spec.
20
20
*
21
21
* @returns {Promise<Buffer> }
22
22
*/
23
- get ( ) {
24
- return store . get ( )
25
- . then ( buf => JSON . parse ( buf . toString ( ) ) )
23
+ async get ( ) {
24
+ const buf = await store . get ( )
25
+ return JSON . parse ( buf . toString ( ) )
26
26
} ,
27
27
/**
28
28
* Set the datastore spec of the repo, writing it to the underlying store.
29
29
* TODO unclear on what the type should be or if it's required
30
30
* @param {number } spec
31
31
* @returns {Promise<void> }
32
32
*/
33
- set ( spec ) {
33
+ async set ( spec ) {
34
34
return store . put ( specKey , Buffer . from ( JSON . stringify ( sortKeys ( spec , { deep : true } ) ) ) )
35
35
}
36
36
}
Original file line number Diff line number Diff line change @@ -13,25 +13,25 @@ module.exports = (store) => {
13
13
*
14
14
* @returns {Promise<bool> }
15
15
*/
16
- exists ( ) {
16
+ async exists ( ) {
17
17
return store . has ( versionKey )
18
18
} ,
19
19
/**
20
20
* Get the current version.
21
21
*
22
22
* @returns {Promise<Integer> }
23
23
*/
24
- get ( ) {
25
- return this . get ( versionKey )
26
- . then ( buf => parseInt ( buf . toString ( ) . trim ( ) , 10 ) )
24
+ async get ( ) {
25
+ const buf = await this . get ( versionKey )
26
+ return parseInt ( buf . toString ( ) . trim ( ) , 10 )
27
27
} ,
28
28
/**
29
29
* Set the version of the repo, writing it to the underlying store.
30
30
*
31
31
* @param {number } version
32
- * @returns {void }
32
+ * @returns {Promise< void> }
33
33
*/
34
- set ( version ) {
34
+ async set ( version ) {
35
35
return store . put ( versionKey , Buffer . from ( String ( version ) ) )
36
36
} ,
37
37
/**
You can’t perform that action at this time.
0 commit comments