Documentation
¶
Index ¶
- type Tree
- func (t Tree[T]) Add(name string, moduleMetadata module.Metadata, instance T)
- func (t Tree[T]) Get(name string, moduleMetadata module.Metadata) (T, bool)
- func (t Tree[T]) GetWithPluginMetadata(name string, pluginMetadata *plugin.Metadata) (T, bool)
- func (t Tree[T]) Remove(name string, moduleMetadata module.Metadata)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
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 (Tree[T]) Get ¶
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.