Skip to content

Commit

Permalink
transport: cluster, store topology using atomic.Pointer[topology]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kulezi committed Sep 12, 2022
1 parent 4c1e97e commit 15058fa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions transport/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion transport/cluster_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down

0 comments on commit 15058fa

Please sign in to comment.