goservice

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseService

type BaseService struct {
	ShutdownHandlers []ServiceLogicFunc
}

func (*BaseService) RegisterShutdownHandler

func (s *BaseService) RegisterShutdownHandler(logic ServiceLogicFunc)

RegisterShutdownHandler adds a function to run during graceful shutdown

func (*BaseService) Run

func (s *BaseService) Run(logic ServiceLogicFunc) error

Run executes the main service logic

func (*BaseService) RunWithContext added in v0.0.5

func (s *BaseService) RunWithContext(parentContext context.Context, logic ServiceLogicFunc) error

RunWithContext executes the main service logic with a parent context

func (*BaseService) Shutdown

func (s *BaseService) Shutdown(ctx context.Context) error

Shutdown executes shutdown functions and exits

type Service added in v1.0.0

type Service interface {
	// Run executes the main service logic
	Run(logic ServiceLogicFunc) error

	// RunWithContext executes the main service logic with a parent context
	RunWithContext(parentContext context.Context, logic ServiceLogicFunc) error

	// Shutdown executes shutdown functions and exits
	Shutdown(ctx context.Context) error

	// RegisterShutdownHandler adds a function to run during graceful shutdown
	RegisterShutdownHandler(logic ServiceLogicFunc)
}

Service an interface to a base service

type ServiceLogicFunc added in v1.0.0

type ServiceLogicFunc func(ctx context.Context) error

ServiceLogic a function for executing logic

Jump to

Keyboard shortcuts

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