provider

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeFunc

type ChangeFunc func() error

ChangeFunc is a function that is called when configuration changes.

type GetInstanceOptions added in v0.4.0

type GetInstanceOptions struct {
	Namespace string
	Name      string
	Group     string
}

GetInstanceOptions defines the options for retrieving service instances.

type Instance added in v0.4.0

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

Instance represents a single service instance with an address and metadata.

func NewInstance added in v0.4.0

func NewInstance(addr net.Addr, weight uint32) *Instance

NewInstance creates a new service instance with the given address and weight.

func (*Instance) Address added in v0.4.0

func (i *Instance) Address() net.Addr

Address returns the network address of the instance.

func (*Instance) SetTag added in v0.4.0

func (i *Instance) SetTag(key string, value string)

SetTag sets a metadata tag for the instance.

func (*Instance) Tag added in v0.4.0

func (i *Instance) Tag(key string) (value string, exist bool)

Tag retrieves a specific metadata tag value from the instance.

func (*Instance) Tags added in v0.6.0

func (i *Instance) Tags() map[string]string

Tags returns all metadata tags of the instance.

func (*Instance) Weight added in v0.4.0

func (i *Instance) Weight() uint32

Weight returns the relative weight of the instance.

type Instancer added in v0.4.0

type Instancer interface {
	Address() net.Addr
	Weight() uint32
	Tag(key string) (value string, exist bool)
	Tags() map[string]string
}

Instancer defines the interface for a service instance.

type Provider

type Provider interface {
	Watch() error
	SetOnChanged(f ChangeFunc)
}

Provider defines the interface for configuration providers.

type ServiceDiscovery added in v0.4.0

type ServiceDiscovery interface {
	GetInstances(ctx context.Context, options GetInstanceOptions) ([]Instancer, error)
	Watch(ctx context.Context, options GetInstanceOptions) (<-chan []Instancer, error)
	Close() error
}

ServiceDiscovery defines the interface for service discovery.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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