etcd

package
v0.0.5-0...-8e55a6f Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: Apache-2.0 Imports: 11 Imported by: 6

README

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *options)

Option is etcd registry option.

func Context

func Context(ctx context.Context) Option

Context with registry context.

func MaxRetry

func MaxRetry(num int) Option

func Namespace

func Namespace(ns string) Option

Namespace with registry namespace.

func RegisterTTL

func RegisterTTL(ttl time.Duration) Option

RegisterTTL with register ttl.

type Registry

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

Registry is etcd registry.

func New

func New(client *clientv3.Client, opts ...Option) (r *Registry)

New creates etcd registry

func (*Registry) Deregister

func (r *Registry) Deregister(ctx context.Context, service *registry.ServiceInstance) error

Deregister the registration.

func (*Registry) GetService

func (r *Registry) GetService(ctx context.Context, name string) ([]*registry.ServiceInstance, error)

GetService return the service instances in memory according to the service name.

func (*Registry) Register

func (r *Registry) Register(ctx context.Context, service *registry.ServiceInstance) error

Register the registration.

func (*Registry) Watch

func (r *Registry) Watch(ctx context.Context, name string) (registry.Watcher, error)

Watch creates a watcher according to the service name.

func (*Registry) WatchAll

func (r *Registry) WatchAll(ctx context.Context) (registry.Watcher, error)

WatchAll creates a watcher to all services

Jump to

Keyboard shortcuts

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