server

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2023 License: Apache-2.0 Imports: 9 Imported by: 12

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, RunFunc) 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 RunFunc

type RunFunc func(func() error)

RunFunc is a function that is called to attach more routines to the server.

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

	// SetLimit ...
	SetLimit(n int)
}

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 ...

type Service

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

Service ...

func (*Service) Lookup

func (s *Service) Lookup(env ServiceEnv) string

Loopkup ...

type ServiceEnv

type ServiceEnv []string

ServiceEnv ...

type Unimplemented

type Unimplemented struct{}

Unimplemented is the default implementation.

func (*Unimplemented) Listen

func (s *Unimplemented) Listen(listener Listener, ready bool)

Listen ...

func (*Unimplemented) SetLimit

func (s *Unimplemented) SetLimit(n int)

SetLimit ...

func (*Unimplemented) Wait

func (s *Unimplemented) Wait() error

Wait ...

Jump to

Keyboard shortcuts

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