Skip to content

Commit

Permalink
add SupportsStagingDeals trait
Browse files Browse the repository at this point in the history
  • Loading branch information
nonsense committed Feb 16, 2022
1 parent 195d590 commit b2096e3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.
33 changes: 19 additions & 14 deletions node/repo/fsrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand All @@ -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{}{}
}

Expand All @@ -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{}{}
}

Expand Down
2 changes: 1 addition & 1 deletion node/repo/memrepo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit b2096e3

Please sign in to comment.