mirror of
https://github.com/akvorado/akvorado.git
synced 2025-12-12 06:24:10 +01:00
inlet/outlet: add compile-time interface implementation check
For "plugins" only.
This commit is contained in:
@@ -22,12 +22,17 @@ import (
|
||||
type Input struct {
|
||||
r *reporter.Reporter
|
||||
t tomb.Tomb
|
||||
config *Configuration
|
||||
config Configuration
|
||||
send input.SendFunc
|
||||
}
|
||||
|
||||
var (
|
||||
_ input.Input = &Input{}
|
||||
_ input.Configuration = Configuration{}
|
||||
)
|
||||
|
||||
// New instantiate a new UDP listener from the provided configuration.
|
||||
func (configuration *Configuration) New(r *reporter.Reporter, daemon daemon.Component, send input.SendFunc) (input.Input, error) {
|
||||
func (configuration Configuration) New(r *reporter.Reporter, daemon daemon.Component, send input.SendFunc) (input.Input, error) {
|
||||
if len(configuration.Paths) == 0 {
|
||||
return nil, errors.New("no paths provided for file input")
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
type Input struct {
|
||||
r *reporter.Reporter
|
||||
t tomb.Tomb
|
||||
config *Configuration
|
||||
config Configuration
|
||||
|
||||
metrics struct {
|
||||
bytes *reporter.CounterVec
|
||||
@@ -40,8 +40,13 @@ type Input struct {
|
||||
send input.SendFunc // function to send to kafka
|
||||
}
|
||||
|
||||
var (
|
||||
_ input.Input = &Input{}
|
||||
_ input.Configuration = Configuration{}
|
||||
)
|
||||
|
||||
// New instantiate a new UDP listener from the provided configuration.
|
||||
func (configuration *Configuration) New(r *reporter.Reporter, daemon daemon.Component, send input.SendFunc) (input.Input, error) {
|
||||
func (configuration Configuration) New(r *reporter.Reporter, daemon daemon.Component, send input.SendFunc) (input.Input, error) {
|
||||
input := &Input{
|
||||
r: r,
|
||||
config: configuration,
|
||||
|
||||
@@ -24,6 +24,11 @@ type Provider struct {
|
||||
refresh chan bool
|
||||
}
|
||||
|
||||
var (
|
||||
_ provider.Provider = &Provider{}
|
||||
_ provider.Configuration = Configuration{}
|
||||
)
|
||||
|
||||
// New creates a new gNMI provider from configuration
|
||||
func (configuration Configuration) New(r *reporter.Reporter) (provider.Provider, error) {
|
||||
p := Provider{
|
||||
|
||||
@@ -28,6 +28,11 @@ type Provider struct {
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
_ provider.Provider = &Provider{}
|
||||
_ provider.Configuration = Configuration{}
|
||||
)
|
||||
|
||||
// New creates a new SNMP provider from configuration
|
||||
func (configuration Configuration) New(r *reporter.Reporter) (provider.Provider, error) {
|
||||
for exporterIP, agentIP := range configuration.Agents {
|
||||
|
||||
@@ -35,6 +35,11 @@ type Provider struct {
|
||||
}
|
||||
}
|
||||
|
||||
var (
|
||||
_ provider.Provider = &Provider{}
|
||||
_ provider.Configuration = Configuration{}
|
||||
)
|
||||
|
||||
// New creates a new static provider from configuration
|
||||
func (configuration Configuration) New(r *reporter.Reporter) (provider.Provider, error) {
|
||||
p := &Provider{
|
||||
|
||||
@@ -63,6 +63,11 @@ type Provider struct {
|
||||
// Dependencies define the dependencies of the BioRIS Provider.
|
||||
type Dependencies = provider.Dependencies
|
||||
|
||||
var (
|
||||
_ provider.Provider = &Provider{}
|
||||
_ provider.Configuration = Configuration{}
|
||||
)
|
||||
|
||||
// New creates a new BioRIS provider.
|
||||
func (configuration Configuration) New(r *reporter.Reporter, dependencies Dependencies) (provider.Provider, error) {
|
||||
p := Provider{
|
||||
|
||||
@@ -44,6 +44,11 @@ type Provider struct {
|
||||
// Dependencies define the dependencies of the BMP component.
|
||||
type Dependencies = provider.Dependencies
|
||||
|
||||
var (
|
||||
_ provider.Provider = &Provider{}
|
||||
_ provider.Configuration = Configuration{}
|
||||
)
|
||||
|
||||
// New creates a new BMP component from its configuration.
|
||||
func (configuration Configuration) New(r *reporter.Reporter, dependencies Dependencies) (provider.Provider, error) {
|
||||
if dependencies.Clock == nil {
|
||||
|
||||
Reference in New Issue
Block a user