controller

package
v0.53.3 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 12 Imported by: 46

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConstructOpts

type ConstructOpts struct {
	// Logger is the root logger to use.
	Logger *logrus.Entry
}

ConstructOpts contains optional parameters when constructing a controller.

func (*ConstructOpts) GetLogger

func (c *ConstructOpts) GetLogger() *logrus.Entry

GetLogger returns the specified logger or a default one if nil.

type Controller

type Controller interface {
	// Handler handles directives.
	directive.Handler

	// GetControllerInfo returns information about the controller.
	GetControllerInfo() *Info
	// Execute executes the controller goroutine.
	// Returning nil ends execution.
	// Returning an error triggers a retry with backoff.
	// Retry will NOT re-construct the controller, just re-start Execute.
	Execute(ctx context.Context) error
	// Close releases any resources used by the controller.
	// Error indicates any issue encountered releasing.
	Close() error
}

Controller tracks a particular process.

type Factory

type Factory interface {
	// GetConfigID returns the unique config ID for the controller.
	GetConfigID() string
	// ConstructConfig constructs an instance of the controller configuration.
	ConstructConfig() config.Config
	// Construct constructs the associated controller given configuration.
	Construct(context.Context, config.Config, ConstructOpts) (Controller, error)
	// GetVersion returns the version of this controller.
	GetVersion() Version
}

Factory represents an available controller implementation. The factory can construct instances of the controller given configuration.

type FactoryResolver

type FactoryResolver interface {
	// GetResolverID returns the resolver identifier.
	// Ex: static, go-plugin
	GetResolverID() string
	// GetResolverVersion returns the resolver version.
	GetResolverVersion() Version
	// GetConfigCtorByID returns a config constructor by ID.
	// If none found, return nil, nil
	GetConfigCtorByID(ctx context.Context, id string) (config.Constructor, error)
	// GetFactoryMatchingConfig returns the factory that matches the config.
	// If no factory is found, return nil.
	// If an unexpected error occurs, return it.
	GetFactoryMatchingConfig(ctx context.Context, conf config.Config) (Factory, error)
}

FactoryResolver looks up factories that match configurations.

type FactoryWithContext

type FactoryWithContext interface {
	Factory
	// GetFactoryContext returns a context that is canceled if the factory is unloaded.
	GetFactoryContext() context.Context
}

FactoryWithContext is a factory with a cancelation context.

type Info

type Info struct {

	// Id contains the identifier of the controller.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// Version contains the version string for the controller.
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
	// Description contains a descriptive string about the controller.
	Description string `protobuf:"bytes,3,opt,name=description,proto3" json:"description,omitempty"`
	// contains filtered or unexported fields
}

Info contains information about a controller.

func NewInfo

func NewInfo(id string, version Version, descrip string) *Info

NewInfo constructs a new Info object.

func (*Info) Clone added in v0.11.1

func (i *Info) Clone() *Info

Clone copies the Info object.

func (*Info) CloneMessageVT added in v0.23.6

func (m *Info) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Info) CloneVT added in v0.12.3

func (m *Info) CloneVT() *Info

func (*Info) EqualMessageVT added in v0.23.6

func (this *Info) EqualMessageVT(thatMsg any) bool

func (*Info) EqualVT added in v0.10.0

func (this *Info) EqualVT(that *Info) bool

func (*Info) GetDescription

func (x *Info) GetDescription() string

func (*Info) GetId

func (x *Info) GetId() string

func (*Info) GetVersion

func (x *Info) GetVersion() string

func (*Info) MarshalJSON added in v0.41.0

func (x *Info) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Info to JSON.

func (*Info) MarshalProtoJSON added in v0.41.0

func (x *Info) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Info message to JSON.

func (*Info) MarshalProtoText added in v0.42.0

func (x *Info) MarshalProtoText() string

func (*Info) MarshalToSizedBufferVT added in v0.10.0

func (m *Info) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Info) MarshalToVT added in v0.10.0

func (m *Info) MarshalToVT(dAtA []byte) (int, error)

func (*Info) MarshalVT added in v0.10.0

func (m *Info) MarshalVT() (dAtA []byte, err error)

func (*Info) ProtoMessage

func (*Info) ProtoMessage()

func (*Info) Reset

func (x *Info) Reset()

func (*Info) SizeVT added in v0.10.0

func (m *Info) SizeVT() (n int)

func (*Info) String

func (x *Info) String() string

func (*Info) UnmarshalJSON added in v0.41.0

func (x *Info) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Info from JSON.

func (*Info) UnmarshalProtoJSON added in v0.41.0

func (x *Info) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Info message from JSON.

func (*Info) UnmarshalVT added in v0.10.0

func (m *Info) UnmarshalVT(dAtA []byte) error

type Version added in v0.53.3

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

Version identifies a controller implementation version.

func MustParseVersion added in v0.53.3

func MustParseVersion(value string) Version

MustParseVersion parses a controller version and panics on invalid input.

func ParseVersion added in v0.53.3

func ParseVersion(value string) (Version, error)

ParseVersion parses a major.minor.patch controller version.

func (Version) GT added in v0.53.3

func (v Version) GT(other Version) bool

GT returns true if the version is greater than the other version.

func (Version) GTE added in v0.53.3

func (v Version) GTE(other Version) bool

GTE returns true if the version is greater than or equal to the other version.

func (Version) String added in v0.53.3

func (v Version) String() string

String returns the original version string.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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