-
Notifications
You must be signed in to change notification settings - Fork 95
/
interface.go
53 lines (43 loc) · 1.65 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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
// is responsible for 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()
}
type GathererUsingRemoteConfig interface {
Interface
// RemoteConfigStatus provides information about the availability and validity of the remote configuration
// used as source of the data gathering
RemoteConfigStatus() RemoteConfigStatus
}
// GatheringClosure is a struct containing a closure each gatherer returns
type GatheringClosure struct {
Run func(context.Context) ([]record.Record, []error)
}
// RemoteConfigStatus is a struct providing information about the availability
// and validity of the remote configuration
type RemoteConfigStatus struct {
Err error
AvailableReason string
ValidReason string
ConfigData []byte
ConfigAvailable bool
ConfigValid bool
}