Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExists = errors.New("plugin already registered")
Functions ¶
func NewCmdFactory ¶ added in v2.3.0
func NewCmdFactory(register func(id string) (*RegisteredLoop, error), lcfg CmdConfig) (func() *exec.Cmd, error)
NewCmdFactory is helper to ensure synchronization between the loop registry and os cmd to exec the LOOP
func ParseEnvFile ¶ added in v2.9.0
ParseEnvFile returns a slice of key/value pairs parsed from the file at filepath. As a special case, empty filepath returns nil without error.
Types ¶
type CmdConfig ¶ added in v2.3.0
type CmdConfig struct { ID string // unique string used by the node to track the LOOP. typically supplied by the loop logger name Cmd string // string value of executable to exec Env []string // environment variables as described in [exec.Cmd.Env] }
CmdConfig is configuration used to register the LOOP and generate an exec
type LoopRegistry ¶
type LoopRegistry struct {
// contains filtered or unexported fields
}
LoopRegistry is responsible for assigning ports to plugins that are to be used for the plugin's prometheus HTTP server, and for passing the tracing configuration to the plugin.
func NewLoopRegistry ¶
func NewLoopRegistry(lggr logger.Logger, tracingConfig config.Tracing) *LoopRegistry
func (*LoopRegistry) Get ¶
func (m *LoopRegistry) Get(id string) (*RegisteredLoop, bool)
Get plugin by id. Safe for concurrent use.
func (*LoopRegistry) List ¶
func (m *LoopRegistry) List() []*RegisteredLoop
Return slice sorted by plugin name. Safe for concurrent use.
func (*LoopRegistry) Register ¶
func (m *LoopRegistry) Register(id string) (*RegisteredLoop, error)
Register creates a port of the plugin. It is not idempotent. Duplicate calls to Register will return ErrExists Safe for concurrent use.
func (*LoopRegistry) Unregister ¶ added in v2.11.0
func (m *LoopRegistry) Unregister(id string)
Unregister remove a loop from the registry Safe for concurrent use.
type RegisteredLoop ¶
type RegistrarConfig ¶
type RegistrarConfig interface { RegisterLOOP(config CmdConfig) (func() *exec.Cmd, loop.GRPCOpts, error) UnregisterLOOP(ID string) }
RegistrarConfig generates contains static configuration inher
func NewRegistrarConfig ¶
func NewRegistrarConfig(grpcOpts loop.GRPCOpts, loopRegistrationFn func(loopId string) (*RegisteredLoop, error), loopUnregisterFn func(loopId string)) RegistrarConfig
NewRegistrarConfig creates a RegistarConfig loopRegistrationFn must act as a global registry function of LOOPs and must be idempotent. The [func() *exec.Cmd] for a LOOP should be generated by calling [RegistrarConfig.RegisterLOOP]