core

package
v0.0.0-...-6420a38 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2017 License: LGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIpvsSyscallFailed = errors.New("error while calling into IPVS")
	ErrObjectExists      = errors.New("specified object already exists")
	ErrObjectNotFound    = errors.New("unable to locate specified object")
	ErrIncompatibleAFs   = errors.New("incompatible address families")
)

Possible runtime errors.

View Source
var (
	ErrMissingEndpoint = errors.New("endpoint information is missing")
	ErrUnknownMethod   = errors.New("specified forwarding method is unknown")
	ErrUnknownProtocol = errors.New("specified protocol is unknown")
)

Possible validation errors.

Functions

func RegisterPrometheusExporter

func RegisterPrometheusExporter(ctx *Context)

Types

type BackendInfo

type BackendInfo struct {
	Options *BackendOptions `json:"options"`
	Metrics pulse.Metrics   `json:"metrics"`
}

BackendInfo contains information about backend options and pulse.

type BackendOptions

type BackendOptions struct {
	Host   string         `json:"host"`
	Port   uint16         `json:"port"`
	Weight int32          `json:"weight"`
	Method string         `json:"method"`
	Pulse  *pulse.Options `json:"pulse"`
	VsID   string         `json:"vsid,omitempty"`
	// contains filtered or unexported fields
}

BackendOptions describe a virtual service backend.

func (*BackendOptions) CompareStoreOptions

func (o *BackendOptions) CompareStoreOptions(options *BackendOptions) bool

func (*BackendOptions) Validate

func (o *BackendOptions) Validate() error

Validate fills missing fields and validates backend configuration.

type Context

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

Context abstacts away the underlying IPVS bindings implementation.

func NewContext

func NewContext(options ContextOptions) (*Context, error)

NewContext creates a new Context and initializes IPVS.

func (*Context) Close

func (ctx *Context) Close()

Close shuts down IPVS and closes the Context.

func (*Context) CreateBackend

func (ctx *Context) CreateBackend(vsID, rsID string, opts *BackendOptions) error

CreateBackend registers a new backend with a virtual service.

func (*Context) CreateService

func (ctx *Context) CreateService(vsID string, opts *ServiceOptions) error

CreateService registers a new virtual service with IPVS.

func (*Context) GetBackend

func (ctx *Context) GetBackend(vsID, rsID string) (*BackendInfo, error)

GetBackend returns information about a backend.

func (*Context) GetService

func (ctx *Context) GetService(vsID string) (*ServiceInfo, error)

GetService returns information about a virtual service.

func (*Context) ListServices

func (ctx *Context) ListServices() ([]string, error)

ListServices returns a list of all registered services.

func (*Context) RemoveBackend

func (ctx *Context) RemoveBackend(vsID, rsID string) (*BackendOptions, error)

RemoveBackend deregisters a backend.

func (*Context) RemoveService

func (ctx *Context) RemoveService(vsID string) (*ServiceOptions, error)

RemoveService deregisters a virtual service.

func (*Context) SetStore

func (ctx *Context) SetStore(store *Store)

if external kvstore exists, set store to context

func (*Context) Synchronize

func (ctx *Context) Synchronize(storeServices map[string]*ServiceOptions, storeBackends map[string]*BackendOptions)

func (*Context) UpdateBackend

func (ctx *Context) UpdateBackend(vsID, rsID string, weight int32) (int32, error)

UpdateBackend updates the specified backend's weight.

type ContextOptions

type ContextOptions struct {
	Disco        string
	Endpoints    []net.IP
	Flush        bool
	ListenPort   uint16
	VipInterface string
}

ContextOptions configure Context behavior.

type Exporter

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

func NewExporter

func NewExporter(ctx *Context) *Exporter

func (*Exporter) Collect

func (e *Exporter) Collect(ch chan<- prometheus.Metric)

func (*Exporter) Describe

func (e *Exporter) Describe(ch chan<- *prometheus.Desc)

type ServiceInfo

type ServiceInfo struct {
	Options  *ServiceOptions `json:"options"`
	Health   float64         `json:"health"`
	Backends []string        `json:"backends"`
}

ServiceInfo contains information about virtual service options, its backends and overall virtual service health.

type ServiceOptions

type ServiceOptions struct {
	Host       string `json:"host"`
	Port       uint16 `json:"port"`
	Protocol   string `json:"protocol"`
	Method     string `json:"method"`
	Persistent bool   `json:"persistent"`
	// contains filtered or unexported fields
}

ServiceOptions describe a virtual service.

func (*ServiceOptions) CompareStoreOptions

func (o *ServiceOptions) CompareStoreOptions(options *ServiceOptions) bool

func (*ServiceOptions) Validate

func (o *ServiceOptions) Validate(defaultHost net.IP) error

Validate fills missing fields and validates virtual service configuration.

type Store

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

func NewStore

func NewStore(storeUrl, storeServicePath, storeBackendPath string, syncTime int64, context *Context) (*Store, error)

func (*Store) Close

func (s *Store) Close()

func (*Store) CreateBackend

func (s *Store) CreateBackend(vsID, rsID string, opts *BackendOptions) error

func (*Store) CreateService

func (s *Store) CreateService(vsID string, opts *ServiceOptions) error

func (*Store) RemoveBackend

func (s *Store) RemoveBackend(rsID string) error

func (*Store) RemoveService

func (s *Store) RemoveService(vsID string) error

func (*Store) Sync

func (s *Store) Sync()

func (*Store) UpdateBackend

func (s *Store) UpdateBackend(vsID, rsID string, opts *BackendOptions) error

Jump to

Keyboard shortcuts

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