regs

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Deregister

func Deregister(key string) error

func Get

func Get(key string) string

func GetWithPrefix

func GetWithPrefix(prefix string) []string

func InitGlobalRegs

func InitGlobalRegs(ctx contextx.Context, c *clientv3.Client, opfs ...func(opt Options))

func RangKV

func RangKV(prefix string, f func(key, value string))

func Register

func Register(key, value string) error

Types

type Options

type Options interface {
	SetTTL(t time.Duration)
	SetNamespace(namespace string)
}

type Registry

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

Registry is etcd registry.

func New

func New(ctx contextx.Context, client *clientv3.Client, opts ...func(opt Options)) (r *Registry)

func (*Registry) Deregister

func (r *Registry) Deregister(key string) error

func (*Registry) Get

func (r *Registry) Get(key string) string

func (*Registry) GetWithPrefix

func (r *Registry) GetWithPrefix(prefix string) []string

func (*Registry) GetWithPrefixRandom

func (r *Registry) GetWithPrefixRandom(prefix string) string

func (*Registry) GetWithPrefixRoundRobin

func (r *Registry) GetWithPrefixRoundRobin(prefix string) string

func (*Registry) RangeKV

func (r *Registry) RangeKV(prefix string, f func(key, value string))

func (*Registry) Register

func (r *Registry) Register(key, value string) error

func (*Registry) RegisterWithAutoDeregister

func (r *Registry) RegisterWithAutoDeregister(key, value string) error

func (*Registry) SetNamespace

func (r *Registry) SetNamespace(namespace string)

func (*Registry) SetTTL

func (r *Registry) SetTTL(t time.Duration)

Jump to

Keyboard shortcuts

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