add SupportsStagingDeals trait

This commit is contained in:
Anton Evangelatov 2022-02-16 13:28:00 +01:00
parent 949ec65118
commit 066d0edf51
2 changed files with 20 additions and 15 deletions

View File

@ -61,42 +61,47 @@ type RepoType interface {
Config() interface{}
}
// SupportsStagingDeals is a trait for services that support staging deals
type SupportsStagingDeals interface {
SupportsStagingDeals()
}
var FullNode fullNode
type fullNode struct {
}
func (f fullNode) Type() string {
func (fullNode) Type() string {
return "FullNode"
}
func (f fullNode) Config() interface{} {
func (fullNode) Config() interface{} {
return config.DefaultFullNode()
}
var StorageMiner storageMiner
type storageMiner struct {
}
type storageMiner struct{}
func (f storageMiner) Type() string {
func (storageMiner) SupportsStagingDeals() {}
func (storageMiner) Type() string {
return "StorageMiner"
}
func (f storageMiner) Config() interface{} {
func (storageMiner) Config() interface{} {
return config.DefaultStorageMiner()
}
var Markets markets
type markets struct {
}
type markets struct{}
func (f markets) Type() string {
func (markets) Type() string {
return "Markets"
}
func (f markets) Config() interface{} {
func (markets) Config() interface{} {
return config.DefaultStorageMiner()
}
@ -105,11 +110,11 @@ type worker struct {
var Worker worker
func (f worker) Type() string {
func (worker) Type() string {
return "Worker"
}
func (f worker) Config() interface{} {
func (worker) Config() interface{} {
return &struct{}{}
}
@ -118,11 +123,11 @@ var Wallet wallet
type wallet struct {
}
func (f wallet) Type() string {
func (wallet) Type() string {
return "Wallet"
}
func (f wallet) Config() interface{} {
func (wallet) Config() interface{} {
return &struct{}{}
}

View File

@ -103,7 +103,7 @@ func (lmem *lockedMemRepo) Path() string {
panic(err) // only used in tests, probably fine
}
if lmem.t.Type() == "StorageMiner" || lmem.t.Type() == "Boost" {
if _, ok := lmem.t.(SupportsStagingDeals); ok {
// this is required due to the method makeDealStaging from cmd/lotus-storage-miner/init.go
// deal-staging is the directory deal files are staged in before being sealed into sectors
// for offline deal flow.