common

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2019 License: LGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrAppCall returned by cocaine in very strange case
	ErrAppCall = errors.New("Application call error")
	// ErrAppUnavailable is an application for parsing/aggregating is not found
	ErrAppUnavailable = errors.New("Application is unavailable")
	// ErrLockOwned say about config alredy created in this zk session by this server
	ErrLockOwned = errors.New("Config lock owned")
	// ErrLockByAnother say about config alredy locked by another client
	ErrLockByAnother = errors.New("Config locked by another client")
	// ErrRTCGeoMissing ...
	ErrRTCGeoMissing = errors.New("RTCFetcher Geo not defined")
	// ErrMissingFormatSpecifier used by httpFetcher
	ErrMissingFormatSpecifier = errors.New(`Missing format specifier '%s' in BasicUrl`)
	// ErrNoHosts returned when fetcher cannot fetch hosts
	ErrNoHosts = errors.New("No hosts")
)

Functions

func RegisterFetcherLoader added in v1.8.0

func RegisterFetcherLoader(name string, f FetcherLoader) error

RegisterFetcherLoader register new fetcher loader function

Types

type FetcherLoader added in v1.8.0

type FetcherLoader func(repository.PluginConfig) (HostFetcher, error)

FetcherLoader is type of function is responsible for loading fetchers

type HostFetcher added in v1.8.0

type HostFetcher interface {
	Fetch(group string) (hosts.Hosts, error)
	// contains filtered or unexported methods
}

HostFetcher interface

func LoadHostFetcher added in v1.8.0

func LoadHostFetcher(config repository.PluginConfig) (HostFetcher, error)

LoadHostFetcher create, configure and return new hosts fetcher

func LoadHostFetcherWithCache added in v1.8.0

func LoadHostFetcherWithCache(config repository.PluginConfig, cache *cache.TTLCache) (HostFetcher, error)

LoadHostFetcherWithCache create, configure and return new hosts fetcher

type PredefineFetcher added in v1.8.0

type PredefineFetcher struct {
	PredefineFetcherConfig
	// contains filtered or unexported fields
}

PredefineFetcher is map[string /*datacenter name*/][]string /*list of hosts*/

func (*PredefineFetcher) Fetch added in v1.8.0

func (p *PredefineFetcher) Fetch(groupname string) (hosts.Hosts, error)

Fetch return hosts list from PredefineFetcher or error

type PredefineFetcherConfig added in v1.8.0

type PredefineFetcherConfig struct {
	Clusters map[string]hosts.Hosts
}

PredefineFetcherConfig filled from combainer config

type QDNSFetcher added in v1.8.0

type QDNSFetcher struct {
	Resolver     string
	QueryTimeout int64
	// contains filtered or unexported fields
}

QDNSFetcher recive hosts from dns discovery

func (*QDNSFetcher) Fetch added in v1.8.0

func (d *QDNSFetcher) Fetch(entity string) (hosts.Hosts, error)

Fetch hosts from dns discovery service

type RTCFetcher added in v1.8.0

type RTCFetcher struct {
	ReadTimeout int64
	Geo         []string `mapstructure:"geo"`
	BasicURL    string   `mapstructure:"BasicUrl"`
	Delimiter   string   `mapstructure:"Delimiter"`
	// contains filtered or unexported fields
}

RTCFetcher recive hosts from RTC groups

func (*RTCFetcher) Fetch added in v1.8.0

func (s *RTCFetcher) Fetch(groupname string) (hosts.Hosts, error)

Fetch resolve the group name in the list of hosts

type SimpleFetcher added in v1.8.0

type SimpleFetcher struct {
	Separator   string
	Format      string
	ReadTimeout int64
	Options     map[string]string
	BasicURL    string `mapstructure:"BasicUrl"`
	// contains filtered or unexported fields
}

SimpleFetcher recive plain text with tab separated fields it expect format `fqdn\tdatacenter` or json configured by Format config

func (*SimpleFetcher) Fetch added in v1.8.0

func (s *SimpleFetcher) Fetch(groupname string) (hosts.Hosts, error)

Fetch resolve the group name in the list of hosts

type ZKFetcher added in v1.8.0

type ZKFetcher struct {
	Servers   []string `mapstructure:"servers"`
	StripPort bool     `mapstructure:"strip_port"`
	// contains filtered or unexported fields
}

ZKFetcher recive hosts from ZK dir

func (*ZKFetcher) Fetch added in v1.8.0

func (s *ZKFetcher) Fetch(path string) (hosts.Hosts, error)

Fetch hosts from zk node

Directories

Path Synopsis
Package chttp is combaine http client
Package chttp is combaine http client

Jump to

Keyboard shortcuts

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