-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Copy pathhealthcheck.go
50 lines (45 loc) · 1.28 KB
/
healthcheck.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
package guardianproverhealthcheck
import (
"context"
"net/http"
"time"
"github.com/morkid/paginate"
)
type HealthCheck struct {
ID int `json:"id"`
GuardianProverID uint64 `json:"guardianProverId"`
Alive bool `json:"alive"`
ExpectedAddress string `json:"expectedAddress"`
RecoveredAddress string `json:"recoveredAddress"`
SignedResponse string `json:"signedResponse"`
LatestL1Block uint64 `json:"latestL1Block"`
LatestL2Block uint64 `json:"latestL2Block"`
CreatedAt time.Time `json:"createdAt"`
}
type SaveHealthCheckOpts struct {
GuardianProverID uint64
Alive bool
ExpectedAddress string
RecoveredAddress string
SignedResponse string
LatestL1Block uint64
LatestL2Block uint64
}
type HealthCheckRepository interface {
Get(
ctx context.Context,
req *http.Request,
) (paginate.Page, error)
GetByGuardianProverAddress(
ctx context.Context,
req *http.Request,
address string,
) (paginate.Page, error)
GetMostRecentByGuardianProverAddress(
ctx context.Context,
req *http.Request,
address string,
) (*HealthCheck, error)
Save(ctx context.Context, opts *SaveHealthCheckOpts) error
GetUptimeByGuardianProverAddress(ctx context.Context, address string) (float64, int, error)
}