service

package
v0.0.0-...-0183129 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const APIVersion = "0.0.9"

Variables

View Source
var BeGraceful = true // Parameter
View Source
var TooManyConnections = &TooManyConnectionsError{}
View Source
var UnknownSyntax = errors.New("unknown syntax")

Functions

func DWIMURI

func DWIMURI(ctx *core.Context, uri string) string

func GetHTTPRequest

func GetHTTPRequest(ctx *core.Context, r *http.Request) (map[string]interface{}, error)

func GetStringParam

func GetStringParam(m map[string]interface{}, p string, required bool) (string, bool, error)

func MaybeYAML

func MaybeYAML(bs []byte) bool

func StringMaps

func StringMaps(x interface{}) interface{}

StringMaps tries to makes (recursively) a map[string]interface{} from a map[interface{}]interface{} (which yaml.Unmarshal tends to provide). When something goes wrong, the original value is returned.

func Unmarshal

func Unmarshal(bs []byte, v interface{}) error

func UnmarshalYAML

func UnmarshalYAML(bs []byte, v interface{}) error

Types

type ConnStates

type ConnStates struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewConnStates

func NewConnStates() *ConnStates

func (*ConnStates) Get

func (cs *ConnStates) Get() map[string]int64

func (*ConnStates) Inc

func (cs *ConnStates) Inc(state string)

type HTTPService

type HTTPService struct {
	Ctx     *core.Context
	Service *Service
	// contains filtered or unexported fields
}

func NewHTTPService

func NewHTTPService(ctx *core.Context, service *Service) (*HTTPService, error)

func (*HTTPService) MaxPending

func (s *HTTPService) MaxPending() int32

func (*HTTPService) Maxed

func (s *HTTPService) Maxed() (bool, int32)

func (*HTTPService) Pending

func (s *HTTPService) Pending() int32

func (*HTTPService) ServeHTTP

func (s *HTTPService) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*HTTPService) SetMaxPending

func (s *HTTPService) SetMaxPending(max int32)

func (*HTTPService) Start

func (s *HTTPService) Start(ctx *core.Context, servicePort string) error

type Listener

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

func NewListener

func NewListener(ctx *core.Context, s *HTTPService, port string, admin bool) (*Listener, error)

func (*Listener) Accept

func (l *Listener) Accept() (c net.Conn, err error)

func (*Listener) Addr

func (l *Listener) Addr() net.Addr

func (*Listener) Close

func (l *Listener) Close() error

func (*Listener) Drain

func (l *Listener) Drain(d time.Duration) int

func (*Listener) Stop

func (l *Listener) Stop(d time.Duration) error

type Redirect

type Redirect struct {
	To string
}

Redirect packaged up directive to send a client to another process.

Not currently used. Will be used when we have a Router.

func (*Redirect) Error

func (r *Redirect) Error() string

type Service

type Service struct {
	System *System

	// Router is a placeholder for a router, a component which can
	// determine what process hosts a given location.  We'll
	// introduce some router implementations in the future.
	Router interface{}

	// Stopper is function we call when we want to shut ourselves down.
	//
	// Typically this function is defined by the HTTP server to
	// provide a hook to shut down that server.
	Stopper func(*core.Context, time.Duration) error
}

func (*Service) HealthDeep

func (s *Service) HealthDeep(ctx *core.Context) error

func (*Service) HealthDeeper

func (s *Service) HealthDeeper(ctx *core.Context) error

func (*Service) ProcessRequest

func (s *Service) ProcessRequest(ctx *core.Context, m map[string]interface{}, out io.Writer) (map[string]interface{}, error)

func (*Service) Shutdown

func (s *Service) Shutdown(ctx *core.Context) error

func (*Service) Start

func (s *Service) Start(ctx *core.Context, enginePort string) error

type TooManyConnectionsError

type TooManyConnectionsError struct {
}

func (*TooManyConnectionsError) Error

func (e *TooManyConnectionsError) Error() string

func (*TooManyConnectionsError) Temporary

func (e *TooManyConnectionsError) Temporary() bool

func (*TooManyConnectionsError) Timeout

func (e *TooManyConnectionsError) Timeout() bool

Jump to

Keyboard shortcuts

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