Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInterruptNotifier

func NewInterruptNotifier(log logr.Logger) chan struct{}

NewInterruptNotifier returns a channel wich is closed on a received interrupt

func NewTerminatedNotifier

func NewTerminatedNotifier() chan struct{}

NewTerminatedNotifier creates a channel which can be used to listen to the termination of the server group

Types

type BlazeServer

type BlazeServer interface {
	//Start starts a server which waits on close of the interrupt channel and modifies the wg
	Start(interrupt chan struct{}, wg *sync.WaitGroup)
	//Walk prints the registered routes
	Walk()
}

BlazeServer defines a blaze server

type BlazeServerBuilder

type BlazeServerBuilder interface {
	//Add Middleware adds one or many middlewares to the server
	AddMiddleware(middlewares ...func(http.Handler) http.Handler)
	//AddServerMount Adds Mountpoints to the server
	AddServerMount(svm ...BlazeServiceMount)
	//Build creates the server
	Build() BlazeServer
}

BlazeServerBuilder is a Builder for blaze servers

func NewServerBuilder

func NewServerBuilder(listenAddr string, logger logr.Logger, opts ...Option) BlazeServerBuilder

NewServerBuilder creates a new server Builder

type BlazeServerGroup

type BlazeServerGroup interface {
	//Start starts all registered servers
	Start()
	//GetTerminationNotfier returns a channel which will be closed on termination of all servers
	GetTerminationNotfier() chan struct{}
	//Wait blocks until all servers are terminated
	Wait()
}

BlazeServerGroup defines a BlazeServerGroup

func NewBlazeServerGroup

func NewBlazeServerGroup(interrupt chan struct{}, terminated chan struct{}, servers ...BlazeServer) BlazeServerGroup

NewBlazeServerGroup creates a new server group

func NewServerGroupFromBuilders

func NewServerGroupFromBuilders(interrupt chan struct{}, terminated chan struct{}, printRoutes bool, builder ...BlazeServerBuilder) BlazeServerGroup

NewServerGroupFromBuilders creates a server group from builders as a convenience function

type BlazeServiceMount

type BlazeServiceMount interface {
	Service() blaze.Service
	Mounts() []string
}

BlazeServiceMount defines a Service and a list of mountpoints e.g "/", "prefix"

func NewBlazeServiceMount

func NewBlazeServiceMount(srv blaze.Service, paths ...string) BlazeServiceMount

NewBlazeServiceMount creates a new ServiceMount

type Option

type Option func(*Options)

Option is a functional option for extending a Blaze server.

func WithIdleTimeout added in v0.2.3

func WithIdleTimeout(timeout time.Duration) Option

WithIdleTimeout allows to set the IdleTimeout to use by a server

func WithMux

func WithMux(mux *chi.Mux) Option

WithMux allows to set the chi mux to use by a server

func WithReadTimeout added in v0.2.3

func WithReadTimeout(timeout time.Duration) Option

WithReadTimeout allows to set the ReadTimeout to use by a server

func WithWriteTimeout added in v0.2.3

func WithWriteTimeout(timeout time.Duration) Option

WithWriteTimeout allows to set the WriteTimeout to use by a server

type Options

type Options struct {
	// Uses a specific mux instead of chi.NewRouter()
	Mux *chi.Mux
	// contains filtered or unexported fields
}

Options encapsulate the configurable parameters on a Blaze server.

Jump to

Keyboard shortcuts

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