Documentation
¶
Index ¶
- type Tree
- func (t Tree[T]) Add(name string, moduleMetadata plugin.ModuleMetadata, instance T)
- func (t Tree[T]) Get(name string, moduleMetadata plugin.ModuleMetadata) (T, bool)
- func (t Tree[T]) GetWithPluginMetadata(name string, pluginMetadata *common.PluginMetadata) (T, bool)
- func (t Tree[T]) Remove(name string, moduleMetadata plugin.ModuleMetadata)
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]) 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)