Documentation ¶
Index ¶
- Constants
- type Config
- type ConnectionPool
- func (cp *ConnectionPool) Close() error
- func (cp *ConnectionPool) LocalAddr() net.Addr
- func (cp *ConnectionPool) Read(b []byte) (n int, err error)
- func (cp *ConnectionPool) RemoteAddr() net.Addr
- func (cp *ConnectionPool) SetDeadline(t time.Time) error
- func (cp *ConnectionPool) SetReadDeadline(t time.Time) error
- func (cp *ConnectionPool) SetWriteDeadline(t time.Time) error
- func (cp *ConnectionPool) Write(b []byte) (n int, err error)
- type ConnectionPoolFactory
- type Service
Constants ¶
const ( DEFAULT_HEARTBEAT_INTERVAL = 1000 * time.Millisecond MINIMUM_HEARTBEAT_INTERVAL = 50 * time.Millisecond // avoid too fast beacon )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectionPool ¶
type ConnectionPool struct {
// contains filtered or unexported fields
}
func (*ConnectionPool) Close ¶
func (cp *ConnectionPool) Close() error
Close closes the connection. Any blocked Read or Write operations will be unblocked and return errors.
func (*ConnectionPool) LocalAddr ¶
func (cp *ConnectionPool) LocalAddr() net.Addr
LocalAddr returns the local network address.
func (*ConnectionPool) RemoteAddr ¶
func (cp *ConnectionPool) RemoteAddr() net.Addr
RemoteAddr returns the remote network address.
func (*ConnectionPool) SetDeadline ¶
func (cp *ConnectionPool) SetDeadline(t time.Time) error
SetDeadline sets the read and write deadlines associated with the connection. It is equivalent to calling both SetReadDeadline and SetWriteDeadline.
A deadline is an absolute time after which I/O operations fail with a timeout (see type Error) instead of blocking. The deadline applies to all future I/O, not just the immediately following call to Read or Write.
An idle timeout can be implemented by repeatedly extending the deadline after successful Read or Write calls.
A zero value for t means I/O operations will not time out.
func (*ConnectionPool) SetReadDeadline ¶
func (cp *ConnectionPool) SetReadDeadline(t time.Time) error
SetReadDeadline sets the deadline for future Read calls. A zero value for t means Read will not time out.
func (*ConnectionPool) SetWriteDeadline ¶
func (cp *ConnectionPool) SetWriteDeadline(t time.Time) error
SetWriteDeadline sets the deadline for future Write calls. Even if write times out, it may return n > 0, indicating that some of the data was successfully written. A zero value for t means Write will not time out.
type ConnectionPoolFactory ¶
type ConnectionPoolFactory struct {
// contains filtered or unexported fields
}
func NewConnectionPoolFactory ¶
func NewConnectionPoolFactory( dests []string, maxConnections int, connectTimeout time.Duration) *ConnectionPoolFactory
func (*ConnectionPoolFactory) Build ¶
func (factory *ConnectionPoolFactory) Build() *ConnectionPool
type Service ¶
type Service struct { Name string Dst string Port string // contains filtered or unexported fields }
func GetAvailableServices ¶
func GetAvailableServices(serviceName string, etcdClient *etcd.Client) (serviceList []*Service, err error)
ToDo: return dest for connectionPool return a list of services