server

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2014 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Metrics = "_metrics"
	PerfMon = "_perfMon"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FileDescriptor

type FileDescriptor struct {
	Address backend.Address
	File    *os.File
}

func (*FileDescriptor) String

func (fd *FileDescriptor) String() string

func (*FileDescriptor) ToListener

func (fd *FileDescriptor) ToListener() (net.Listener, error)

type MuxServer

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

MuxServer is capable of listening on multiple interfaces, graceful shutdowns and updating TLS certificates

func NewMuxServerWithOptions

func NewMuxServerWithOptions(id int, o Options) (*MuxServer, error)

func (*MuxServer) AddHostListener

func (m *MuxServer) AddHostListener(h *backend.Host, l *backend.Listener) error

func (*MuxServer) DeleteEndpoint

func (m *MuxServer) DeleteEndpoint(upstream *backend.Upstream, endpointId string) error

func (*MuxServer) DeleteHost

func (m *MuxServer) DeleteHost(hostname string) error

func (*MuxServer) DeleteHostListener

func (m *MuxServer) DeleteHostListener(host *backend.Host, listenerId string) error

func (*MuxServer) DeleteLocation

func (m *MuxServer) DeleteLocation(host *backend.Host, locationId string) error

func (*MuxServer) DeleteLocationMiddleware

func (m *MuxServer) DeleteLocationMiddleware(host *backend.Host, loc *backend.Location, mType, mId string) error

func (*MuxServer) DeleteUpstream

func (m *MuxServer) DeleteUpstream(upstreamId string) error

func (*MuxServer) GetEndpointStats

func (m *MuxServer) GetEndpointStats(e *backend.Endpoint) (*backend.RoundTripStats, error)

func (*MuxServer) GetFiles

func (m *MuxServer) GetFiles() ([]*FileDescriptor, error)

func (*MuxServer) GetLocationStats

func (m *MuxServer) GetLocationStats(l *backend.Location) (*backend.RoundTripStats, error)

func (*MuxServer) GetTopEndpoints

func (m *MuxServer) GetTopEndpoints(upstreamId string) ([]*backend.Endpoint, error)

func (*MuxServer) GetTopLocations

func (m *MuxServer) GetTopLocations(hostname, upstreamId string) ([]*backend.Location, error)

func (*MuxServer) GetUpstreamStats

func (m *MuxServer) GetUpstreamStats(u *backend.Upstream) (*backend.RoundTripStats, error)

func (*MuxServer) Start

func (m *MuxServer) Start() error

func (*MuxServer) Stop

func (m *MuxServer) Stop(wait bool)

func (*MuxServer) String

func (m *MuxServer) String() string

func (*MuxServer) TakeFiles

func (m *MuxServer) TakeFiles(files []*FileDescriptor) error

func (*MuxServer) UpdateHostKeyPair

func (m *MuxServer) UpdateHostKeyPair(hostname string, keyPair *backend.KeyPair) error

func (*MuxServer) UpdateLocationOptions

func (m *MuxServer) UpdateLocationOptions(host *backend.Host, loc *backend.Location) error

func (*MuxServer) UpdateLocationPath

func (m *MuxServer) UpdateLocationPath(host *backend.Host, loc *backend.Location, path string) error

func (*MuxServer) UpdateLocationUpstream

func (m *MuxServer) UpdateLocationUpstream(host *backend.Host, loc *backend.Location) error

func (*MuxServer) UpsertEndpoint

func (m *MuxServer) UpsertEndpoint(upstream *backend.Upstream, e *backend.Endpoint) error

func (*MuxServer) UpsertHost

func (m *MuxServer) UpsertHost(host *backend.Host) error

func (*MuxServer) UpsertLocation

func (m *MuxServer) UpsertLocation(host *backend.Host, loc *backend.Location) error

func (*MuxServer) UpsertLocationMiddleware

func (m *MuxServer) UpsertLocationMiddleware(host *backend.Host, loc *backend.Location, mi *backend.MiddlewareInstance) error

func (*MuxServer) UpsertUpstream

func (m *MuxServer) UpsertUpstream(u *backend.Upstream) error

type NewServerFn

type NewServerFn func(id int) (Server, error)

type Options

type Options struct {
	MetricsClient   metrics.Client
	DialTimeout     time.Duration
	ReadTimeout     time.Duration
	WriteTimeout    time.Duration
	MaxHeaderBytes  int
	DefaultListener *backend.Listener
	Files           []*FileDescriptor
	TimeProvider    timetools.TimeProvider
}

type Reporter

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

Reporter reports real time metrics to the Statsd client

func NewReporter

func NewReporter(c metrics.Client, locationId string) *Reporter

func (*Reporter) ObserveRequest

func (rp *Reporter) ObserveRequest(r request.Request)

func (*Reporter) ObserveResponse

func (rp *Reporter) ObserveResponse(r request.Request, a request.Attempt)

type Server

type Server interface {
	backend.StatsProvider

	UpsertHost(host *backend.Host) error
	DeleteHost(hostname string) error
	UpdateHostKeyPair(hostname string, keyPair *backend.KeyPair) error

	AddHostListener(host *backend.Host, l *backend.Listener) error
	DeleteHostListener(host *backend.Host, listenerId string) error

	UpsertLocation(host *backend.Host, loc *backend.Location) error
	DeleteLocation(host *backend.Host, locationId string) error

	UpsertUpstream(u *backend.Upstream) error
	DeleteUpstream(upstreamId string) error

	UpdateLocationUpstream(host *backend.Host, loc *backend.Location) error
	UpdateLocationPath(host *backend.Host, loc *backend.Location, path string) error
	UpdateLocationOptions(host *backend.Host, loc *backend.Location) error

	UpsertLocationMiddleware(host *backend.Host, loc *backend.Location, mi *backend.MiddlewareInstance) error
	DeleteLocationMiddleware(host *backend.Host, loc *backend.Location, mType, mId string) error

	UpsertEndpoint(upstream *backend.Upstream, e *backend.Endpoint) error
	DeleteEndpoint(upstream *backend.Upstream, endpointId string) error

	// TakeFiles takes file descriptors representing sockets in listening state to start serving on them
	// instead of binding. This is nessesary if the child process needs to inherit sockets from the parent
	// (e.g. for graceful restarts)
	TakeFiles([]*FileDescriptor) error

	// GetFiles exports listening socket's underlying dupped file descriptors, so they can later
	// be passed to child process or to another Server
	GetFiles() ([]*FileDescriptor, error)

	Start() error
	Stop(wait bool)
}

Jump to

Keyboard shortcuts

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