2020
2121package state
2222
23- import "github.com/arangodb/go-driver"
24-
2523type Root struct {
2624 Arango State `json:"arango"`
2725 ArangoDB DB `json:"arangodb,omitempty"`
@@ -53,12 +51,14 @@ type Current struct {
5351 Collections CurrentCollections `json:"Collections"`
5452
5553 // ServersKnown stores information about ArangoDB servers.
56- ServersKnown map [driver. ServerID ] ServerKnown `json:"ServersKnown,omitempty"`
54+ ServersKnown ServerMap [ ServerKnown ] `json:"ServersKnown,omitempty"`
5755}
5856
5957type 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"`
6262}
6363
6464type Supervision struct {
@@ -69,6 +69,13 @@ type ShardCountDetails struct {
6969 Leader , Follower int
7070}
7171
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+
7279func (s ShardCountDetails ) Count () int {
7380 return s .Leader + s .Follower
7481}
@@ -445,7 +452,7 @@ func (s State) GetCollectionDatabaseByID(id string) (string, bool) {
445452
446453// GetRebootID returns reboot ID for a given server ID.
447454// 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 ) {
449456 if v , ok := s .Current .ServersKnown [id ]; ok {
450457 return v .RebootID , true
451458 }
0 commit comments