server

package
v0.0.0-...-1d0ba01 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Apache-2.0 Imports: 8 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Err error
}

Error ...

func NewError

func NewError(err error) *Error

NewError ...

func (*Error) Error

func (s *Error) Error() string

Error ...

func (*Error) Unwrap

func (s *Error) Unwrap() error

Unwrap ...

type Listener

type Listener interface {
	// Start is being called on the listener
	Start(context.Context, ReadyFunc) func() error
}

Listener is the interface to a listener, so starting and shutdown of a listener, or any routine.

type ReadyFunc

type ReadyFunc func()

ReadyFunc is the function that is called by Listener to signal that it is ready and the next Listener can be called.

type Server

type Server interface {
	// Run is running a new go routine
	Listen(listener Listener, ready bool)
	// Waits for the server to fail,
	// or gracefully shutdown if context is canceled
	Wait() error
}

Server is the interface to be implemented to run the server.

s, ctx := WithContext(context.Background())
s.Listen(listener, false)

if err := s.Wait(); err != nil {
	panic(err)
}

func WithContext

func WithContext(ctx context.Context, opts ...o.OptFunc) (Server, context.Context)

WithContext ...

Jump to

Keyboard shortcuts

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