Documentation ¶
Overview ¶
Simple RPC client balancer
Index ¶
- type Balancer
- func (bl *Balancer) AddClient(address string, client Worker)
- func (bl *Balancer) Balance() (result Worker)
- func (bl *Balancer) GetClient(address string) (c Worker, exists bool)
- func (bl *Balancer) GetClientAddresses() []string
- func (bl *Balancer) RemoveClient(address string)
- func (bl *Balancer) Shutdown(shutdownMethod string)
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Balancer ¶
The main balancer type
func NewBalancer ¶
func NewBalancer() *Balancer
Constructor for RateList holding one slice for addreses and one slice for connections.
func (*Balancer) Balance ¶
Returns the next available connection at each call looping at the end of connections.
func (*Balancer) GetClientAddresses ¶
Returns a string slice with all client addresses
func (*Balancer) RemoveClient ¶
Removes a client from the map locking the readers and reseting the balancer index.
Click to show internal directories.
Click to hide internal directories.