Merge pull request #4922 from filecoin-project/raulk/fix-fresh-blockstore

fix blockstore directory not created automatically.
This commit is contained in:
Łukasz Magiera 2020-11-19 17:11:48 +01:00 committed by GitHub
commit 648f02cbd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -308,6 +308,11 @@ func (fsr *fsLockedRepo) Blockstore(domain BlockstoreDomain) (blockstore.Blockst
path := fsr.join(filepath.Join(fsDatastore, "chain"))
readonly := fsr.readonly
if err := os.MkdirAll(path, 0755); err != nil {
fsr.bsErr = err
return
}
opts, err := BadgerBlockstoreOptions(domain, path, readonly)
if err != nil {
fsr.bsErr = err
@ -317,6 +322,7 @@ func (fsr *fsLockedRepo) Blockstore(domain BlockstoreDomain) (blockstore.Blockst
bs, err := badgerbs.Open(opts)
if err != nil {
fsr.bsErr = err
return
}
fsr.bs = lblockstore.WrapIDStore(bs)
})