summaryrefslogtreecommitdiff
path: root/internal/discovery
diff options
context:
space:
mode:
Diffstat (limited to 'internal/discovery')
-rw-r--r--internal/discovery/discovery.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/internal/discovery/discovery.go b/internal/discovery/discovery.go
index 30ca801..231c12a 100644
--- a/internal/discovery/discovery.go
+++ b/internal/discovery/discovery.go
@@ -405,3 +405,24 @@ func (discovery *Discovery) Servers(ctx context.Context) (*Servers, bool, error)
}
return &discovery.ServerList, true, nil
}
+
+func (discovery *Discovery) UpdateServers(other Discovery) {
+ if other.ServerList.Version >= discovery.ServerList.Version {
+ discovery.ServerList = other.ServerList
+ }
+}
+
+func (discovery *Discovery) Copy() (Discovery, error) {
+ var dest Discovery
+ b, err := json.Marshal(discovery)
+ if err != nil {
+ return dest, err
+ }
+
+ err = json.Unmarshal(b, &dest)
+ if err != nil {
+ return dest, err
+ }
+
+ return dest, nil
+}