From 15058fa9a19bc385129b39e00b8b54c6cb48645e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Putra?= Date: Mon, 12 Sep 2022 12:57:19 +0200 Subject: [PATCH] transport: cluster, store topology using atomic.Pointer[topology] --- transport/cluster.go | 4 ++-- transport/cluster_integration_test.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/transport/cluster.go b/transport/cluster.go index e95511ff..0a6aad56 100644 --- a/transport/cluster.go +++ b/transport/cluster.go @@ -26,7 +26,7 @@ type ( ) type Cluster struct { - topology atomic.Value // *topology + topology atomic.Pointer[topology] control *Conn cfg ConnConfig handledEvents []frame.EventType // This will probably be moved to config. @@ -443,7 +443,7 @@ func parseTokensFromRow(n *Node, r frame.Row, ring *Ring) error { } func (c *Cluster) Topology() *topology { - return c.topology.Load().(*topology) + return c.topology.Load() } func (c *Cluster) setTopology(t *topology) { diff --git a/transport/cluster_integration_test.go b/transport/cluster_integration_test.go index d8f29c13..3a752e2a 100644 --- a/transport/cluster_integration_test.go +++ b/transport/cluster_integration_test.go @@ -80,7 +80,7 @@ func TestClusterIntegration(t *testing.T) { } // There should be at least system keyspaces present. - if len(c.topology.Load().(*topology).keyspaces) == 0 { + if len(c.Topology().keyspaces) == 0 { t.Fatalf("Keyspaces failed to load") }