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
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
NewInstance creates a new service instance with the given address and weight.
func (*Instance) Tag ¶ added in v0.4.0
Tag retrieves a specific metadata tag value from 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.
Click to show internal directories.
Click to hide internal directories.