forked from openshift/insights-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinterface.go
35 lines (28 loc) · 1.23 KB
/
interface.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// gatherers package contains interfaces to be implemented by gatherers and subpackages with actual gatherers
package gatherers
import (
"context"
"github.com/openshift/insights-operator/pkg/record"
)
// Interface is an interface for gathering types
type Interface interface {
// GetName returns the name of the gatherer
GetName() string
// GetGatheringFunctions returns all the gathering function implemented by current gatherer
GetGatheringFunctions(context.Context) (map[string]GatheringClosure, error)
}
// CustomPeriodGatherer gatherers implementing this interface may not get to each archive
// and their period can be different from interval in the config(equal or higher, but never lower)
type CustomPeriodGatherer interface {
Interface
// ShouldBeProcessedNow returns true when it's time to process the gatherer
// gatherer is responsible of tracking the time itself
ShouldBeProcessedNow() bool
// UpdateLastProcessingTime is called when the gatherer is about to be processed,
// so that it can update its last processed time for example.
UpdateLastProcessingTime()
}
// GatheringClosure is a struct containing a closure each gatherer returns
type GatheringClosure struct {
Run func(context.Context) ([]record.Record, []error)
}