container

package
v0.0.0-...-414c732 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Crash

func Crash(writer http.ResponseWriter, reason error)

func GetContext

func GetContext() context.Context

func HandleCliExec

func HandleCliExec(
	module string, args []string,
) error

func HandleRESTfulAPIs

func HandleRESTfulAPIs(
	module string,
	writer http.ResponseWriter, reader *http.Request,
) error

func Init

func Init(tracer trace.Tracer) error

func RegisterCronModule

func RegisterCronModule(
	name string,
	module Module,
	timeout int,
) error

func RegisterRpcModule

func RegisterRpcModule(
	name string,
	module Module,
	timeout int,
) error

func RegisterSimpleModule

func RegisterSimpleModule(
	name string,
	module Module,
	timeout int,
) error

func Terminate

func Terminate(msg string, exitCode int)

Types

type CliModule

type CliModule interface {
	Module

	Execute(args []string) error
}

type CronModule

type CronModule interface {
	Module

	GetCron() map[string]int
	GetJob(name string) (func(cancelChan chan bool, wg *sync.WaitGroup), error)
}

type Module

type Module interface {
	Init(timeout time.Duration) error
	Deinit() error

	GetTimeout() time.Duration
}

func Lookup

func Lookup(index int) (Module, error)

func Pick

func Pick(name string) (Module, error)

type RestModule

type RestModule interface {
	Module

	SetResponseWriter(writer http.ResponseWriter)
	SetRequestReader(reader *http.Request)

	// @NOTE: define methods
	DoGet(
		function string,
		kwargs url.Values,
	) (interface{}, error)
	DoPost(
		function string,
		kwargs url.Values,
	) (interface{}, error)
}

type RpcModule

type RpcModule interface {
	Module

	PairWith(module string) error
}

type Trace

type Trace interface {
	Enter(fn string) (trace.Span, context.Context)
	Exit()

	GetName() string
	GetTrace() trace.Tracer
	GetContext() context.Context
}

func NewConcurrentTrace

func NewConcurrentTrace(index int, parent Trace) Trace

func NewRootTrace

func NewRootTrace(
	name string,
	context context.Context,
	tracer ...trace.Tracer,
) Trace

func NewTrace

func NewTrace(name string) Trace

Jump to

Keyboard shortcuts

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