ramius

package
v0.0.0-...-1beef81 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2014 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ClientFailedToConnect = &RetryableError{errors.New("failed to get connection")}

Functions

This section is empty.

Types

type Client

type Client struct {
	Pool                  *ConnectionManager
	WaitToGet             time.Duration
	BackoffMaxInterval    time.Duration
	BackoffMaxElapsedTime time.Duration
}

func (*Client) Call

func (c *Client) Call(serviceMethod string, args interface{}, reply interface{}) error

type Connection

type Connection struct {
	sync.Mutex
	ServerConfig ServerConfig
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(server ServerConfig) *Connection

func (*Connection) Activate

func (c *Connection) Activate() error

func (*Connection) Call

func (c *Connection) Call(serviceMethod string, args interface{}, reply interface{}) error

func (*Connection) Close

func (c *Connection) Close() error

func (*Connection) DidFail

func (c *Connection) DidFail() bool

func (*Connection) IsHealthy

func (c *Connection) IsHealthy() bool

func (*Connection) MarkFailed

func (c *Connection) MarkFailed()

func (*Connection) Reset

func (c *Connection) Reset()

type ConnectionManager

type ConnectionManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewConnectionManager

func NewConnectionManager(servers *ServerSet, size int) *ConnectionManager

func (*ConnectionManager) Get

func (m *ConnectionManager) Get(timeout time.Duration) *Connection

func (*ConnectionManager) Init

func (m *ConnectionManager) Init()

func (*ConnectionManager) Pooled

func (m *ConnectionManager) Pooled() []string

func (*ConnectionManager) Put

func (m *ConnectionManager) Put(conn *Connection)

func (*ConnectionManager) Stats

func (m *ConnectionManager) Stats() map[string]int

type RetryableError

type RetryableError struct {
	Err error
}

func (*RetryableError) Error

func (re *RetryableError) Error() string

type ServerConfig

type ServerConfig struct {
	Addr   net.Addr
	IsHttp bool
}

func (ServerConfig) String

func (s ServerConfig) String() string

type ServerSet

type ServerSet struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewServerSet

func NewServerSet(servers []ServerConfig, quarantinePeriod time.Duration) *ServerSet

func (*ServerSet) All

func (s *ServerSet) All() []ServerConfig

func (*ServerSet) Quarantine

func (s *ServerSet) Quarantine(server ServerConfig)

func (*ServerSet) QuarantineMap

func (s *ServerSet) QuarantineMap() map[string]time.Duration

Jump to

Keyboard shortcuts

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