runtime

package
v0.2.15 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: GPL-3.0 Imports: 17 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChannelRuntimeNoChannel  = errors.New("functional runtime no Channel function provided")
	ErrChannelRuntimeInitialise = errors.New("functional runtime initialise function failed")
)

Errors

View Source
var (
	ErrHttpMissingServer         = errors.New("http runtime no server provided")
	ErrHttpMissingHandler        = errors.New("http runtime no handler provided")
	ErrHttpFailedToInitialiseTls = errors.New("http runtime failed to start tls")
)

Errors

View Source
var (
	ErrLoopRuntimeNoLoop     = errors.New("functional runtime no loop function provided")
	ErrLoopRuntimeInitialise = errors.New("functional runtime initialise function failed")
)

Errors

View Source
var (
	ErrRunnerRuntimeNoRunnable    = errors.New("runner runtime no runnable provided")
	ErrRunnerRuntimeRunnableStart = errors.New("runner runtime runnable failed to start")
)

Errors

View Source
var (
	ErrPrimaryInitialiseError = errors.New("primary runtime initialise function failed")
)

Errors

View Source
var ErrRetryStopped = errors.New("retry stopped")
View Source
var NewHttp = ConstructorFor[*HttpRunnable, Runtime](
	func() *HttpRunnable {
		return &HttpRunnable{
			server: &http.Server{
				Addr:         ":8080",
				ReadTimeout:  5 * time.Second,
				WriteTimeout: 5 * time.Second,
			},
		}
	},
	func(hr *HttpRunnable) Runtime {
		return NewRunner(hr)
	},
)

constructor

Functions

func AlwaysTry added in v0.0.29

func AlwaysTry(err error) bool

func ContextValueBool added in v0.0.23

func ContextValueBool(ctx context.Context, name string) bool

func ContextValueInt32 added in v0.0.23

func ContextValueInt32(ctx context.Context, name string) int32

func ContextValueInt64 added in v0.0.23

func ContextValueInt64(ctx context.Context, name string) int64

func ContextValueString added in v0.0.23

func ContextValueString(ctx context.Context, name string) string

func ContextWithValueMap added in v0.0.23

func ContextWithValueMap(ctx context.Context, valueMap map[string]any) context.Context

func Error added in v0.0.6

func Error(err error)

func GetRetryCount added in v0.0.29

func GetRetryCount(ctx context.Context) int64

func QualifierConfig added in v0.0.29

func QualifierConfig(q string) string

func SetRetryCount added in v0.0.29

func SetRetryCount(ctx context.Context, trycount int64) context.Context

func Start added in v0.0.6

func Start(runtimes []Runtime, sleepTime time.Duration) error

func Stop added in v0.0.6

func Stop()

func Wait added in v0.0.6

func Wait()

Types

type Channel added in v0.0.29

type Channel[T any] interface {
	Start() error
	Stop()
	Channel() (<-chan T, error)
	Loop(T) error
}

type ChannelRunnable added in v0.0.29

type ChannelRunnable[T any] struct {
	// contains filtered or unexported fields
}

implementation

func (*ChannelRunnable[T]) Run added in v0.0.29

func (r *ChannelRunnable[T]) Run() error

func (*ChannelRunnable[T]) Start added in v0.0.29

func (r *ChannelRunnable[T]) Start() error

func (*ChannelRunnable[T]) Stop added in v0.0.29

func (r *ChannelRunnable[T]) Stop()

type Configuration

type Configuration[R any] func(R) R

func HttpWithHandler

func HttpWithHandler(handler http.Handler) Configuration[*HttpRunnable]

configuration

func HttpWithPort

func HttpWithPort(port int) Configuration[*HttpRunnable]

func HttpWithReadHeaderTimeout

func HttpWithReadHeaderTimeout(timeout time.Duration) Configuration[*HttpRunnable]

func HttpWithReadTimeout

func HttpWithReadTimeout(timeout time.Duration) Configuration[*HttpRunnable]

func HttpWithTls added in v0.0.29

func HttpWithTls(certPath string, keyPath string) Configuration[*HttpRunnable]

func HttpWithWriteTimeout

