From 3d073080f83cd4f7716b1d8787fff24e9ee98562 Mon Sep 17 00:00:00 2001 From: Holger Obermaier <40787752+ho-ob@users.noreply.github.com> Date: Wed, 26 Jan 2022 12:08:40 +0100 Subject: [PATCH] Add documentation --- internal/metricRouter/metricRouter.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/metricRouter/metricRouter.go b/internal/metricRouter/metricRouter.go index dc7703a..f76c31f 100644 --- a/internal/metricRouter/metricRouter.go +++ b/internal/metricRouter/metricRouter.go @@ -30,7 +30,7 @@ type metricRouterConfig struct { type metricRouter struct { inputs []chan lp.CCMetric // List of all input channels outputs []chan lp.CCMetric // List of all output channels - done chan bool // channel to finish stop metric router + done chan bool // channel to finish / stop metric router wg *sync.WaitGroup timestamp time.Time // timestamp ticker mct.MultiChanTicker @@ -200,19 +200,23 @@ func (r *metricRouter) Start() { cclog.ComponentDebug("MetricRouter", "STARTED") } +// AddInput adds a input channel to the metric router func (r *metricRouter) AddInput(input chan lp.CCMetric) { r.inputs = append(r.inputs, input) } +// AddOutput adds a output channel to the metric router func (r *metricRouter) AddOutput(output chan lp.CCMetric) { r.outputs = append(r.outputs, output) } +// Close finishes / stops the metric router func (r *metricRouter) Close() { r.done <- true cclog.ComponentDebug("MetricRouter", "CLOSE") } +// New creates a new initialized metric router func New(ticker mct.MultiChanTicker, wg *sync.WaitGroup, routerConfigFile string) (MetricRouter, error) { r := new(metricRouter) err := r.Init(ticker, wg, routerConfigFile)