control

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Hostname = controlapi.Hostname
	Version  = 235
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Intermediate added in v1.22.0

type Intermediate struct {
	*connector.Connector
	ToDo
}

Intermediate extends and customizes the generic base connector.

func NewIntermediate added in v1.22.0

func NewIntermediate(impl ToDo) *Intermediate

NewIntermediate creates a new instance of the intermediate.

type Mock

type Mock struct {
	*Intermediate
	// contains filtered or unexported fields
}

Mock is a mockable version of the microservice, allowing functions, event sinks and web handlers to be mocked.

func NewMock

func NewMock() *Mock

NewMock creates a new mockable version of the microservice.

func (*Mock) ConfigRefresh added in v1.22.0

func (svc *Mock) ConfigRefresh(ctx context.Context) (err error)

ConfigRefresh executes the mock handler.

func (*Mock) Metrics added in v1.22.0

func (svc *Mock) Metrics(w http.ResponseWriter, r *http.Request) (err error)

Metrics executes the mock handler.

func (*Mock) MockConfigRefresh added in v1.22.0

func (svc *Mock) MockConfigRefresh(handler func(ctx context.Context) (err error)) *Mock

MockConfigRefresh sets up a mock handler for ConfigRefresh.

func (*Mock) MockMetrics added in v1.22.0

func (svc *Mock) MockMetrics(handler func(w http.ResponseWriter, r *http.Request) (err error)) *Mock

MockMetrics sets up a mock handler for Metrics.

func (*Mock) MockPing added in v1.22.0

func (svc *Mock) MockPing(handler func(ctx context.Context) (pong int, err error)) *Mock

MockPing sets up a mock handler for Ping.

func (*Mock) MockTrace added in v1.22.0

func (svc *Mock) MockTrace(handler func(ctx context.Context, id string) (err error)) *Mock

MockTrace sets up a mock handler for Trace.

func (*Mock) OnShutdown added in v1.22.0

func (svc *Mock) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Mock) OnStartup added in v1.22.0

func (svc *Mock) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

func (*Mock) Ping added in v1.22.0

func (svc *Mock) Ping(ctx context.Context) (pong int, err error)

Ping executes the mock handler.

func (*Mock) Trace added in v1.22.0

func (svc *Mock) Trace(ctx context.Context, id string) (err error)

Trace executes the mock handler.

type Service

type Service struct {
	*Intermediate // IMPORTANT: Do not remove

}

Service implements the control.core microservice.

This microservice is created for the sake of generating the client API for the :888 control subscriptions. The microservice itself does nothing and should not be included in applications.

func NewService

func NewService() *Service

NewService creates a new instance of the microservice.

func (*Service) ConfigRefresh

func (svc *Service) ConfigRefresh(ctx context.Context) (err error)

ConfigRefresh pulls the latest config values from the configurator microservice.

func (*Service) Init

func (svc *Service) Init(initializer func(svc *Service) (err error)) *Service

Init enables a single-statement pattern for initializing the microservice.

func (*Service) Metrics added in v1.19.0

func (svc *Service) Metrics(w http.ResponseWriter, r *http.Request) (err error)

Metrics returns the Prometheus metrics collected by the microservice.

func (*Service) OnShutdown

func (svc *Service) OnShutdown(ctx context.Context) (err error)

OnShutdown is called when the microservice is shut down.

func (*Service) OnStartup

func (svc *Service) OnStartup(ctx context.Context) (err error)

OnStartup is called when the microservice is started up.

func (*Service) Ping

func (svc *Service) Ping(ctx context.Context) (pong int, err error)

Ping responds to the message with a pong.

func (*Service) Trace

func (svc *Service) Trace(ctx context.Context, id string) (err error)

Trace forces exporting the indicated tracing span.

type ToDo added in v1.22.0

type ToDo interface {
	OnStartup(ctx context.Context) (err error)
	OnShutdown(ctx context.Context) (err error)
	Ping(ctx context.Context) (pong int, err error)             // MARKER: Ping
	ConfigRefresh(ctx context.Context) (err error)              // MARKER: ConfigRefresh
	Trace(ctx context.Context, id string) (err error)           // MARKER: Trace
	Metrics(w http.ResponseWriter, r *http.Request) (err error) // MARKER: Metrics
}

ToDo is implemented by the service or mock. The intermediate delegates handling to this interface.

Directories

Path Synopsis
Package controlapi implements the public API of the control.core microservice, including clients and data structures.
Package controlapi implements the public API of the control.core microservice, including clients and data structures.

Jump to

Keyboard shortcuts

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