rserverless

package
v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Services = map[string]NewService{}

Services is a map of service name and its new function.

Functions

func Register

func Register(name string, newFunc NewService)

Register registers a new serverless service with name and new function.

Types

type NewService

type NewService func(context.Context, map[string]interface{}) (Service, error)

NewService is the function that serverless services need to register at init time.

type Option added in v1.25.0

type Option func(*Serverless)

func WithLogger added in v1.25.0

func WithLogger(log *zerolog.Logger) Option

func WithServices added in v1.25.0

func WithServices(svc map[string]Service) Option

type Serverless

type Serverless struct {
	Services map[string]Service
	// contains filtered or unexported fields
}

Serverless contains the serveless collection of services.

func New

func New(opt ...Option) (*Serverless, error)

New returns a new serverless collection of services.

func (*Serverless) GracefulStop

func (s *Serverless) GracefulStop() error

GracefulStop gracefully stops the serverless services.

func (*Serverless) Start

func (s *Serverless) Start() error

Start starts the serverless service collection.

func (*Serverless) Stop

func (s *Serverless) Stop() error

Stop stops the serverless services with a one second deadline.

type Service

type Service interface {
	Start()
	Close(ctx context.Context) error
}

Service represents a serverless service.

Jump to

Keyboard shortcuts

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