Skip to content

Commit

Permalink
ProviderManyWrapper to ProviderMany
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnavarro committed Jul 7, 2022
1 parent 45a716e commit 79ed919
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion core/node/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func SimpleProviderSys(isOnline bool) interface{} {
// BatchedProviderSys creates new provider system
func BatchedProviderSys(isOnline bool, reprovideInterval string) interface{} {
return func(lc fx.Lifecycle, cr irouting.TieredRouter, q *q.Queue, keyProvider simple.KeyChanFunc, repo repo.Repo) (provider.System, error) {
r := cr.ProviderManyWrapper()
r := cr.ProvideMany()
if r == nil {
return nil, fmt.Errorf("BatchedProviderSys requires a content router that supports provideMany")
}
Expand Down
8 changes: 4 additions & 4 deletions routing/delegated.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

type TieredRouter interface {
routing.Routing
ProviderManyWrapper() ProvideMany
ProvideMany() ProvideMany
}

var _ TieredRouter = &Tiered{}
Expand All @@ -23,9 +23,9 @@ type Tiered struct {
routinghelpers.Tiered
}

// ProviderManyWrapper returns a ProviderMany implementation including all Routers that
// implements ProviderMany
func (ds Tiered) ProviderManyWrapper() ProvideMany {
// ProvideMany returns a ProvideMany implementation including all Routers that
// implements ProvideMany
func (ds Tiered) ProvideMany() ProvideMany {
var pms []ProvideMany
for _, r := range ds.Tiered.Routers {
pm, ok := r.(ProvideMany)
Expand Down
4 changes: 2 additions & 2 deletions routing/delegated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ func TestTieredRouter(t *testing.T) {
},
}

pm := tr.ProviderManyWrapper()
pm := tr.ProvideMany()
require.Nil(pm)

tr.Tiered.Routers = append(tr.Tiered.Routers, &dummyRouter{})

pm = tr.ProviderManyWrapper()
pm = tr.ProvideMany()
require.NotNil(pm)
}

Expand Down

0 comments on commit 79ed919

Please sign in to comment.