Documentation ¶
Index ¶
- Constants
- func EnableCheck()
- func GetATCClient(ctx context.Context) *atcclient.ATCClient
- func GetEtcdV3Client(ctx context.Context) *v3.Client
- func GetMembership(addr Address) *membership.Roxy
- func GetShardID(ctx context.Context) (shardID int32, ok bool)
- func GetZKConn(ctx context.Context) *zk.Conn
- func Logger() *zerolog.Logger
- func MapEtcdError(err error) error
- func MapZKError(err error) error
- func NewATCBalancerBuilder() balancer.Builder
- func NewATCBuilder(ctx context.Context, rng *rand.Rand, client *atcclient.ATCClient) grpcresolver.Builder
- func NewDNSBuilder(ctx context.Context, rng *rand.Rand, serviceConfigJSON string) grpcresolver.Builder
- func NewEtcdBuilder(ctx context.Context, rng *rand.Rand, etcd *v3.Client, serviceConfigJSON string) grpcresolver.Builder
- func NewIPBuilder(rng *rand.Rand, serviceConfigJSON string) grpcresolver.Builder
- func NewSRVBuilder(ctx context.Context, rng *rand.Rand, serviceConfigJSON string) grpcresolver.Builder
- func NewZKBuilder(ctx context.Context, rng *rand.Rand, zkconn *zk.Conn, serviceConfigJSON string) grpcresolver.Builder
- func SetLogger(logger zerolog.Logger)
- func WithATCClient(ctx context.Context, client *atcclient.ATCClient) context.Context
- func WithEtcdV3Client(ctx context.Context, etcd *v3.Client) context.Context
- func WithShardID(ctx context.Context, shardID int32) context.Context
- func WithStandardResolvers(ctx context.Context) grpc.DialOption
- func WithZKConn(ctx context.Context, zkconn *zk.Conn) context.Context
- type Address
- type BadStatusError
- type BalancerType
- func ParseATCTarget(rt RoxyTarget) (lbName, lbLocation, lbUnique string, balancer BalancerType, isDSC bool, ...)
- func ParseDNSTarget(rt RoxyTarget, defaultPort string) (res *net.Resolver, host string, port string, balancer BalancerType, ...)
- func ParseEtcdTarget(rt RoxyTarget) (etcdPath string, etcdPort string, balancer BalancerType, serverName string, ...)
- func ParseIPTarget(rt RoxyTarget, defaultPort string) (tcpAddrs []*net.TCPAddr, balancer BalancerType, serverName string, err error)
- func ParseSRVTarget(rt RoxyTarget) (res *net.Resolver, name string, service string, balancer BalancerType, ...)
- func ParseUnixTarget(rt RoxyTarget) (unixAddr *net.UnixAddr, balancer BalancerType, serverName string, err error)
- func ParseZKTarget(rt RoxyTarget) (zkPath string, zkPort string, balancer BalancerType, serverName string, ...)
- type Dynamic
- type Event
- type EventType
- type Options
- type PollingResolveFunc
- type PollingResolver
- func (res *PollingResolver) CancelWatch(id WatchID)
- func (res *PollingResolver) Close()
- func (res *PollingResolver) Err() error
- func (res *PollingResolver) Resolve() (Resolved, error)
- func (res *PollingResolver) ResolveAll() ([]Resolved, error)
- func (res *PollingResolver) ResolveNow(opts ResolveNowOptions)
- func (res *PollingResolver) Update(opts UpdateOptions)
- func (res *PollingResolver) Watch(fn WatchFunc) WatchID
- type PollingResolverOptions
- type ResolveNowOptions
- type Resolved
- type ResolvedList
- type Resolver
- func New(opts Options) (Resolver, error)
- func NewATCResolver(opts Options) (Resolver, error)
- func NewDNSResolver(opts Options) (Resolver, error)
- func NewEtcdResolver(opts Options) (Resolver, error)
- func NewIPResolver(opts Options) (Resolver, error)
- func NewSRVResolver(opts Options) (Resolver, error)
- func NewUnixResolver(opts Options) (Resolver, error)
- func NewZKResolver(opts Options) (Resolver, error)
- type RoxyTarget
- type StaticResolver
- func (res *StaticResolver) CancelWatch(id WatchID)
- func (res *StaticResolver) Close()
- func (res *StaticResolver) Err() error
- func (res *StaticResolver) Resolve() (Resolved, error)
- func (res *StaticResolver) ResolveAll() ([]Resolved, error)
- func (res *StaticResolver) ResolveNow(opts ResolveNowOptions)
- func (res *StaticResolver) Update(opts UpdateOptions)
- func (res *StaticResolver) Watch(fn WatchFunc) WatchID
- type StaticResolverOptions
- type Target
- type UpdateOptions
- type WatchFunc
- type WatchID
- type WatchingResolveFunc
- func MakeATCResolveFunc(client *atcclient.ATCClient, lbName, lbLocation, lbUnique string, dsc bool, ...) WatchingResolveFunc
- func MakeEtcdResolveFunc(etcdClient *v3.Client, etcdPath string, etcdPort string, serverName string) WatchingResolveFunc
- func MakeZKResolveFunc(zkconn *zk.Conn, zkPath string, zkPort string, serverName string) WatchingResolveFunc
- type WatchingResolver
- func (res *WatchingResolver) CancelWatch(id WatchID)
- func (res *WatchingResolver) Close()
- func (res *WatchingResolver) Err() error
- func (res *WatchingResolver) Resolve() (Resolved, error)
- func (res *WatchingResolver) ResolveAll() ([]Resolved, error)
- func (res *WatchingResolver) ResolveNow(opts ResolveNowOptions)
- func (res *WatchingResolver) Update(opts UpdateOptions)
- func (res *WatchingResolver) Watch(fn WatchFunc) WatchID
- type WatchingResolverOptions
Constants ¶
View Source
const ( MembershipAttrKey = attrKey("roxy.Membership") ResolvedAttrKey = attrKey("roxy.Resolved") )
View Source
const ( ShardIDContextKey = contextKey("roxy.ShardID") ZKConnContextKey = contextKey("roxy.zk.Conn") V3ClientContextKey = contextKey("roxy.etcd.V3Client") ATCClientContextKey = contextKey("roxy.atc.Client") )
Variables ¶
This section is empty.
Functions ¶
func EnableCheck ¶
func EnableCheck()
func GetMembership ¶
func GetMembership(addr Address) *membership.Roxy
func MapEtcdError ¶
func MapZKError ¶
func NewATCBalancerBuilder ¶
func NewATCBuilder ¶
func NewDNSBuilder ¶
func NewEtcdBuilder ¶
func NewIPBuilder ¶
func NewIPBuilder(rng *rand.Rand, serviceConfigJSON string) grpcresolver.Builder
func NewSRVBuilder ¶
func NewZKBuilder ¶
func WithATCClient ¶
func WithStandardResolvers ¶
func WithStandardResolvers(ctx context.Context) grpc.DialOption
Types ¶
type Address ¶
type Address = grpcresolver.Address
func WithMembership ¶
func WithMembership(addr Address, r *membership.Roxy) Address
func WithResolved ¶
type BadStatusError ¶
type BadStatusError struct {
Status membership.ServerSetStatus
}
func (BadStatusError) Error ¶
func (err BadStatusError) Error() string
func (BadStatusError) Is ¶
func (err BadStatusError) Is(other error) bool
type BalancerType ¶
type BalancerType uint8
const ( RandomBalancer BalancerType = iota RoundRobinBalancer LeastLoadedBalancer SRVBalancer WeightedRandomBalancer WeightedRoundRobinBalancer )
func ParseATCTarget ¶
func ParseATCTarget(rt RoxyTarget) (lbName, lbLocation, lbUnique string, balancer BalancerType, isDSC bool, serverName string, err error)
func ParseDNSTarget ¶
func ParseEtcdTarget ¶
func ParseEtcdTarget(rt RoxyTarget) (etcdPath string, etcdPort string, balancer BalancerType, serverName string, err error)
func ParseIPTarget ¶
func ParseIPTarget(rt RoxyTarget, defaultPort string) (tcpAddrs []*net.TCPAddr, balancer BalancerType, serverName string, err error)
func ParseSRVTarget ¶
func ParseUnixTarget ¶
func ParseUnixTarget(rt RoxyTarget) (unixAddr *net.UnixAddr, balancer BalancerType, serverName string, err error)
func ParseZKTarget ¶
func ParseZKTarget(rt RoxyTarget) (zkPath string, zkPort string, balancer BalancerType, serverName string, err error)
func (BalancerType) GoString ¶
func (t BalancerType) GoString() string
func (BalancerType) MarshalJSON ¶
func (t BalancerType) MarshalJSON() ([]byte, error)
func (*BalancerType) Parse ¶
func (t *BalancerType) Parse(str string) error
func (BalancerType) String ¶
func (t BalancerType) String() string
func (*BalancerType) UnmarshalJSON ¶
func (t *BalancerType) UnmarshalJSON(raw []byte) error
type Dynamic ¶
type Dynamic struct {
// contains filtered or unexported fields
}
func (*Dynamic) Update ¶
func (dynamic *Dynamic) Update(opts UpdateOptions)
type EventType ¶
type EventType uint8
func (EventType) MarshalJSON ¶
func (*EventType) UnmarshalJSON ¶
type PollingResolver ¶
type PollingResolver struct {
// contains filtered or unexported fields
}
func NewPollingResolver ¶
func NewPollingResolver(opts PollingResolverOptions) (*PollingResolver, error)
func (*PollingResolver) CancelWatch ¶
func (res *PollingResolver) CancelWatch(id WatchID)
func (*PollingResolver) Close ¶
func (res *PollingResolver) Close()
func (*PollingResolver) Err ¶
func (res *PollingResolver) Err() error
func (*PollingResolver) Resolve ¶
func (res *PollingResolver) Resolve() (Resolved, error)
func (*PollingResolver) ResolveAll ¶
func (res *PollingResolver) ResolveAll() ([]Resolved, error)
func (*PollingResolver) ResolveNow ¶
func (res *PollingResolver) ResolveNow(opts ResolveNowOptions)
func (*PollingResolver) Update ¶
func (res *PollingResolver) Update(opts UpdateOptions)
func (*PollingResolver) Watch ¶
func (res *PollingResolver) Watch(fn WatchFunc) WatchID
type PollingResolverOptions ¶
type PollingResolverOptions struct { Context context.Context Random *rand.Rand PollInterval time.Duration CooldownInterval time.Duration Balancer BalancerType ResolveFunc PollingResolveFunc ClientConn grpcresolver.ClientConn ServiceConfigJSON string }
type ResolveNowOptions ¶
type ResolveNowOptions = grpcresolver.ResolveNowOptions
type Resolved ¶
type Resolved struct { Unique string Location string ServerName string SRVPriority uint16 SRVWeight uint16 ShardID uint32 Weight float32 HasSRV bool HasShardID bool HasWeight bool Err error Addr net.Addr Address Address Dynamic *Dynamic }
func GetResolved ¶
type ResolvedList ¶
type ResolvedList []Resolved
func (ResolvedList) Len ¶
func (list ResolvedList) Len() int
func (ResolvedList) Less ¶
func (list ResolvedList) Less(i, j int) bool
func (ResolvedList) Sort ¶
func (list ResolvedList) Sort()
func (ResolvedList) Swap ¶
func (list ResolvedList) Swap(i, j int)
type Resolver ¶
type Resolver interface { Err() error ResolveAll() ([]Resolved, error) Resolve() (Resolved, error) Update(opts UpdateOptions) Watch(WatchFunc) WatchID CancelWatch(WatchID) ResolveNow(ResolveNowOptions) Close() }
func NewATCResolver ¶
func NewDNSResolver ¶
func NewEtcdResolver ¶
func NewIPResolver ¶
func NewSRVResolver ¶
func NewUnixResolver ¶
func NewZKResolver ¶
type RoxyTarget ¶
type RoxyTarget struct { Scheme string Authority string Endpoint string ServerName string Query url.Values }
func RoxyTargetFromTarget ¶
func RoxyTargetFromTarget(target Target) (RoxyTarget, error)
func (RoxyTarget) AppendTo ¶
func (rt RoxyTarget) AppendTo(out *strings.Builder)
func (RoxyTarget) AsTarget ¶
func (rt RoxyTarget) AsTarget() Target
func (RoxyTarget) MarshalJSON ¶
func (rt RoxyTarget) MarshalJSON() ([]byte, error)
func (*RoxyTarget) Parse ¶
func (rt *RoxyTarget) Parse(str string) error
func (RoxyTarget) String ¶
func (rt RoxyTarget) String() string
func (*RoxyTarget) UnmarshalJSON ¶
func (rt *RoxyTarget) UnmarshalJSON(raw []byte) error
type StaticResolver ¶
type StaticResolver struct {
// contains filtered or unexported fields
}
func NewStaticResolver ¶
func NewStaticResolver(opts StaticResolverOptions) (*StaticResolver, error)
func (*StaticResolver) CancelWatch ¶
func (res *StaticResolver) CancelWatch(id WatchID)
func (*StaticResolver) Close ¶
func (res *StaticResolver) Close()
func (*StaticResolver) Err ¶
func (res *StaticResolver) Err() error
func (*StaticResolver) Resolve ¶
func (res *StaticResolver) Resolve() (Resolved, error)
func (*StaticResolver) ResolveAll ¶
func (res *StaticResolver) ResolveAll() ([]Resolved, error)
func (*StaticResolver) ResolveNow ¶
func (res *StaticResolver) ResolveNow(opts ResolveNowOptions)
func (*StaticResolver) Update ¶
func (res *StaticResolver) Update(opts UpdateOptions)
func (*StaticResolver) Watch ¶
func (res *StaticResolver) Watch(fn WatchFunc) WatchID
type StaticResolverOptions ¶
type StaticResolverOptions struct { Random *rand.Rand Balancer BalancerType Records []Resolved ClientConn grpcresolver.ClientConn ServiceConfigJSON string }
type Target ¶
type Target = grpcresolver.Target
type UpdateOptions ¶
type WatchingResolveFunc ¶
type WatchingResolveFunc func(ctx context.Context, wg *sync.WaitGroup, backoff expbackoff.ExpBackoff) (<-chan []Event, error)
func MakeATCResolveFunc ¶
func MakeEtcdResolveFunc ¶
func MakeZKResolveFunc ¶
type WatchingResolver ¶
type WatchingResolver struct {
// contains filtered or unexported fields
}
func NewWatchingResolver ¶
func NewWatchingResolver(opts WatchingResolverOptions) (*WatchingResolver, error)
func (*WatchingResolver) CancelWatch ¶
func (res *WatchingResolver) CancelWatch(id WatchID)
func (*WatchingResolver) Close ¶
func (res *WatchingResolver) Close()
func (*WatchingResolver) Err ¶
func (res *WatchingResolver) Err() error
func (*WatchingResolver) Resolve ¶
func (res *WatchingResolver) Resolve() (Resolved, error)
func (*WatchingResolver) ResolveAll ¶
func (res *WatchingResolver) ResolveAll() ([]Resolved, error)
func (*WatchingResolver) ResolveNow ¶
func (res *WatchingResolver) ResolveNow(opts ResolveNowOptions)
func (*WatchingResolver) Update ¶
func (res *WatchingResolver) Update(opts UpdateOptions)
func (*WatchingResolver) Watch ¶
func (res *WatchingResolver) Watch(fn WatchFunc) WatchID
type WatchingResolverOptions ¶
type WatchingResolverOptions struct { Context context.Context Random *rand.Rand Balancer BalancerType ResolveFunc WatchingResolveFunc ClientConn grpcresolver.ClientConn ServiceConfigJSON string }
Source Files ¶
- attributes.go
- balancer.go
- balancer_atc.go
- context.go
- dialopts.go
- enums.go
- errors.go
- globals.go
- impl_polling.go
- impl_static.go
- impl_watching.go
- parse.go
- resolver.go
- roxytarget.go
- scheme_atc.go
- scheme_dns.go
- scheme_etcd.go
- scheme_ip.go
- scheme_srv.go
- scheme_unix.go
- scheme_zk.go
- sort.go
- struct_event.go
- struct_resolved.go
- util.go
Click to show internal directories.
Click to hide internal directories.