etcd

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package etcd is registered as a service using etcd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRegistry

func NewRegistry(etcdEndpoints []string, id string, instanceName string, instanceEndpoints []string) (registry.Registry, *registry.ServiceInstance, error)

NewRegistry instantiating the etcd registry

Types

type Option

type Option func(o *options)

Option is etcd registry option.

func WithContext

func WithContext(ctx context.Context) Option

WithContext with registry context.

func WithMaxRetry

func WithMaxRetry(num int) Option

WithMaxRetry set max retry times.

func WithNamespace

func WithNamespace(ns string) Option

WithNamespace with registry namespace.

func WithRegisterTTL

func WithRegisterTTL(ttl time.Duration) Option

WithRegisterTTL 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 create a 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.

Jump to

Keyboard shortcuts

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