connmgr

package module
v0.0.0-...-e1adefc Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

README

connmgr

[WIP] HA Connection Manager

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoResolver = errors.New("no resolver for custom type")

Functions

func AddResolverFor

func AddResolverFor(t HostType, createResolver func() Resolver)

AddResolverFor given HostType. Resolver's methods must not panic (we do not handle panics).

Types

type HTTPResolver

type HTTPResolver struct {
	// contains filtered or unexported fields
}

func (*HTTPResolver) Do

func (r *HTTPResolver) Do(addr string) error

func (*HTTPResolver) Load

func (r *HTTPResolver) Load(cfg KV) error

type Host

type Host struct {
	// contains filtered or unexported fields
}

Host handles an abstract host. It could be raw TCP/UDP, or something like HTTP, for that reason Addr is a string.

func NewHost

func NewHost(t HostType, addr, pingAddr string) *Host

NewHost creates a new Host instance

func (*Host) Addr

func (h *Host) Addr() string

func (*Host) Config

func (h *Host) Config() KV

func (*Host) PingAddr

func (h *Host) PingAddr() string

func (*Host) RTT

func (h *Host) RTT() (time.Duration, error)

func (*Host) SetTimeout

func (h *Host) SetTimeout(t time.Duration)

func (*Host) Type

func (h *Host) Type() HostType

type HostType

type HostType uint8
const (
	HostTypeHTTP HostType = iota
)

type KV

type KV struct {
	// contains filtered or unexported fields
}

func (*KV) Get

func (kv *KV) Get(key string) (value interface{})

func (*KV) GetWithDefault

func (kv *KV) GetWithDefault(key string, defaultValue interface{}) (value interface{})

func (*KV) Set

func (kv *KV) Set(key string, value interface{})

type Pool

type Pool struct {
	// contains filtered or unexported fields
}

func NewPool

func NewPool(hosts ...*Host) *Pool

func (*Pool) Add

func (p *Pool) Add(h *Host)

func (*Pool) GetHost

func (p *Pool) GetHost() *Host

func (*Pool) GetHostUncached

func (p *Pool) GetHostUncached() *Host

func (*Pool) GetNextHost

func (p *Pool) GetNextHost() *Host

type Resolver

type Resolver interface {
	Do(addr string) error
	Load(cfg KV) error
}

func NewHTTPResolver

func NewHTTPResolver() Resolver

Directories

Path Synopsis
testutils

Jump to

Keyboard shortcuts

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