Skip to content

Commit

Permalink
refactor: Router interface type as submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanchriswhite committed Jul 11, 2023
1 parent 0f95b3a commit b216a36
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions p2p/types/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,25 @@ import (
"github.com/pokt-network/pocket/shared/modules"
)

// TECHDEBT(olshansky): When we delete `stdnetwork` and only go with `raintree`, this interface
// can be simplified greatly.
// TECHDEBT(#880, #811): move these definitions to /shared/modules & /shared/modules/types packages.
// `Peerstore` would have to be moved as well which may create an import cycle.

// NOTE: this is the first case I'm aware of where we need multiple
// instances of a submodule to be dependency-injectable.
//
// CONSIDERATION: this is inconsistent with existing submodule "name" naming
// conventions as the "name" doesn't match the name of the interface. This is
// implied by the fact above, as two distinct "names" are needed to disambiguate
// in the module registry. These names are also distinct from the names of the
// respective `Router` implementations; my thinking is that these names better
// reflect the separation of concerns from the P2P module's perspective.
const (
StakedActorRouterSubmoduleName = "staked_actor_router"
UnstakedActorRouterSubmoduleName = "unstaked_actor_router"
)

type Router interface {
modules.IntegrableModule
modules.Submodule

Broadcast(data []byte) error
Send(data []byte, address cryptoPocket.Address) error
Expand Down

0 comments on commit b216a36

Please sign in to comment.