Skip to content

Commit b3a8fd9

Browse files
committed
cleanup imports
Signed-off-by: Jakub Sztandera <[email protected]>
1 parent 4683ce3 commit b3a8fd9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

mapreduce.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"math/rand/v2"
99
"sync"
1010

11-
cid "github.com/ipfs/go-cid"
11+
"github.com/ipfs/go-cid"
1212
cbor "github.com/ipfs/go-ipld-cbor"
1313
cbg "github.com/whyrusleeping/cbor-gen"
1414
xerrors "golang.org/x/xerrors"
@@ -18,6 +18,7 @@ type cacheEntry[T any] struct {
1818
value T
1919
weight int
2020
}
21+
2122
type weigthted2RCache[T any] struct {
2223
lk sync.Mutex
2324
cache map[cid.Cid]cacheEntry[T]
@@ -30,6 +31,7 @@ func newWeighted2RCache[T any](cacheSize int) *weigthted2RCache[T] {
3031
cacheSize: cacheSize,
3132
}
3233
}
34+
3335
func (c *weigthted2RCache[T]) Get(k cid.Cid) (cacheEntry[T], bool) {
3436
c.lk.Lock()
3537
defer c.lk.Unlock()
@@ -54,8 +56,8 @@ func (c *weigthted2RCache[T]) Add(k cid.Cid, v cacheEntry[T]) {
5456

5557
c.cache[k] = v
5658
if len(c.cache) > c.cacheSize {
57-
// pick two random entris using map iteration
58-
// work well for cacheSize > 8
59+
// pick two random entries using map iteration
60+
// this works well for cacheSize > 8
5961
var k1, k2 cid.Cid
6062
var v1, v2 cacheEntry[T]
6163
for k, v := range c.cache {

0 commit comments

Comments
 (0)