forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsupervisor.go
More file actions
57 lines (41 loc) · 1.34 KB
/
supervisor.go
File metadata and controls
57 lines (41 loc) · 1.34 KB
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
package stack
import (
"log/slog"
"github.com/ethereum-optimism/optimism/op-service/apis"
)
// SupervisorID identifies a Supervisor by name and chainID, is type-safe, and can be value-copied and used as map key.
type SupervisorID genericID
var _ GenericID = (*SupervisorID)(nil)
const SupervisorKind Kind = "Supervisor"
func (id SupervisorID) String() string {
return genericID(id).string(SupervisorKind)
}
func (id SupervisorID) Kind() Kind {
return SupervisorKind
}
func (id SupervisorID) LogValue() slog.Value {
return slog.StringValue(id.String())
}
func (id SupervisorID) MarshalText() ([]byte, error) {
return genericID(id).marshalText(SupervisorKind)
}
func (id *SupervisorID) UnmarshalText(data []byte) error {
return (*genericID)(id).unmarshalText(SupervisorKind, data)
}
func SortSupervisorIDs(ids []SupervisorID) []SupervisorID {
return copyAndSortCmp(ids)
}
func SortSupervisors(elems []Supervisor) []Supervisor {
return copyAndSort(elems, lessElemOrdered[SupervisorID, Supervisor])
}
var _ SupervisorMatcher = SupervisorID("")
func (id SupervisorID) Match(elems []Supervisor) []Supervisor {
return findByID(id, elems)
}
// Supervisor is an interop service, used to cross-verify messages between chains.
type Supervisor interface {
Common
ID() SupervisorID
AdminAPI() apis.SupervisorAdminAPI
QueryAPI() apis.SupervisorQueryAPI
}