-
Notifications
You must be signed in to change notification settings - Fork 248
/
interfaces.go
54 lines (47 loc) · 1.54 KB
/
interfaces.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
54
package checkup
import (
"github.com/sourcegraph/checkup/types"
)
// Checker can create a types.Result.
type Checker interface {
Type() string
Check() (types.Result, error)
}
// Storage can store results.
type Storage interface {
Type() string
Store([]types.Result) error
}
// StorageReader can read results from the Storage.
type StorageReader interface {
// Fetch returns the contents of a check file.
Fetch(checkFile string) ([]types.Result, error)
// GetIndex returns the storage index, as a map where keys are check
// result filenames and values are the associated check timestamps.
GetIndex() (map[string]int64, error)
}
// Maintainer can maintain a store of results by
// deleting old check files that are no longer
// needed or performing other required tasks.
type Maintainer interface {
Maintain() error
}
// Notifier can notify ops or sysadmins of
// potential problems. A Notifier should keep
// state to avoid sending repeated notices
// more often than the admin would like.
type Notifier interface {
Type() string
Notify([]types.Result) error
}
// Provisioner is a type of storage mechanism that can
// provision itself for use with checkup. Provisioning
// need only happen once and is merely a convenience
// so that the user can get up and running with their
// status page more quickly. Presumably, the info
// returned from Provision should be used on the status
// page side of things ot access the check files (like
// a key pair that is used for read-only access).
type Provisioner interface {
Provision() (types.ProvisionInfo, error)
}