libnetwork/networkdb: format code with gofumpt

Formatting the code with https://github.com/mvdan/gofumpt

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-01-20 14:07:01 +01:00
parent 65e2149b3e
commit 32e716e848
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
4 changed files with 9 additions and 8 deletions

View file

@ -215,7 +215,7 @@ func (nDB *NetworkDB) handleTableEvent(tEvent *TableEvent, isBulkSync bool) bool
// most likely the cluster is already aware of it
// This also reduce the possibility that deletion of entries close to their garbage collection ends up circuling around
// forever
//log.G(ctx).Infof("exiting on delete not knowing the obj with rebroadcast:%t", network.inSync)
// log.G(ctx).Infof("exiting on delete not knowing the obj with rebroadcast:%t", network.inSync)
return network.inSync && e.reapTime > nDB.config.reapEntryInterval/6
}
@ -491,5 +491,4 @@ func (d *delegate) MergeRemoteState(buf []byte, isJoin bool) {
d.nDB.handleNetworkEvent(nEvent)
}
}

View file

@ -294,7 +294,7 @@ func (nDB *NetworkDB) Close() {
log.G(context.TODO()).Errorf("%v(%v) Could not close DB: %v", nDB.config.Hostname, nDB.config.NodeID, err)
}
//Avoid (*Broadcaster).run goroutine leak
// Avoid (*Broadcaster).run goroutine leak
nDB.broadcaster.Close()
}
@ -622,7 +622,7 @@ func (nDB *NetworkDB) JoinNetwork(nid string) error {
nodeNetworks[nid].entriesNumber.Store(entries)
nodeNetworks[nid].tableBroadcasts = &memberlist.TransmitLimitedQueue{
NumNodes: func() int {
//TODO fcrisciani this can be optimized maybe avoiding the lock?
// TODO fcrisciani this can be optimized maybe avoiding the lock?
// this call is done each GetBroadcasts call to evaluate the number of
// replicas for the message
nDB.RLock()

View file

@ -23,7 +23,7 @@ import (
var dbPort int32 = 10000
func TestMain(m *testing.M) {
os.WriteFile("/proc/sys/net/ipv6/conf/lo/disable_ipv6", []byte{'0', '\n'}, 0644)
os.WriteFile("/proc/sys/net/ipv6/conf/lo/disable_ipv6", []byte{'0', '\n'}, 0o644)
logrus.SetLevel(logrus.ErrorLevel)
os.Exit(m.Run())
}
@ -851,9 +851,11 @@ func TestNetworkDBIslands(t *testing.T) {
node := dbs[0].nodes[dbs[0].config.NodeID]
baseIPStr := node.Addr.String()
// Node 0,1,2 are going to be the 3 bootstrap nodes
members := []string{fmt.Sprintf("%s:%d", baseIPStr, dbs[0].config.BindPort),
members := []string{
fmt.Sprintf("%s:%d", baseIPStr, dbs[0].config.BindPort),
fmt.Sprintf("%s:%d", baseIPStr, dbs[1].config.BindPort),
fmt.Sprintf("%s:%d", baseIPStr, dbs[2].config.BindPort)}
fmt.Sprintf("%s:%d", baseIPStr, dbs[2].config.BindPort),
}
// Rejoining will update the list of the bootstrap members
for i := 3; i < 5; i++ {
t.Logf("Re-joining: %d", i)

View file

@ -391,7 +391,7 @@ func dbGetTable(ctx interface{}, w http.ResponseWriter, r *http.Request) {
if ok {
table := nDB.GetTableByNetwork(tname, nid)
rsp := &diagnostic.TableObj{Length: len(table)}
var i = 0
i := 0
for k, v := range table {
var encodedValue string
if unsafe {