Documentation ¶
Index ¶
- func ToInt(valIntf interface{}) (int, error)
- func ToInt64(valIntf interface{}) (int64, error)
- func ToUint64(valIntf interface{}) (uint64, error)
- type BackoffOption
- type BackoffTimer
- type GNMIProvider
- type GRPCProvider
- type Logger
- type MetricCollector
- type Monitor
- type Provider
- type SensorMetadata
- type SensorMetadataProvider
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BackoffOption ¶
type BackoffOption func(b *BackoffTimer)
BackoffOption defines options to be used with BackoffTimer
func WithBackoffBase ¶
func WithBackoffBase(base time.Duration) BackoffOption
WithBackoffBase configures the base backoff
func WithBackoffMax ¶
func WithBackoffMax(base time.Duration) BackoffOption
WithBackoffMax configures the maximum backoff
type BackoffTimer ¶
type BackoffTimer struct { BackoffBase time.Duration BackoffMax time.Duration BackoffMult float64 BackoffResetThreshold time.Duration // contains filtered or unexported fields }
BackoffTimer implements a backoff mechanism to be used in retries.
func NewBackoffTimer ¶
func NewBackoffTimer(opts ...BackoffOption) *BackoffTimer
NewBackoffTimer creates a new BackoffTimer with defaults settings
func (*BackoffTimer) Backoff ¶
func (b *BackoffTimer) Backoff() time.Duration
Backoff will backoff, so retries are spaced out. Returns the current backoff delay, that is set to trigger the next timer.
func (*BackoffTimer) Wait ¶
func (b *BackoffTimer) Wait() <-chan time.Time
Wait returns a channel that must be waited on, which will signify the backoff period has passed.
type GNMIProvider ¶
type GNMIProvider interface { Provider // InitGNMI initializes the provider with a gNMI client. InitGNMI(client gnmi.GNMIClient) // OpenConfig indicates whether the provider wants OpenConfig // type-checking. Used only by v1 client. OpenConfig() bool // Origin of the YANG data model that this provider streams, // should be one of "arista", "fmp", "openconfig". This method // is used only by v2 client. Origin() string }
A GNMIProvider emits updates as gNMI SetRequests.
type GRPCProvider ¶
type GRPCProvider interface { Provider // InitGRPC initializes the provider with a gRPC connection. InitGRPC(conn *grpc.ClientConn) }
A GRPCProvider is a Provider that has access to a raw gRPC connection.
type Logger ¶
type Logger interface { Infof(format string, args ...interface{}) Errorf(format string, args ...interface{}) Debugf(format string, args ...interface{}) Tracef(format string, args ...interface{}) }
A Logger logs and records messages
type MetricCollector ¶
type MetricCollector interface { SetMetricString(name string, value string) error SetMetricFloat(name string, value float64) error SetMetricInt(name string, value int64) error IncMetricInt(name string, value int64) error CreateMetric(name string, valueUnit string, description string) error }
A MetricCollector will collect and publish metrics
type Monitor ¶
type Monitor interface { Logger MetricCollector }
A Monitor owns the state and metrics information. Datasource could extract information through this interface.
type Provider ¶
type Provider interface { // Run() kicks off the provider. This method does not return until ctx // is cancelled or an error is encountered, // and is thus usually invoked by doing `go provider.Run()'. Run(ctx context.Context) error }
A Provider "owns" some states on a target device streams out notifications on any changes to those states.
type SensorMetadata ¶
SensorMetadata structure holds sensor metadata
type SensorMetadataProvider ¶
type SensorMetadataProvider interface { // Init provider with metadata about sensor environment. Init(sensorMD *SensorMetadata) }
SensorMetadataProvider gives way for provider to initialize itself with sensor metadata.