@@ -37,7 +37,6 @@ const lockers = {
3737 * @typedef {import("./types").Lock } Lock
3838 * @typedef {import("./types").LockCloser } LockCloser
3939 * @typedef {import("./types").Stat } Stat
40- * @typedef {import("./types").OpenRepo } OpenRepo
4140 * @typedef {import("ipld-block") } Block
4241 * @typedef {import("interface-datastore").Datastore } Datastore}
4342 */
@@ -60,8 +59,13 @@ class IpfsRepo {
6059 this . path = repoPath
6160
6261 this . _locker = this . _getLocker ( )
63-
6462 this . root = backends . create ( 'root' , this . path , this . options )
63+ this . datastore = backends . create ( 'datastore' , pathJoin ( this . path , 'datastore' ) , this . options )
64+ this . keys = backends . create ( 'keys' , pathJoin ( this . path , 'keys' ) , this . options )
65+ this . pins = backends . create ( 'pins' , pathJoin ( this . path , 'pins' ) , this . options )
66+ const blocksBaseStore = backends . create ( 'blocks' , pathJoin ( this . path , 'blocks' ) , this . options )
67+ this . blocks = blockstore ( blocksBaseStore , this . options . storageBackendOptions . blocks )
68+
6569 this . version = version ( this . root )
6670 this . config = config ( this . root )
6771 this . spec = spec ( this . root )
@@ -137,20 +141,15 @@ class IpfsRepo {
137141 }
138142
139143 log ( 'creating datastore' )
140- this . datastore = backends . create ( 'datastore' , pathJoin ( this . path , 'datastore' ) , this . options )
141144 await this . datastore . open ( )
142145
143146 log ( 'creating blocks' )
144- const blocksBaseStore = backends . create ( 'blocks' , pathJoin ( this . path , 'blocks' ) , this . options )
145- await blocksBaseStore . open ( )
146- this . blocks = await blockstore ( blocksBaseStore , this . options . storageBackendOptions . blocks )
147+ this . blocks . open ( )
147148
148149 log ( 'creating keystore' )
149- this . keys = backends . create ( 'keys' , pathJoin ( this . path , 'keys' ) , this . options )
150150 await this . keys . open ( )
151151
152152 log ( 'creating pins' )
153- this . pins = backends . create ( 'pins' , pathJoin ( this . path , 'pins' ) , this . options )
154153 await this . pins . open ( )
155154
156155 this . closed = false
0 commit comments