1bf713cb0a
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai>
32 lines
636 B
Go
32 lines
636 B
Go
package modules
|
|
|
|
import (
|
|
"context"
|
|
|
|
"go.uber.org/fx"
|
|
|
|
"github.com/filecoin-project/lotus/chain/types"
|
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
|
"github.com/filecoin-project/lotus/node/repo"
|
|
)
|
|
|
|
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()
|
|
},
|
|
})
|
|
|
|
return lr
|
|
}
|
|
}
|
|
|
|
func KeyStore(lr repo.LockedRepo) (types.KeyStore, error) {
|
|
return lr.KeyStore()
|
|
}
|
|
|
|
func Datastore(r repo.LockedRepo) (dtypes.MetadataDS, error) {
|
|
return r.Datastore("/metadata")
|
|
}
|