etcd

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Registry

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

Registry is a struct that handles service registration, discovery, and event subscription.

func NewRegistry

func NewRegistry(c *clientv3.Client, opts ...concurrency.SessionOption) (*Registry, error)

NewRegistry creates a new Registry with the provided etcd Client and Session Options.

func (*Registry) Close

func (r *Registry) Close() error

Close closes the Registry by cancelling all contexts and closing the session.

func (*Registry) ListServices

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

ListServices retrieves a list of service instances by name.

func (*Registry) Register added in v0.0.3

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

Register registers a new service instance with the service discovery mechanism.

func (*Registry) Subscribe

func (r *Registry) Subscribe(name string) (<-chan registry.Event, error)

Subscribe returns a channel that emits events when the specified service updates.

func (*Registry) UnRegister added in v0.0.3

func (r *Registry) UnRegister(ctx context.Context, si registry.ServiceInstance) error

UnRegister removes an existing service instance from the service discovery mechanism.

Jump to

Keyboard shortcuts

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