etcd

package module
v2.1.0-rc2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2022 License: MIT Imports: 9 Imported by: 18

Documentation

Overview

Package etcd implements service Registry and Discovery using etcd.

Index

Constants

View Source
const (
	// DefaultKeepAliveTTL is the default keepalive TTL.
	DefaultKeepAliveTTL = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	Logger       *glog.Logger
	KeepaliveTTL time.Duration
}

Option is the option for the etcd registry.

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry implements gsvc.Registry interface.

func New

func New(address string, option ...Option) *Registry

New creates and returns a new etcd registry.

func NewWithClient

func NewWithClient(client *etcd3.Client, option ...Option) *Registry

NewWithClient creates and returns a new etcd registry with the given client.

func (*Registry) Deregister

func (r *Registry) Deregister(ctx context.Context, service *gsvc.Service) error

Deregister implements the gsvc.Deregister interface.

func (*Registry) Register

func (r *Registry) Register(ctx context.Context, service *gsvc.Service) error

Register implements the gsvc.Register interface.

func (*Registry) Search

func (r *Registry) Search(ctx context.Context, in gsvc.SearchInput) ([]*gsvc.Service, error)

Search is the etcd discovery search function.

func (*Registry) Watch

func (r *Registry) Watch(ctx context.Context, key string) (gsvc.Watcher, error)

Watch is the etcd discovery watch function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL