add memberlist config data
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
parent
4879821486
commit
52da33976c
2 changed files with 9 additions and 0 deletions
7
agent.go
7
agent.go
|
@ -26,6 +26,7 @@ type Agent struct {
|
||||||
nodeEventChan chan *NodeEvent
|
nodeEventChan chan *NodeEvent
|
||||||
grpcServer *grpc.Server
|
grpcServer *grpc.Server
|
||||||
registeredServices map[string]struct{}
|
registeredServices map[string]struct{}
|
||||||
|
memberConfig *memberlist.Config
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAgent returns a new node agent
|
// NewAgent returns a new node agent
|
||||||
|
@ -48,9 +49,15 @@ func NewAgent(cfg *Config) (*Agent, error) {
|
||||||
peerUpdateChan: updateCh,
|
peerUpdateChan: updateCh,
|
||||||
nodeEventChan: nodeEventCh,
|
nodeEventChan: nodeEventCh,
|
||||||
grpcServer: grpcServer,
|
grpcServer: grpcServer,
|
||||||
|
memberConfig: mc,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SyncInterval returns the cluster sync interval
|
||||||
|
func (a *Agent) SyncInterval() time.Duration {
|
||||||
|
return a.memberConfig.PushPullInterval
|
||||||
|
}
|
||||||
|
|
||||||
// Subscribe subscribes to the node event channel
|
// Subscribe subscribes to the node event channel
|
||||||
func (a *Agent) Subscribe(ch chan *NodeEvent) {
|
func (a *Agent) Subscribe(ch chan *NodeEvent) {
|
||||||
go func() {
|
go func() {
|
||||||
|
|
|
@ -3,6 +3,8 @@ package element
|
||||||
import "google.golang.org/grpc"
|
import "google.golang.org/grpc"
|
||||||
|
|
||||||
type Service interface {
|
type Service interface {
|
||||||
|
// ID is the name of the service
|
||||||
ID() string
|
ID() string
|
||||||
|
// Register is used to register the GRPC service
|
||||||
Register(srv *grpc.Server) error
|
Register(srv *grpc.Server) error
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue