-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
models.go
70 lines (61 loc) · 1.21 KB
/
models.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package directrequestocr
import (
"time"
"github.com/ethereum/go-ethereum/common"
)
type RequestState int8
const (
IN_PROGRESS RequestState = iota
RESULT_READY
TRANSMITTED
CONFIRMED
)
type ErrType int8
const (
NONE ErrType = iota
NODE_EXCEPTION
SANDBOX_TIMEOUT
USER_EXCEPTION
)
type Request struct {
ID int64
ContractRequestID [32]byte
RunID int64
ReceivedAt time.Time
RequestTxHash *common.Hash
State RequestState
ResultReadyAt time.Time
Result []byte
ErrorType ErrType
Error string
// True if this node submitted an observation for this request in any OCR rounds.
IsOCRParticipant bool
TransmittedResult []byte
TransmittedError string
}
func (s RequestState) String() string {
switch s {
case IN_PROGRESS:
return "InProgress"
case RESULT_READY:
return "ResultReady"
case TRANSMITTED:
return "Transmitted"
case CONFIRMED:
return "Confirmed"
}
return "unknown"
}
func (e ErrType) String() string {
switch e {
case NONE:
return "None"
case NODE_EXCEPTION:
return "NodeException"
case SANDBOX_TIMEOUT:
return "SandboxTimeout"
case USER_EXCEPTION:
return "UserException"
}
return "unknown"
}