Refactoring protocolManager.go and tracer.go, improce dependency injection

This commit is contained in:
Mario
2022-05-11 22:58:03 +02:00
parent 3683659d35
commit 3c5ac84ef0
4 changed files with 24 additions and 23 deletions

View File

@ -5,14 +5,19 @@ import (
"beelzebub/tracer"
)
type ServiceStrategy interface {
Init(beelzebubServiceConfiguration parser.BeelzebubServiceConfiguration, tracer tracer.Tracer) error
}
type ProtocolManager struct {
strategy ServiceStrategy
tracer *tracer.Tracer
}
func (pm *ProtocolManager) InitServiceManager() *ProtocolManager {
func InitProtocolManager(tracerStrategy tracer.Strategy, strategy ServiceStrategy) *ProtocolManager {
return &ProtocolManager{
tracer: tracer.Init(),
tracer: tracer.Init(tracerStrategy),
strategy: strategy,
}
}

View File

@ -1,10 +0,0 @@
package protocols
import (
"beelzebub/parser"
"beelzebub/tracer"
)
type ServiceStrategy interface {
Init(beelzebubServiceConfiguration parser.BeelzebubServiceConfiguration, tracer tracer.Tracer) error
}