Documentation ¶
Overview ¶
Library for establishing Thrift network connections for clients. Provides Dialer interface with basic implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompositeResolver ¶
type CompositeResolver struct {
// contains filtered or unexported fields
}
CompositeResolves resolves by resolving, in order, via delegates
func NewCompositeResolver ¶
func NewCompositeResolver(dels ...Resolver) *CompositeResolver
NewCompositeResolves creates a new CompositeResolve that resolves by looking through delegates (in order) A Resolver that returns ("", nil) is ignored, otherwise its result is retuned CompositeResolver will error if no delegate returned a non-empty result
func (*CompositeResolver) Resolve ¶
func (r *CompositeResolver) Resolve() (string, error)
Resolve resolves by resolving, in order, via delegates
func (*CompositeResolver) ResolveMany ¶
func (r *CompositeResolver) ResolveMany(n int) ([]string, error)
ResolveMany resolves by resolving, in order, via delegates
type ConstantResolver ¶
type ConstantResolver struct {
// contains filtered or unexported fields
}
ConstantResolver always returns the same value
func NewConstantResolver ¶
func NewConstantResolver(s string) *ConstantResolver
NewConstantResolver creates a ConstantResolver
func (*ConstantResolver) Resolve ¶
func (r *ConstantResolver) Resolve() (string, error)
Resolve returns the constant
func (*ConstantResolver) ResolveMany ¶
func (r *ConstantResolver) ResolveMany(n int) ([]string, error)
ResolveMany returns the constant in a slice
type Dialer ¶
type Dialer interface {
Dial(addr string) (thrift.TTransport, thrift.TProtocolFactory, error)
}
Interface for initializing a thrift connection for a client
func NewSimpleDialer ¶
func NewSimpleDialer(tf thrift.TTransportFactory, pf thrift.TProtocolFactory, timeout time.Duration) Dialer
Create instance of basic Dialer that manages thrift transport/protocol factories. Opens a thrift connection directly to the given address.
type EnvResolver ¶
type EnvResolver struct {
// contains filtered or unexported fields
}
EnvResolver resolves by looking for a key in the OS Environment
func NewEnvResolver ¶
func NewEnvResolver(key string) *EnvResolver
NewEnvResolver creates a new EnvResolver
func (*EnvResolver) Resolve ¶
func (r *EnvResolver) Resolve() (string, error)
Resolve resolves by looking for a key in the OS Environment
func (*EnvResolver) ResolveMany ¶
func (r *EnvResolver) ResolveMany(n int) ([]string, error)
ResolveMany returns the env key in a slice
type Resolver ¶
type Resolver interface { // Resolve resolves a service, getting an address or URL // If a Resolve() call completes successfully but finds no addresses, it will return ("", nil) Resolve() (string, error) // ResolveMany resolves a slice of random addresses or URLs // The int parameter specifies the maximum number of addresses to return. If <= 0, all addresses are returned. // If the call completes successfully but finds no addresses, it will return ([]string{}, nil) ResolveMany(int) ([]string, error) }
Resolver resolves a service, getting an address or URL.