runtime

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2023 License: GPL-3.0 Imports: 12 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

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

Errors

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

Errors

View Source
var (
	ErrConnectorRuntimeInitialise = errors.New("connector runtime initialise function failed")
)

Errors

Functions

This section is empty.

Types

type Configuration

type Configuration[R any] func(R) R

func ConnectorWithCleanup added in v0.0.5

func ConnectorWithCleanup[C any](cleanup func(C)) Configuration[*Connector[C]]

func ConnectorWithInitialise added in v0.0.5

func ConnectorWithInitialise[C any](initialise func() (C, error)) Configuration[*Connector[C]]

configuration

func FunctionalWithCleanup

func FunctionalWithCleanup[C any](cleanup func(C)) Configuration[*Functional[C]]

func FunctionalWithContext

func FunctionalWithContext[C any](ctx context.Context) Configuration[*Functional[C]]

func FunctionalWithInitialise

func FunctionalWithInitialise[C any](initialise func() (C, error)) Configuration[*Functional[C]]

configuration

func FunctionalWithLoop

func FunctionalWithLoop[C any](loop func(data C, ctx context.Context, cancel context.CancelFunc) error) Configuration[*Functional[C]]

func HttpWithHandler

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

configuration

func HttpWithPort

func HttpWithPort(port int) Configuration[*Http]

func HttpWithReadHeaderTimeout

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

func HttpWithReadTimeout

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

func HttpWithWriteTimeout

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

func PrimaryWithRuntime

func PrimaryWithRuntime(runtime Runtime) Configuration[*Primary]

configuration

type Connector added in v0.0.5

type Connector[C any] struct {
	// contains filtered or unexported fields
}

implementation

func ConnectorDefault added in v0.0.5

func ConnectorDefault[C any](c *Connector[C]) *Connector[C]

default

func (*Connector[C]) SetController added in v0.0.5

func (r *Connector[C]) SetController(controller Controller)

func (*Connector[C]) Start added in v0.0.5

func (r *Connector[C]) Start() error

func (*Connector[C]) Stop added in v0.0.5

func (r *Connector[C]) Stop()

type Controller

type Controller interface {
	Started()    // denotes that a runtime element has started
	Stopped()    // denotes that a runtime element has stopped
	Error(error) // denotes that a runtime element has errored
	Wait()
}

func NewPrimaryController

func NewPrimaryController() (Controller, chan error)

type Functional

type Functional[C any] struct {
	// contains filtered or unexported fields
}

implementation

func FunctionalDefault

func FunctionalDefault[C any](c *Functional[C]) *Functional[C]

default

func (*Functional[C]) Run

func (r *Functional[C]) Run()

func (*Functional[C]) SetController

func (r *Functional[C]) SetController(controller Controller)

func (*Functional[C]) Start

func (r *Functional[C]) Start() error

func (*Functional[C]) Stop

func (r *Functional[C]) Stop()

type Http

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

implementation

func HttpDefault

func HttpDefault(c *Http) *Http

default

func (*Http) Run

func (c *Http) Run()

func (*Http) SetController

func (c *Http) SetController(controller Controller)

func (*Http) Start

func (c *Http) Start() error

func (*Http) Stop

func (c *Http) Stop()

type Primary

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

implementation

func PrimaryDefault

func PrimaryDefault(c *Primary) *Primary

default

func (*Primary) Error

func (r *Primary) Error()

func (*Primary) Interrupt

func (r *Primary) Interrupt()

func (*Primary) SetController

func (r *Primary) SetController(controller Controller)

func (*Primary) Start

func (r *Primary) Start() error

func (*Primary) Stop

func (r *Primary) Stop()

func (*Primary) StopFrom

func (r *Primary) StopFrom(from int)

type Runtime

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

func NewConnector added in v0.0.5

func NewConnector[C any](configurations ...Configuration[*Connector[C]]) Runtime

constructor

func NewFunctional

func NewFunctional[C any](configurations ...Configuration[*Functional[C]]) Runtime

constructor

func NewHttp

func NewHttp(configurations ...Configuration[*Http]) Runtime

constructor

func NewPrimary

func NewPrimary(configurations ...Configuration[*Primary]) Runtime

constructor

type RuntimeController

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

func (*RuntimeController) Error

func (c *RuntimeController) Error(err error)

func (*RuntimeController) Started

func (c *RuntimeController) Started()

func (*RuntimeController) Stopped

func (c *RuntimeController) Stopped()

func (*RuntimeController) Wait

func (c *RuntimeController) Wait()

Jump to

Keyboard shortcuts

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