serve

package module
v0.0.0-...-7e8f612 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2025 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const ServiceTimeout = 10 * time.Second

Variables

This section is empty.

Functions

func AddFuncs

func AddFuncs(serveName string, funcs ...func(ctx context.Context) error) suture.ServiceToken

func AddFuncsOnServe

func AddFuncsOnServe(id suture.ServiceToken, funcs ...func(ctx context.Context) error)

func AddFuncsWithSpec

func AddFuncsWithSpec(serveName string, spec suture.Spec, funcs ...func(ctx context.Context) error) suture.ServiceToken

func AddServe

func AddServe(serveName string, svr suture.Service, funcs ...func(ctx context.Context) error) suture.ServiceToken

func AddServeWithSpec

func AddServeWithSpec(serveName string, svr suture.Service, spec suture.Spec, funcs ...func(ctx context.Context) error) suture.ServiceToken

func Down

func Down() error

func Remove

func Remove(id suture.ServiceToken) error

func RemoveAndWait

func RemoveAndWait(id suture.ServiceToken, timeout time.Duration) error

Types

type Context

type Context struct {
	*suture.Supervisor
	// contains filtered or unexported fields
}

@Singleton(localGetter)

func (*Context) Add

func (*Context) Down

func (c *Context) Down() error

func (*Context) Init

func (c *Context) Init()

func (*Context) Remove

func (c *Context) Remove(id suture.ServiceToken) error

func (*Context) RemoveAndWait

func (c *Context) RemoveAndWait(id suture.ServiceToken, timeout time.Duration) error

type Service

type Service interface {
	suture.Service
	fmt.Stringer
	Error() error
}

func AsService

func AsService(fn func(ctx context.Context) error, creator string) Service

AsService wraps the given function to implement suture.Service. In addition it keeps track of the returned error and allows querying that error.

Jump to

Keyboard shortcuts

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