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 {
|
type Input struct {
|
||||||
r *reporter.Reporter
|
r *reporter.Reporter
|
||||||
t tomb.Tomb
|
t tomb.Tomb
|
||||||
config *Configuration
|
config Configuration
|
||||||
send input.SendFunc
|
send input.SendFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ input.Input = &Input{}
|
||||||
|
_ input.Configuration = Configuration{}
|
||||||
|
)
|
||||||
|
|
||||||
// New instantiate a new UDP listener from the provided 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 {
|
if len(configuration.Paths) == 0 {
|
||||||
return nil, errors.New("no paths provided for file input")
|
return nil, errors.New("no paths provided for file input")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ import (
|
|||||||
type Input struct {
|
type Input struct {
|
||||||
r *reporter.Reporter
|
r *reporter.Reporter
|
||||||
t tomb.Tomb
|
t tomb.Tomb
|
||||||
config *Configuration
|
config Configuration
|
||||||
|
|
||||||
metrics struct {
|
metrics struct {
|
||||||
bytes *reporter.CounterVec
|
bytes *reporter.CounterVec
|
||||||
@@ -40,8 +40,13 @@ type Input struct {
|
|||||||
send input.SendFunc // function to send to kafka
|
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.
|
// 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{
|
input := &Input{
|
||||||
r: r,
|
r: r,
|
||||||
config: configuration,
|
config: configuration,
|
||||||
|
|||||||
@@ -24,6 +24,11 @@ type Provider struct {
|
|||||||
refresh chan bool
|
refresh chan bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ provider.Provider = &Provider{}
|
||||||
|
_ provider.Configuration = Configuration{}
|
||||||
|
)
|
||||||
|
|
||||||
// New creates a new gNMI provider from configuration
|
// New creates a new gNMI provider from configuration
|
||||||
func (configuration Configuration) New(r *reporter.Reporter) (provider.Provider, error) {
|
func (configuration Configuration) New(r *reporter.Reporter) (provider.Provider, error) {
|
||||||
p := Provider{
|
p := Provider{
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ type Provider struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ provider.Provider = &Provider{}
|
||||||
|
_ provider.Configuration = Configuration{}
|
||||||
|
)
|
||||||
|
|
||||||
// New creates a new SNMP provider from configuration
|
// New creates a new SNMP provider from configuration
|
||||||
func (configuration Configuration) New(r *reporter.Reporter) (provider.Provider, error) {
|
func (configuration Configuration) New(r *reporter.Reporter) (provider.Provider, error) {
|
||||||
for exporterIP, agentIP := range configuration.Agents {
|
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
|
// New creates a new static provider from configuration
|
||||||
func (configuration Configuration) New(r *reporter.Reporter) (provider.Provider, error) {
|
func (configuration Configuration) New(r *reporter.Reporter) (provider.Provider, error) {
|
||||||
p := &Provider{
|
p := &Provider{
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ type Provider struct {
|
|||||||
// Dependencies define the dependencies of the BioRIS Provider.
|
// Dependencies define the dependencies of the BioRIS Provider.
|
||||||
type Dependencies = provider.Dependencies
|
type Dependencies = provider.Dependencies
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ provider.Provider = &Provider{}
|
||||||
|
_ provider.Configuration = Configuration{}
|
||||||
|
)
|
||||||
|
|
||||||
// New creates a new BioRIS provider.
|
// New creates a new BioRIS provider.
|
||||||
func (configuration Configuration) New(r *reporter.Reporter, dependencies Dependencies) (provider.Provider, error) {
|
func (configuration Configuration) New(r *reporter.Reporter, dependencies Dependencies) (provider.Provider, error) {
|
||||||
p := Provider{
|
p := Provider{
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ type Provider struct {
|
|||||||
// Dependencies define the dependencies of the BMP component.
|
// Dependencies define the dependencies of the BMP component.
|
||||||
type Dependencies = provider.Dependencies
|
type Dependencies = provider.Dependencies
|
||||||
|
|
||||||
|
var (
|
||||||
|
_ provider.Provider = &Provider{}
|
||||||
|
_ provider.Configuration = Configuration{}
|
||||||
|
)
|
||||||
|
|
||||||
// New creates a new BMP component from its configuration.
|
// New creates a new BMP component from its configuration.
|
||||||
func (configuration Configuration) New(r *reporter.Reporter, dependencies Dependencies) (provider.Provider, error) {
|
func (configuration Configuration) New(r *reporter.Reporter, dependencies Dependencies) (provider.Provider, error) {
|
||||||
if dependencies.Clock == nil {
|
if dependencies.Clock == nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user