provider

package
v0.0.0-...-f4b89b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToInt

func ToInt(valIntf interface{}) (int, error)

ToInt convert an interface{} to an int.

func ToInt64

func ToInt64(valIntf interface{}) (int64, error)

ToInt64 converts an interface{} to an int64.

func ToUint64

func ToUint64(valIntf interface{}) (uint64, error)

ToUint64 converts an interface{} to a uint64.

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) Reset

func (b *BackoffTimer) Reset()

Reset resets the timer with BackoffBase

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

type SensorMetadata struct {
	SensorIP       string
	SensorHostname string
}

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.

Directories

Path Synopsis
pdu
smi

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL