From 52da33976c55f7992e1e9ff03a4ffc613068f78b Mon Sep 17 00:00:00 2001 From: Evan Hazlett Date: Fri, 6 Jul 2018 18:07:00 -0400 Subject: [PATCH] add memberlist config data Signed-off-by: Evan Hazlett --- agent.go | 7 +++++++ service.go | 2 ++ 2 files changed, 9 insertions(+) diff --git a/agent.go b/agent.go index 0bab358..1a5dfc6 100644 --- a/agent.go +++ b/agent.go @@ -26,6 +26,7 @@ type Agent struct { nodeEventChan chan *NodeEvent grpcServer *grpc.Server registeredServices map[string]struct{} + memberConfig *memberlist.Config } // NewAgent returns a new node agent @@ -48,9 +49,15 @@ func NewAgent(cfg *Config) (*Agent, error) { peerUpdateChan: updateCh, nodeEventChan: nodeEventCh, grpcServer: grpcServer, + memberConfig: mc, }, nil } +// SyncInterval returns the cluster sync interval +func (a *Agent) SyncInterval() time.Duration { + return a.memberConfig.PushPullInterval +} + // Subscribe subscribes to the node event channel func (a *Agent) Subscribe(ch chan *NodeEvent) { go func() { diff --git a/service.go b/service.go index 64c2e18..61433e1 100644 --- a/service.go +++ b/service.go @@ -3,6 +3,8 @@ package element import "google.golang.org/grpc" type Service interface { + // ID is the name of the service ID() string + // Register is used to register the GRPC service Register(srv *grpc.Server) error }