run

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2024 License: MIT Imports: 3 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CadenceWorkerActor added in v0.9.0

func CadenceWorkerActor(worker CadenceWorker) (execute func() error, interrupt func(error))

CadenceWorkerActor returns an actor, i.e. an execute and interrupt func, that terminates when the underlying worker fails or stops running.

Although the Cadence Worker component has a blocking Run function, internally it waits for a SIGTERM signal which does not fit perfectly into run group.

See https://github.com/uber-go/cadence-client/issues/642

func CadenceWorkerRun deprecated added in v0.8.0

func CadenceWorkerRun(worker CadenceWorker) (execute func() error, interrupt func(error))

Deprecated: use CadenceWorkerActor instead.

func GRPCServe

func GRPCServe(server GRPCServer, lis net.Listener) (execute func() error, interrupt func(error))

GRPCServe returns an actor, i.e. an execute and interrupt func, that terminates when the underlying gRPC server fails.

func GracefulRestart

func GracefulRestart(ctx context.Context, upg Upgrader) (execute func() error, interrupt func(error))

GracefulRestart returns an actor, i.e. an execute and interrupt func, that terminates when graceful restart is initiated and the child process signals to be ready, or the parent context is canceled.

func HTTPServe added in v0.5.0

func HTTPServe(
	server HTTPServer,
	lis net.Listener,
	shutdownTimeout time.Duration,
) (execute func() error, interrupt func(error))

HTTPServe returns an actor, i.e. an execute and interrupt func, that terminates when the underlying HTTP server fails.

It accepts a timeout parameter for the graceful shutdown. 0 means no timeout.

func TemporalWorkerActor added in v0.9.0

func TemporalWorkerActor(worker TemporalWorker) (execute func() error, interrupt func(error))

TemporalWorkerActor returns an actor, i.e. an execute and interrupt func, that terminates when the underlying worker fails or stops running.

Although the Temporal Worker component has a blocking Run function, internally it waits for a SIGTERM signal which does not fit perfectly into run group.

See https://github.com/temporalio/temporal-go-sdk/issues/94

Types

type CadenceWorker added in v0.8.0

type CadenceWorker interface {
	// Start starts the worker in a non-blocking fashion.
	Start() error

	// Stop cleans up any resources opened by worker.
	Stop()
}

CadenceWorker is an Uber Cadence worker instance.

See https://godoc.org/go.uber.org/cadence/internal#Worker

type GRPCServer

type GRPCServer interface {
	Serve(lis net.Listener) error
	GracefulStop()
}

GRPCServer is a gRPC server.

type HTTPServer added in v0.5.0

type HTTPServer interface {
	Serve(lis net.Listener) error
	Shutdown(ctx context.Context) error
}

HTTPServer is an HTTP server.

type ServeLogger added in v0.5.0

type ServeLogger interface {
	// Info logs an Info event.
	Info(msg string, fields ...map[string]interface{})
}

ServeLogger logs server start/shutdown events.

type TemporalWorker added in v0.9.0

type TemporalWorker interface {
	// Start starts the worker in a non-blocking fashion.
	Start() error

	// Stop cleans up any resources opened by worker.
	Stop()
}

TemporalWorker is a Temporal worker instance.

See: https://github.com/temporalio/temporal-go-sdk

type Upgrader

type Upgrader interface {
	Ready() error
	Exit() <-chan struct{}
	Stop()
}

Upgrader handles zero downtime upgrades and passing files between processes.

Upgrader is based on https://github.com/cloudflare/tableflip.

type Wrapper added in v0.5.0

type Wrapper func(execute func() error, interrupt func(error)) (func() error, func(error))

Wrapper is an actor that wraps another actor. It is useful for creating middleware.

func LogServe added in v0.5.0

func LogServe(logger ServeLogger) Wrapper

LogServe returns an actor, i.e. an execute and interrupt func, that logs a message when a server is being started/shut down.

Jump to

Keyboard shortcuts

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