server

package
v4.0.0-alpha3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeMetaPID       = "PID"
	NodeMetaParentPID = "parentPID"
	NodeMetaMetrics   = "metrics"
	NodeMetaStartTag  = "start"
	NodeMetaHostName  = "hostname"
)

Variables

This section is empty.

Functions

func InitPeerMeta

func InitPeerMeta() map[string]string

Types

type HttpMux

type HttpMux interface {
	Handler(r *http.Request) (h http.Handler, pattern string)
	ServeHTTP(w http.ResponseWriter, r *http.Request)
	Handle(pattern string, handler http.Handler)
	HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
}

type ListableMux

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

ListableMux is a simple rewrite of http.ServeMux with accessor to the list of registered patterns

func NewListableMux

func NewListableMux() *ListableMux

NewListableMux allocates and returns a new ListableMux.

func (*ListableMux) Handle

func (mux *ListableMux) Handle(pattern string, handler http.Handler)

Handle registers the handler for the given pattern. If a handler already exists for pattern, Handle panics.

func (*ListableMux) HandleFunc

func (mux *ListableMux) HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))

HandleFunc registers the handler function for the given pattern.

func (*ListableMux) Handler

func (mux *ListableMux) Handler(r *http.Request) (h http.Handler, pattern string)

Handler returns the handler to use for the given request, consulting r.Method, r.Host, and r.URL.Path. It always returns a non-nil handler. If the path is not in its canonical form, the handler will be an internally-generated handler that redirects to the canonical path. If the host contains a port, it is ignored when matching handlers.

The path and host are used unchanged for CONNECT requests.

Handler also returns the registered pattern that matches the request or, in the case of internally-generated redirects, the pattern that will match after following the redirect.

If there is no registered handler that applies to the request, Handler returns a “page not found” handler and an empty pattern.

func (*ListableMux) Patterns

func (mux *ListableMux) Patterns() (patterns []string)

Patterns list registered patterns using the internal lock on the mux.m map

func (*ListableMux) ServeHTTP

func (mux *ListableMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP dispatches the request to the handler whose pattern most closely matches the request URL.

type PatternsProvider

type PatternsProvider interface {
	Patterns() []string
}

type RawServer

type RawServer interface {
	Serve() error
	Stop() error
	Address() []string
	Name() string
	ID() string
	Type() ServerType
	Endpoints() []string
	Metadata() map[string]string
	As(interface{}) bool
}

type Server

type Server interface {
	RawServer
	BeforeServe(func() error)
	AfterServe(func() error)
	BeforeStop(func() error)
	AfterStop(func() error)
}

func NewServer

func NewServer(ctx context.Context, s RawServer) Server

type ServerOption

type ServerOption func(*ServerOptions)

ServerOption is a function to set ServerOptions

func AfterServe

func AfterServe(f func() error) ServerOption

func AfterStop

func AfterStop(f func() error) ServerOption

func BeforeServe

func BeforeServe(f func() error) ServerOption

BeforeServe executes function before starting the server

func BeforeStop

func BeforeStop(f func() error) ServerOption

func OnServeError

func OnServeError(f func(error)) ServerOption

type ServerOptions

type ServerOptions struct {
	Context  context.Context
	Listener *net.Listener

	// Before and After funcs
	BeforeServe []func() error
	AfterServe  []func() error
	BeforeStop  []func() error
	AfterStop   []func() error
	// contains filtered or unexported fields
}

ServiceOptions stores all options for a pydio service

type ServerType

type ServerType int8
const (
	ServerType_GRPC ServerType = iota
	ServerType_HTTP
	ServerType_GENERIC
	ServerType_FORK
)

Directories

Path Synopsis
mux
Package servercontext performs context values read/write, generally through server or client wrappers
Package servercontext performs context values read/write, generally through server or client wrappers

Jump to

Keyboard shortcuts

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