Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultPrefix string = "being/workers"
)
Functions ¶
This section is empty.
Types ¶
type EtcdPublisher ¶
type EtcdPublisher struct { // should be in format as being/workers/{ServiceName} Prefix string TTL time.Duration Client *client.Client Kapi client.KeysAPI }
EtcdPublisher publish sevice info to etcd
func NewEtcdPublisher ¶
func NewEtcdPublisher(hosts []string, ttl int) *EtcdPublisher
NewEtcdPublisher returns the publisher which refresh every ttl seconds
func NewEtcdPublisherWithPrefix ¶
func NewEtcdPublisherWithPrefix(hosts []string, prefix string, ttl int) *EtcdPublisher
func (*EtcdPublisher) Heartbeat ¶
func (ep *EtcdPublisher) Heartbeat(service *Service)
Heartbeat blocks and refresh TTL every {ttl} seconds until the service is Unregistered
func (*EtcdPublisher) Register ¶
func (ep *EtcdPublisher) Register(service *Service) error
Register stores the info of service at registry, and keep it, refresh it
func (*EtcdPublisher) Unregister ¶
func (ep *EtcdPublisher) Unregister(service *Service) error
Unregister removes the Publisher.FullKey at registry
Click to show internal directories.
Click to hide internal directories.