Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RoundRobinWriter ¶
func RoundRobinWriter(instanceProvider InstanceProvider, sender Sender) io.Writer
RoundRobinWriter returns writer with round robin functionality. Every write could be sent to different backend.
Types ¶
type DiscoveryServiceClient ¶
type DiscoveryServiceClient interface { // GetAddrsByName returns list of services with given name GetAddrsByName(serviceName string) ([]Address, error) }
DiscoveryServiceClient represents generic discovery service client that can return list of services
func NewConsulDiscoveryServiceClient ¶
func NewConsulDiscoveryServiceClient(client *api.Client) DiscoveryServiceClient
NewConsulDiscoveryServiceClient returns DiscoverServiceClient backed by Consul
type InstanceProvider ¶
type InstanceProvider <-chan []Address
InstanceProvider is the channel where updated list of desired service are published.
func DiscoveryServiceInstanceProvider ¶
func DiscoveryServiceInstanceProvider(serviceName string, interval time.Duration, client DiscoveryServiceClient) InstanceProvider
DiscoveryServiceInstanceProvider returns InstanceProvider that is updated with list of instances in interval
type MultiError ¶
type MultiError []error
MultiError is returned by batch operations when there are errors with particular elements.
func (MultiError) Error ¶
func (m MultiError) Error() string
type Sender ¶
type Sender interface { // Send writes given payload to passed address. It returns number of bytes // sent and error - if there was any. Send(Address, []byte) (int, error) // Release frees all system resources allocated by the Sender. It can be // called many times - usually when the pool of used addresses changes. Release() error }
Sender is a interface for different sending protocols through the network.
type TCPSender ¶
TCPSender is a Sender implementation that can write payload to the network address and reuses TCP connections for the same addresses.
type UDPSender ¶
type UDPSender struct {
// contains filtered or unexported fields
}
UDPSender is a Sender implementation that can write payload to the network address and reuses single system socket. It uses UDP packets to send data.