Documentation ¶
Index ¶
- Variables
- type Client
- type Option
- func RegisterInterval(t time.Duration) Option
- func RegisterTTL(t time.Duration) Option
- func WithName(name string) Option
- func WithPoolSize(d int) Option
- func WithPoolTTL(d time.Duration) Option
- func WithRegistryNaming(reg registry.RegNaming) Option
- func WithScheme(name string) Option
- func WithServiceIps(ips []string) Option
- func WithServiceName(name string) Option
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultPoolMaxStreams maximum streams on a connectioin // (20) DefaultPoolMaxStreams = 20 // DefaultPoolMaxIdle maximum idle conns of a pool // (50) DefaultPoolMaxIdle = 50 // // DefaultNamingClient is a default client to use out of the box // DefaultNamingClient Client = newNamingClient() // // DefaultIPAddrClient is a default client to use addr to connection // DefaultIPAddrClient Client = newIPAddrClient() // DefaultRetries is the default number of times a request is tried DefaultRetries = 1 // DefaultRequestTimeout is the default request timeout DefaultRequestTimeout = time.Second * 5 // DefaultPoolSize sets the connection pool size DefaultPoolSize = 100 // DefaultPoolTTL sets the connection pool ttl DefaultPoolTTL = time.Minute // DefaultPoolTimeout sets the connection pool ttl DefaultPoolTimeout = 5 * time.Second // NewClient returns a new client NewClient func(...Option) Client = newNamingClient // NewIPAddrClient returns a new client NewIPAddrClient func(...Option) Client = newIPAddrClient )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { Init(...Option) error Options() Options String() string Next() (*poolConn, error) // next connon }
Client is the interface used to make requests to services. It supports Request/Response via Transport and Publishing via the Broker. It also supports bidirectional streaming of requests.
type Option ¶
type Option func(*Options)
Option used by the Client
func RegisterInterval ¶
RegisterInterval Register the service with at interval
func RegisterTTL ¶
RegisterTTL Register the service with a TTL
func WithPoolTTL ¶
WithPoolTTL sets the connection pool ttl
func WithRegistryNaming ¶
WithRegistryNaming 注册naming 服务发现
type Options ¶
type Options struct { // Connection Pool PoolSize int PoolTTL time.Duration TimeOut time.Duration Registry *registry.Registry // registry // The register expiry time RegisterTTL time.Duration // The interval on which to register RegisterInterval time.Duration Scheme string // client gmsec (注册名) // Other options for implementations of the interface // can be stored in a context Context context.Context // contains filtered or unexported fields }
Options client of options
Click to show internal directories.
Click to hide internal directories.