tree

package
v0.53.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tree

type Tree[T any] map[node]map[string]T

Tree is a struct used to manage the loaded plugin instances. This struct is here to allow to manage multiple versions of the same plugin and the latest version of the plugin. The first map key is the node (name + registry). The second map key is the version of the plugin.

func Merge

func Merge[T any](a, b Tree[T]) Tree[T]

func (Tree[T]) Add

func (t Tree[T]) Add(name string, moduleMetadata plugin.ModuleMetadata, instance T)

func (Tree[T]) Get

func (t Tree[T]) Get(name string, moduleMetadata plugin.ModuleMetadata) (T, bool)

Get is retrieving the instance of the plugin based on the given name and moduleMetadata. While moduleMetadata is containing a field `Name`, we are not using it as the name passed can differ from the one in the metadata.

For example, when loading a schema, the name passed is the name of the schema, while the moduleMetadata.Name is the name of the module containing the schema. In the Prometheus plugin case, the schema name can be `PrometheusTimeSeriesQuery`, while the module name is `prometheus`.

The name and metadata.name can also be the same.

func (Tree[T]) GetWithPluginMetadata

func (t Tree[T]) GetWithPluginMetadata(name string, pluginMetadata *common.PluginMetadata) (T, bool)

func (Tree[T]) Remove

func (t Tree[T]) Remove(name string, moduleMetadata plugin.ModuleMetadata)

Jump to

Keyboard shortcuts

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