influxdb/mock/retention_service.go

39 lines
936 B
Go
Raw Normal View History

2018-10-05 16:57:49 +00:00
package mock
import (
"github.com/prometheus/client_golang/prometheus"
"go.uber.org/zap"
)
type RetentionService struct {
WithLoggerFn func(l *zap.Logger)
OpenFn func() error
CloseFn func() error
PrometheusCollectorsFn func() []prometheus.Collector
}
func NewRetentionService() *RetentionService {
return &RetentionService{
WithLoggerFn: func(_ *zap.Logger) {},
OpenFn: func() error { return nil },
CloseFn: func() error { return nil },
PrometheusCollectorsFn: func() []prometheus.Collector { return nil },
}
}
func (s *RetentionService) WithLogger(log *zap.Logger) {
s.WithLoggerFn(log)
}
func (s *RetentionService) Open() error {
return s.OpenFn()
}
func (s *RetentionService) Close() error {
return s.CloseFn()
}
func (s *RetentionService) PrometheusCollectors() []prometheus.Collector {
return s.PrometheusCollectorsFn()
}