pluginlookup

package
v0.41.1 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitBaseServices

func InitBaseServices[T any](archetype *baseservice.Archetype, plugins []T)

InitBaseServices initializes base services embedded in plugins.

Types

type JobPluginLookup

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

func NewJobPluginLookup

func NewJobPluginLookup() *JobPluginLookup

func (*JobPluginLookup) ByJobArgs

ByJobArgs returns a PluginLookupInterface by job args, which is a PluginLookup if the job args had specific hooks (i.e. implements JobArgsWithHooks and returns a non-empty set of hooks), or an EmptyPluginLookup otherwise.

type PluginKind

type PluginKind string
const (
	PluginKindHookInsertBegin       PluginKind = "hook_insert_begin"
	PluginKindHookMetricEmit        PluginKind = "hook_metric_emit"
	PluginKindHookPeriodicJobsStart PluginKind = "hook_periodic_jobs_start"
	PluginKindHookWorkBegin         PluginKind = "hook_work_begin"
	PluginKindHookWorkEnd           PluginKind = "hook_work_end"
	PluginKindMiddlewareJobInsert   PluginKind = "middleware_job_insert"
	PluginKindMiddlewareWorker      PluginKind = "middleware_worker"
)

type PluginLookupInterface

type PluginLookupInterface interface {
	ByKind(kind PluginKind) []any
}

PluginLookupInterface looks up plugins by kind. It's commonly implemented by PluginLookup, but may also be EmptyPluginLookup as a memory allocation optimization for bundles where no plugins are present.

func NewPluginLookup

func NewPluginLookup(plugins []any) PluginLookupInterface

NewPluginLookup returns a new plugin lookup interface based on the given plugins that satisfies PluginLookupInterface. This is often pluginLookup, but may be emptyPluginLookup as an optimization for the common case of an empty plugin bundle. Each input is considered for every hook and middleware kind it implements.

The plugins parameter is []any rather than []rivertype.Plugin because the lookup may contain legacy hooks and middleware that don't implement rivertype.Plugin. Keeping their original concrete values avoids compatibility wrappers that would need to forward every operation-specific interface.

func NewPluginLookupFromConfig

func NewPluginLookupFromConfig(hooks []rivertype.Hook, middlewares []rivertype.Middleware, plugins []rivertype.Plugin) PluginLookupInterface

NewPluginLookupFromConfig returns a plugin lookup from separately configured hooks, middleware, and plugins. Explicit plugins may participate as either hooks or middleware, while entries from the legacy Hooks and Middleware configuration fields participate only as the kind they were configured as.

Jump to

Keyboard shortcuts

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