finago

package module
v0.0.0-...-057fa4a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2014 License: MIT Imports: 7 Imported by: 0

README

finago

Finago

etcd

Documentation

Index

Constants

View Source
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 Config

type Config struct {
	HartBeatInterval time.Duration
	TTL              time.Duration
}

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) Read

func (cp *ConnectionPool) Read(b []byte) (n int, err error)

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.

func (*ConnectionPool) Write

func (cp *ConnectionPool) Write(b []byte) (n int, err error)

Write writes data to the connection. Write can be made to time out and return a Error with Timeout() == true after a fixed time limit; see SetDeadline and SetWriteDeadline.

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

func NewSerivce

func NewSerivce(serviceName, ipaddr, port string, etcdClient *etcd.Client) *Service

func (*Service) Announce

func (s *Service) Announce() (err error)

announce service to etcd the TTL is 2*

func (*Service) Close

func (s *Service) Close()

remove key from etcd

func (*Service) SetHeatBeatInterval

func (s *Service) SetHeatBeatInterval(millisecond int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL