Skip to content

Commit

Permalink
Merge pull request #186 from dkropachev/fix-code-formatting
Browse files Browse the repository at this point in the history
Fix files formatting
  • Loading branch information
sylwiaszunejko authored Jun 6, 2024
2 parents f6911e4 + 5100a64 commit 2c5fba3
Show file tree
Hide file tree
Showing 16 changed files with 39 additions and 31 deletions.
1 change: 1 addition & 0 deletions cassandra_only_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build (all || cassandra) && !scylla
// +build all cassandra
// +build !scylla

Expand Down
1 change: 1 addition & 0 deletions exec_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build all || integration
// +build all integration

package gocql
Expand Down
8 changes: 4 additions & 4 deletions host_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,10 +435,10 @@ func (h *HostInfo) Hostname() string {
}

func (h *HostInfo) ConnectAddressAndPort() string {
h.mu.Lock()
defer h.mu.Unlock()
addr, _ := h.connectAddressLocked()
return net.JoinHostPort(addr.String(), strconv.Itoa(h.port))
h.mu.Lock()
defer h.mu.Unlock()
addr, _ := h.connectAddressLocked()
return net.JoinHostPort(addr.String(), strconv.Itoa(h.port))
}

func (h *HostInfo) String() string {
Expand Down
1 change: 1 addition & 0 deletions integration_cassandra_only_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build (all || integration) && !scylla
// +build all integration
// +build !scylla

Expand Down
1 change: 1 addition & 0 deletions internal/murmur/murmur_appengine.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build appengine || s390x
// +build appengine s390x

package murmur
Expand Down
4 changes: 2 additions & 2 deletions internal/murmur/murmur_unsafe.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build !appengine
// +build !s390x
//go:build !appengine && !s390x
// +build !appengine,!s390x

package murmur

Expand Down
4 changes: 2 additions & 2 deletions metadata_cassandra.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build cassandra
// +build !scylla
//go:build cassandra && !scylla
// +build cassandra,!scylla

// Copyright (c) 2015 The gocql Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
Expand Down
4 changes: 2 additions & 2 deletions metadata_cassandra_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build cassandra
// +build !scylla
//go:build cassandra && !scylla
// +build cassandra,!scylla

// Copyright (c) 2015 The gocql Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
Expand Down
2 changes: 1 addition & 1 deletion metadata_scylla.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ type schemaDescriber struct {
session *Session
mu sync.Mutex

cache map[string]*KeyspaceMetadata
cache map[string]*KeyspaceMetadata

// Experimental, this interface and use may change
tabletsCache *TabletsMetadata
Expand Down
1 change: 1 addition & 0 deletions metadata_scylla_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build !cassandra
// +build !cassandra

// Copyright (c) 2015 The gocql Authors. All rights reserved.
Expand Down
14 changes: 8 additions & 6 deletions recreate.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//go:build !cassandra
// +build !cassandra

// Copyright (C) 2017 ScyllaDB

package gocql
Expand Down Expand Up @@ -494,12 +496,12 @@ type scyllaEncryptionOptions struct {

// UnmarshalBinary deserializes blob into scyllaEncryptionOptions.
// Format:
// * 4 bytes - size of KV map
// Size times:
// * 4 bytes - length of key
// * len_of_key bytes - key
// * 4 bytes - length of value
// * len_of_value bytes - value
// - 4 bytes - size of KV map
// Size times:
// - 4 bytes - length of key
// - len_of_key bytes - key
// - 4 bytes - length of value
// - len_of_value bytes - value
func (enc *scyllaEncryptionOptions) UnmarshalBinary(data []byte) error {
size := binary.LittleEndian.Uint32(data[0:4])

Expand Down
4 changes: 2 additions & 2 deletions recreate_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//+build integration
//+build scylla
//go:build integration && scylla
// +build integration,scylla

// Copyright (C) 2017 ScyllaDB

Expand Down
12 changes: 6 additions & 6 deletions scylla.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,13 @@ func (p *scyllaConnPicker) Pick(t Token, keyspace string, table string) *Conn {
conn.mu.Lock()
if conn.tabletsRoutingV1 {
tablets := conn.session.getTablets()

// Search for tablets with Keyspace and Table from the Query
l, r := findTablets(tablets, keyspace, table)

if l != -1 {
tablet := findTabletForToken(tablets, mmt, l, r)

for _, replica := range tablet.replicas {
if replica.hostId.String() == p.hostId {
idx = replica.shardId
Expand All @@ -396,7 +396,7 @@ func (p *scyllaConnPicker) Pick(t Token, keyspace string, table string) *Conn {

break
}

if idx == -1 {
idx = p.shardOf(mmt)
}
Expand All @@ -415,15 +415,15 @@ func (p *scyllaConnPicker) maybeReplaceWithLessBusyConnection(c *Conn) *Conn {
return c
}
alternative := p.leastBusyConn()
if alternative == nil || alternative.AvailableStreams() * 120 > c.AvailableStreams() * 100 {
if alternative == nil || alternative.AvailableStreams()*120 > c.AvailableStreams()*100 {
return c
} else {
return alternative
}
}

func isHeavyLoaded(c *Conn) bool {
return c.streams.NumStreams / 2 > c.AvailableStreams();
return c.streams.NumStreams/2 > c.AvailableStreams()
}

func (p *scyllaConnPicker) leastBusyConn() *Conn {
Expand Down
4 changes: 2 additions & 2 deletions scylla_shard_aware_port_integration_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// +build integration
// +build scylla
//go:build integration && scylla
// +build integration,scylla

package gocql

Expand Down
1 change: 1 addition & 0 deletions scylla_shard_aware_port_mocked_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build unit
// +build unit

package gocql
Expand Down
8 changes: 4 additions & 4 deletions session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2171,10 +2171,10 @@ type routingKeyInfoLRU struct {
}

type routingKeyInfo struct {
indexes []int
types []TypeInfo
keyspace string
table string
indexes []int
types []TypeInfo
keyspace string
table string
lwt bool
partitioner Partitioner
}
Expand Down

0 comments on commit 2c5fba3

Please sign in to comment.