forked from taikoxyz/taiko-mono
-
Notifications
You must be signed in to change notification settings - Fork 0
/
healthcheck.go
50 lines (45 loc) · 1.22 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)
GetByGuardianProverID(
ctx context.Context,
req *http.Request,
id int,
) (paginate.Page, error)
GetMostRecentByGuardianProverID(
ctx context.Context,
req *http.Request,
id int,
) (*HealthCheck, error)
Save(opts SaveHealthCheckOpts) error
GetUptimeByGuardianProverID(ctx context.Context, id int) (float64, int, error)
}