lotus/node/modules/storage.go

32 lines
645 B
Go
Raw Normal View History

package modules
import (
"context"
"go.uber.org/fx"
2019-08-01 14:19:53 +00:00
"github.com/filecoin-project/go-lotus/chain/types"
"github.com/filecoin-project/go-lotus/node/modules/dtypes"
"github.com/filecoin-project/go-lotus/node/repo"
)
2019-08-01 14:19:53 +00:00
func LockedRepo(lr repo.LockedRepo) func(lc fx.Lifecycle) repo.LockedRepo {
return func(lc fx.Lifecycle) repo.LockedRepo {
lc.Append(fx.Hook{
OnStop: func(_ context.Context) error {
return lr.Close()
},
})
2019-08-01 14:19:53 +00:00
return lr
}
}
2019-08-01 14:19:53 +00:00
func KeyStore(lr repo.LockedRepo) (types.KeyStore, error) {
return lr.KeyStore()
}
2019-08-01 14:19:53 +00:00
func Datastore(r repo.LockedRepo) (dtypes.MetadataDS, error) {
return r.Datastore("/metadata")
}