20
20
21
21
package state
22
22
23
- import "github.com/arangodb/go-driver"
24
-
25
23
type Root struct {
26
24
Arango State `json:"arango"`
27
25
ArangoDB DB `json:"arangodb,omitempty"`
@@ -53,12 +51,14 @@ type Current struct {
53
51
Collections CurrentCollections `json:"Collections"`
54
52
55
53
// ServersKnown stores information about ArangoDB servers.
56
- ServersKnown map [driver. ServerID ] ServerKnown `json:"ServersKnown,omitempty"`
54
+ ServersKnown ServerMap [ ServerKnown ] `json:"ServersKnown,omitempty"`
57
55
}
58
56
59
57
type Plan struct {
60
- Collections PlanCollections `json:"Collections"`
61
- Databases PlanDatabases `json:"Databases,omitempty"`
58
+ Collections PlanCollections `json:"Collections"`
59
+ Databases PlanDatabases `json:"Databases,omitempty"`
60
+ DBServers ServerMap [string ] `json:"DBServers,omitempty"`
61
+ Coordinators ServerMap [string ] `json:"Coordinators,omitempty"`
62
62
}
63
63
64
64
type Supervision struct {
@@ -69,6 +69,13 @@ type ShardCountDetails struct {
69
69
Leader , Follower int
70
70
}
71
71
72
+ type ServerMap [T any ] map [Server ]T
73
+
74
+ func (s ServerMap [T ]) Exists (server Server ) bool {
75
+ _ , ok := s [server ]
76
+ return ok
77
+ }
78
+
72
79
func (s ShardCountDetails ) Count () int {
73
80
return s .Leader + s .Follower
74
81
}
@@ -445,7 +452,7 @@ func (s State) GetCollectionDatabaseByID(id string) (string, bool) {
445
452
446
453
// GetRebootID returns reboot ID for a given server ID.
447
454
// returns false when a server ID does not exist in cache.
448
- func (s State ) GetRebootID (id driver. ServerID ) (int , bool ) {
455
+ func (s State ) GetRebootID (id Server ) (int , bool ) {
449
456
if v , ok := s .Current .ServersKnown [id ]; ok {
450
457
return v .RebootID , true
451
458
}
0 commit comments