Remove GRPC from element
I came in like a wrecking ball.... I think the grpc server and rpc configuration for the server should be handled outside of this package. There are many ways to configure it and we need more flexability on start and shutdown for grpc services. Signal handling should be in the caller.
This commit is contained in:
parent
52da33976c
commit
382f52335c
7 changed files with 32 additions and 90 deletions
6
agent.go
6
agent.go
|
@ -5,7 +5,6 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/hashicorp/memberlist"
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -24,7 +23,6 @@ type Agent struct {
|
|||
members *memberlist.Memberlist
|
||||
peerUpdateChan chan bool
|
||||
nodeEventChan chan *NodeEvent
|
||||
grpcServer *grpc.Server
|
||||
registeredServices map[string]struct{}
|
||||
memberConfig *memberlist.Config
|
||||
}
|
||||
|
@ -33,7 +31,7 @@ type Agent struct {
|
|||
func NewAgent(cfg *Config) (*Agent, error) {
|
||||
updateCh := make(chan bool)
|
||||
nodeEventCh := make(chan *NodeEvent)
|
||||
mc, err := setupMemberlistConfig(cfg, updateCh, nodeEventCh)
|
||||
mc, err := cfg.memberListConfig(updateCh, nodeEventCh)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -42,13 +40,11 @@ func NewAgent(cfg *Config) (*Agent, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
grpcServer := grpc.NewServer()
|
||||
return &Agent{
|
||||
config: cfg,
|
||||
members: ml,
|
||||
peerUpdateChan: updateCh,
|
||||
nodeEventChan: nodeEventCh,
|
||||
grpcServer: grpcServer,
|
||||
memberConfig: mc,
|
||||
}, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue