libnetwork/networkdb: remove some redundant fmt.Sprintf()'s
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
abaf4b25d7
commit
b9c8eca468
2 changed files with 4 additions and 4 deletions
|
@ -397,7 +397,7 @@ func (nDB *NetworkDB) reapTableEntries() {
|
||||||
// The lock is taken at the beginning of the cycle and the deletion is inline
|
// The lock is taken at the beginning of the cycle and the deletion is inline
|
||||||
for _, nid := range nodeNetworks {
|
for _, nid := range nodeNetworks {
|
||||||
nDB.Lock()
|
nDB.Lock()
|
||||||
nDB.indexes[byNetwork].WalkPrefix(fmt.Sprintf("/%s", nid), func(path string, v interface{}) bool {
|
nDB.indexes[byNetwork].WalkPrefix("/"+nid, func(path string, v interface{}) bool {
|
||||||
// timeCompensation compensate in case the lock took some time to be released
|
// timeCompensation compensate in case the lock took some time to be released
|
||||||
timeCompensation := time.Since(cycleStart)
|
timeCompensation := time.Since(cycleStart)
|
||||||
entry, ok := v.(*entry)
|
entry, ok := v.(*entry)
|
||||||
|
@ -630,7 +630,7 @@ func (nDB *NetworkDB) bulkSyncNode(networks []string, node string, unsolicited b
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, nid := range networks {
|
for _, nid := range networks {
|
||||||
nDB.indexes[byNetwork].WalkPrefix(fmt.Sprintf("/%s", nid), func(path string, v interface{}) bool {
|
nDB.indexes[byNetwork].WalkPrefix("/"+nid, func(path string, v interface{}) bool {
|
||||||
entry, ok := v.(*entry)
|
entry, ok := v.(*entry)
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
|
|
|
@ -498,7 +498,7 @@ func (nDB *NetworkDB) deleteNodeNetworkEntries(nid, node string) {
|
||||||
// Indicates if the delete is triggered for the local node
|
// Indicates if the delete is triggered for the local node
|
||||||
isNodeLocal := node == nDB.config.NodeID
|
isNodeLocal := node == nDB.config.NodeID
|
||||||
|
|
||||||
nDB.indexes[byNetwork].WalkPrefix(fmt.Sprintf("/%s", nid),
|
nDB.indexes[byNetwork].WalkPrefix("/"+nid,
|
||||||
func(path string, v interface{}) bool {
|
func(path string, v interface{}) bool {
|
||||||
oldEntry := v.(*entry)
|
oldEntry := v.(*entry)
|
||||||
params := strings.Split(path[1:], "/")
|
params := strings.Split(path[1:], "/")
|
||||||
|
@ -579,7 +579,7 @@ func (nDB *NetworkDB) deleteNodeTableEntries(node string) {
|
||||||
func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte, bool) bool) error {
|
func (nDB *NetworkDB) WalkTable(tname string, fn func(string, string, []byte, bool) bool) error {
|
||||||
nDB.RLock()
|
nDB.RLock()
|
||||||
values := make(map[string]interface{})
|
values := make(map[string]interface{})
|
||||||
nDB.indexes[byTable].WalkPrefix(fmt.Sprintf("/%s", tname), func(path string, v interface{}) bool {
|
nDB.indexes[byTable].WalkPrefix("/"+tname, func(path string, v interface{}) bool {
|
||||||
values[path] = v
|
values[path] = v
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue