Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit ffef1b2

Browse files
committed
transport: cluster, store topology using atomic.Pointer[topology]
1 parent 3c89450 commit ffef1b2

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

transport/cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ type (
2626
)
2727

2828
type Cluster struct {
29-
topology atomic.Value // *topology
29+
topology atomic.Pointer[topology]
3030
control *Conn
3131
cfg ConnConfig
3232
handledEvents []frame.EventType // This will probably be moved to config.
@@ -443,7 +443,7 @@ func parseTokensFromRow(n *Node, r frame.Row, ring *Ring) error {
443443
}
444444

445445
func (c *Cluster) Topology() *topology {
446-
return c.topology.Load().(*topology)
446+
return c.topology.Load()
447447
}
448448

449449
func (c *Cluster) setTopology(t *topology) {

transport/cluster_integration_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func TestClusterIntegration(t *testing.T) {
8080
}
8181

8282
// There should be at least system keyspaces present.
83-
if len(c.topology.Load().(*topology).keyspaces) == 0 {
83+
if len(c.Topology().keyspaces) == 0 {
8484
t.Fatalf("Keyspaces failed to load")
8585
}
8686

0 commit comments

Comments
 (0)