plugins

package
v4.1.21 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: GPL-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAvailablePlugins

func GetAvailablePlugins() map[string][]string

GetAvailablePlugins returns a list of all registered plugins by plugin type

func GetAvailableQuerierPlugins

func GetAvailableQuerierPlugins() []string

GetAvailableQuerierPlugins returns a list of all registered querier plugins

func GetAvailableResolverPlugins added in v4.1.18

func GetAvailableResolverPlugins() []string

GetAvailableResolverPlugins returns a list of all registered resolver plugins

func InitQuerier

func InitQuerier(ctx context.Context, name, cfgPath string) (distributed.Querier, error)

InitQuerier will initialize a querier plugin with the given name and configuration path. If the plugin never registered itself, an error will be returned

func InitResolver added in v4.1.18

func InitResolver(ctx context.Context, name, cfgPath string) (hosts.Resolver, error)

InitResolver returns a resolver by name or an error if it isn't registered.

func InitResolvers added in v4.1.19

func InitResolvers(ctx context.Context, cfg *HostResolverConfig) (*hosts.ResolverMap, error)

InitResolvers initializes all registered resolver plugins

func RegisterQuerier

func RegisterQuerier(name string, initFn QuerierInitializer)

RegisterQuerier registers a querier initializer function with a given name. This function is meant to be used by querier plugins to register themselves. RegisterQuerier will panic if a querier with the same name has already been registered

func RegisterResolver added in v4.1.18

func RegisterResolver(name string, initFn ResolverInitializer)

RegisterResolver is typically called from init() in a resolver package.

Types

type AppConfig added in v4.1.19

type AppConfig struct {
	Hosts *HostResolverConfig `mapstructure:"hosts"`
}

AppConfig holds the application configuration configurable through viper only

type HostResolverConfig added in v4.1.19

type HostResolverConfig struct {
	Resolvers []*ResolverConfig `mapstructure:"resolvers"`
}

HostResolverConfig holds all resolver configuration

type Initializer

type Initializer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Initializer is a singleton that holds all registered plugins

func GetInitializer

func GetInitializer() *Initializer

GetInitializer returns the singleton Initializer instance. It is safe to call this function concurrently. Repeated calls will return the same instance

func (*Initializer) LogValue

func (i *Initializer) LogValue() slog.Value

type QuerierInitializer

type QuerierInitializer func(ctx context.Context, cfgPath string) (distributed.Querier, error)

QuerierInitializer is a function that initializes a querier instance. The cfgPath parameter mandates that the querier plugin must be able to read in its configuration from a file

type ResolverConfig added in v4.1.19

type ResolverConfig struct {
	Type   string `mapstructure:"type"`   // Type is the type of the resolver (e.g. the name)
	Config string `mapstructure:"config"` // Config is the path to the configuration file
}

ResolverConfig is the configuration relevant for resolver plugin configuration

func (*ResolverConfig) LogValue added in v4.1.19

func (rc *ResolverConfig) LogValue() slog.Value

LogValue returns the log representation of the resolver config

type ResolverInitializer added in v4.1.18

type ResolverInitializer func(ctx context.Context, cfgPath string) (hosts.Resolver, error)

ResolverInitializer constructs a resolver, optionally using a config file. Mirrors the existing QuerierInitializer pattern

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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