func HttpWithWriteTimeout(timeout time.Duration) Configuration[*HttpRunnable]

func WithRetryAbsorbError added in v0.0.29

func WithRetryAbsorbError(absorb bool) Configuration[*Retry]

func WithRetryAttempts added in v0.0.29

func WithRetryAttempts(attempts uint) Configuration[*Retry]

configurations

func WithRetryDelay added in v0.0.29

func WithRetryDelay(delay time.Duration) Configuration[*Retry]

func WithRetryMaxDelay added in v0.0.29

func WithRetryMaxDelay(delay time.Duration) Configuration[*Retry]

type Constructor added in v0.0.19

type Constructor[R any, I any] func(...Configuration[R]) I

func ConstructorFor added in v0.0.28

func ConstructorFor[R any, I any](defaultValue func() R, casting func(R) I) Constructor[R, I]

type ContextKey added in v0.0.7

type ContextKey struct {
	Name string
}

func Context added in v0.0.7

func Context(name string) ContextKey

type HttpRunnable added in v0.0.6

type HttpRunnable struct {
	// contains filtered or unexported fields
}

implementation

func (*HttpRunnable) Run added in v0.0.6

func (c *HttpRunnable) Run() error

func (*HttpRunnable) Start added in v0.0.6

func (c *HttpRunnable) Start() error

func (*HttpRunnable) Stop added in v0.0.6

func (c *HttpRunnable) Stop()

type Loop added in v0.0.6

type Loop interface {
	Start() error
	Stop()
	Loop(context.Context, context.CancelFunc) error
}

type LoopRunnable added in v0.0.6

type LoopRunnable struct {
	// contains filtered or unexported fields
}

implementation

func (*LoopRunnable) Run added in v0.0.6

func (r *LoopRunnable) Run() error

func (*LoopRunnable) Start added in v0.0.6

func (r *LoopRunnable) Start() error

func (*LoopRunnable) Stop added in v0.0.6

func (r *LoopRunnable) Stop()

type Primary

type Primary struct {
	// contains filtered or unexported fields
}

implementation

func (*Primary) Error

func (r *Primary) Error()

func (*Primary) Interrupt

func (r *Primary) Interrupt()

func (*Primary) Start

func (r *Primary) Start() error

func (*Primary) Stop

func (r *Primary) Stop()

func (*Primary) StopFrom

func (r *Primary) StopFrom(from int)

func (*Primary) Wait added in v0.0.6

func (r *Primary) Wait()

type Resolver added in v0.0.29

type Resolver[T any] interface {
	AddConfig(inverse.Injector[Configuration[T]])
	AddConfigVal(Configuration[T])
	Register()
}

func NewResolver added in v0.0.29

func NewResolver[T any, I any](
	qualifier string,
	container inverse.Container,
	configurationRequired bool,
	constructor Constructor[T, I],
) Resolver[T]

type Retry added in v0.0.29

type Retry struct {
	// contains filtered or unexported fields
}

implementation

func NewRetry added in v0.0.29

func NewRetry(configurations ...Configuration[*Retry]) *Retry

constructor

func (*Retry) Do added in v0.0.29

func (c *Retry) Do(fnToDo func(int64) error) error

func (*Retry) Start added in v0.0.29

func (c *Retry) Start() error

func (*Retry) Stop added in v0.0.29

func (c *Retry) Stop()

type Runnable added in v0.0.6

type Runnable interface {
	Start() error
	Stop()
	Run() error
}

type Runner added in v0.0.6

type Runner struct {
	// contains filtered or unexported fields
}

func (*Runner) Run added in v0.0.6

func (r *Runner) Run()

func (*Runner) Start added in v0.0.6

func (r *Runner) Start() error

func (*Runner) Stop added in v0.0.6

func (r *Runner) Stop()

type Runtime

type Runtime interface {
	Start() error
	Stop()
}

func NewChannel added in v0.0.29

func NewChannel[T any](channel Channel[T]) Runtime

constructor

func NewLoop added in v0.0.6

func NewLoop(loop Loop) Runtime

constructor

func NewRunner added in v0.0.6

func NewRunner(runnable Runnable) Runtime

Jump to

Keyboard shortcuts

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