diff --git a/shared/modules/fisherman_module.go b/shared/modules/fisherman_module.go new file mode 100644 index 000000000..fbc96ed5b --- /dev/null +++ b/shared/modules/fisherman_module.go @@ -0,0 +1,5 @@ +package modules + +type FishermanModule interface { + Module +} diff --git a/shared/modules/servicer_module.go b/shared/modules/servicer_module.go new file mode 100644 index 000000000..657a5003c --- /dev/null +++ b/shared/modules/servicer_module.go @@ -0,0 +1,16 @@ +package modules + +//go:generate mockgen -destination=./mocks/servicer_module_mock.go github.com/pokt-network/pocket/shared/modules ServicerModule + +import ( + coreTypes "github.com/pokt-network/pocket/shared/core/types" +) + +const ( + ServicerModuleName = "servicer" +) + +type ServicerModule interface { + Module + HandleRelay(*coreTypes.Relay) (*coreTypes.RelayResponse, error) +} diff --git a/shared/modules/utility_module.go b/shared/modules/utility_module.go index 720a4fa09..4594ee295 100644 --- a/shared/modules/utility_module.go +++ b/shared/modules/utility_module.go @@ -58,19 +58,6 @@ type UtilityModule interface { GetValidatorModule() (ValidatorModule, error) } -type FishermanModule interface { - Module -} - -type ServicerModule interface { - Module - HandleRelay(*coreTypes.Relay) (*coreTypes.RelayResponse, error) -} - -type ValidatorModule interface { - Module -} - // TECHDEBT: Remove this interface from `shared/modules` and use the `Actor` protobuf type instead // There will need to be some documentation or indicator that the Actor struct returned may not be // fully hydrated. Alternatively, we could eat the performance cost and just hydrate the entire struct diff --git a/shared/modules/validator_module.go b/shared/modules/validator_module.go new file mode 100644 index 000000000..b29b21c09 --- /dev/null +++ b/shared/modules/validator_module.go @@ -0,0 +1,5 @@ +package modules + +type ValidatorModule interface { + Module +} diff --git a/utility/module.go b/utility/module.go index c8b027b9e..6ffffdb7f 100644 --- a/utility/module.go +++ b/utility/module.go @@ -142,10 +142,10 @@ func (u *utilityModule) GetActorModules() map[string]modules.Module { } func (u *utilityModule) GetServicerModule() (modules.ServicerModule, error) { - if u.actorModules[servicer.ServicerModuleName] == nil { + if u.actorModules[modules.ServicerModuleName] == nil { return nil, errors.New("servicer module not enabled") } - if m, ok := u.actorModules[servicer.ServicerModuleName].(modules.ServicerModule); ok { + if m, ok := u.actorModules[modules.ServicerModuleName].(modules.ServicerModule); ok { return m, nil } return nil, errors.New("failed to cast servicer module") diff --git a/utility/servicer/module.go b/utility/servicer/module.go index 18871633d..4df87d6d5 100644 --- a/utility/servicer/module.go +++ b/utility/servicer/module.go @@ -35,10 +35,6 @@ var ( _ modules.ServicerModule = &servicer{} ) -const ( - ServicerModuleName = "servicer" -) - // sessionTokens is used to cache the starting number of tokens available // during a specific session: it is used as the value for a map with keys being applications' public keys // TODO: What if we have a servicer managing more than one session from the same app at once? We may/may not need to resolve this in the future. @@ -121,7 +117,7 @@ func (s *servicer) Stop() error { } func (s *servicer) GetModuleName() string { - return ServicerModuleName + return modules.ServicerModuleName } // HandleRelay processes a relay after performing validation.