registry

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

README

registry

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGRPCEtcdResolverBuilder added in v0.0.5

func NewGRPCEtcdResolverBuilder(c *clientv3.Client) (gresolver.Builder, error)

Types

type Endpoint

type Endpoint struct {
	ServiceName string
	Network     string
	Address     string //host
	Port        int
	Weight      int
	Tags        map[string]string
}

type Operation

type Operation uint8
const (
	Add Operation = iota
	Delete
)

type Option

type Option func(c *clientv3.Config)

func WithAuthOpt

func WithAuthOpt(username, password string) Option

WithAuthOpt returns a option that authentication by usernane and password.

func WithDialTimeoutOpt

func WithDialTimeoutOpt(dialTimeout time.Duration) Option

WithDialTimeoutOpt returns a option set dialTimeout

func WithTLSOpt

func WithTLSOpt(certFile, keyFile, caFile string) Option

type Registry

type Registry interface {
	Register(endpoint *Endpoint) error
	Deregister(endpoint *Endpoint) error
}

func NewEtcdRegistry

func NewEtcdRegistry(endpoints []string, ttl int64, opts ...Option) (Registry, error)

func NewEtcdRegistryWithClient added in v0.0.4

func NewEtcdRegistryWithClient(etcdClient *clientv3.Client, ttl int64) (Registry, error)

type Resolver added in v0.0.5

type Resolver interface {
}

type ResolverBuilder

type ResolverBuilder interface {
	Build(target string, update UpdateFunc) (Resolver, error)
}

type Update

type Update struct {
	Op       Operation
	Key      string
	Instance discovery.Instance
}

type UpdateFunc

type UpdateFunc func(discovery.Result) error

type WatchChannel

type WatchChannel <-chan []*Update

type WatchResolver added in v0.0.5

type WatchResolver interface {
}

type WatchResolverBuilder added in v0.0.5

type WatchResolverBuilder interface {
	Build(target string, update UpdateFunc) (WatchResolver, error)
}

func NewEtcdWatchResolverBuilder

func NewEtcdWatchResolverBuilder(c *clientv3.Client) (WatchResolverBuilder, error)

Jump to

Keyboard shortcuts

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