Documentation ¶
Overview ¶
Package looper provider the building blocks for the adapter's looper.
Index ¶
Constants ¶
View Source
const Name = "requester"
Name of the looper.
View Source
const Type = "looper"
Type of the entity in the framework.
Variables ¶
View Source
var ErrHTTPVerbNotImplemented = errors.New("http verb not implemented")
ErrHTTPVerbNotImplemented is the error returned when the http verb is not implemented by the underlying http client.
Functions ¶
Types ¶
type ILooper ¶
type ILooper interface { // Start starts the loop. Start() // StartAsync starts the loop asynchronously. StartAsync() // Stop stops the loop. Stop() }
ILooper is the interface of the looper.
type IMetrics ¶
type IMetrics interface { // GetLogger returns the logger of the looper. GetLogger() sypl.ISypl // IncrementFailedCounter increments the failed counter. IncrementFailedCounter() // IncrementSuccessCounter increments the success counter. IncrementSuccessCounter() // IncrementTotalCounter increments the total counter. IncrementTotalCounter() }
IMetrics is the interface of the metrics.
type Looper ¶
type Looper struct { // Func is the function to be executed. Func Func `json:"-" validate:"required"` // Interval is the time between each loop. Interval time.Duration `json:"interval"` // Logger is the logger. Logger sypl.ISypl `json:"-" validate:"required"` // Name of the looper. Name string `json:"name" validate:"required,lowercase,gte=1"` *Metrics // contains filtered or unexported fields }
Looper is the individual, concurrent/non-blocking. The primary goal is to check the status of the API.
func (*Looper) GetMetrics ¶
GetMetrics returns the metrics of the looper.
func (*Looper) IncrementFailedCounter ¶
func (l *Looper) IncrementFailedCounter()
IncrementFailedCounter increments the failed counter.
func (*Looper) IncrementSuccessCounter ¶
func (l *Looper) IncrementSuccessCounter()
IncrementSuccessCounter increments the success counter.
func (*Looper) IncrementTotalCounter ¶
func (l *Looper) IncrementTotalCounter()
IncrementTotalCounter increments the total counter.
type Metrics ¶
type Metrics struct { // Failed will be incremented every time a it fails execution. FailedCounter *expvar.Int `json:"-" validate:"omitempty,gte=0"` // Succeeded will be incremented every time a it succeeds execution. SuccessCounter *expvar.Int `json:"-" validate:"omitempty,gte=0"` // Total will be incremented every time a it is executed. TotalCounter *expvar.Int `json:"-" validate:"omitempty,gte=0"` }
Metrics contains the metrics of a loop.
Click to show internal directories.
Click to hide internal directories.