Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Instance ¶
type Instance interface {
Address() net.Addr
Weight() int
Tag(key string) (value string, exist bool)
}
Instance contains information of an instance from the target service.
type Resolver ¶
type Resolver interface {
// Target should return a description for the given target that is suitable for being a key for cache.
Target(ctx context.Context, target *TargetInfo) string
// Resolve returns a list of instances for the given description of a target.
Resolve(ctx context.Context, desc string) (Result, error)
// Name returns the name of the resolver.
Name() string
}
type Result ¶
Result contains the result of service discovery process. the instance list can/should be cached and CacheKey can be used to map the instance list in cache.
type SynthesizedResolver ¶
type SynthesizedResolver struct {
TargetFunc func(ctx context.Context, target *TargetInfo) string
ResolveFunc func(ctx context.Context, key string) (Result, error)
NameFunc func() string
}
SynthesizedResolver synthesizes a Resolver using a resolve function.
func (SynthesizedResolver) Name ¶
func (sr SynthesizedResolver) Name() string
Name implements the Resolver interface
func (SynthesizedResolver) Target ¶
func (sr SynthesizedResolver) Target(ctx context.Context, target *TargetInfo) string
type TargetInfo ¶
Click to show internal directories.
Click to hide internal directories.