swarm/storage: lock as value not pointer

This commit is contained in:
Fabio Barone 2019-02-10 20:05:18 -05:00
parent 70d17edc89
commit ab03f8f081

View file

@ -105,7 +105,6 @@ func (f *FileStore) GetAllReferences(ctx context.Context, data io.Reader, toEncr
putter := &HashExplorer{ putter := &HashExplorer{
hasherStore: NewHasherStore(f.ChunkStore, f.hashFunc, toEncrypt), hasherStore: NewHasherStore(f.ChunkStore, f.hashFunc, toEncrypt),
References: make([]Reference, 0), References: make([]Reference, 0),
lock: &sync.RWMutex{},
} }
// do the actual splitting anyway, no way around it // do the actual splitting anyway, no way around it
_, _, err = PyramidSplit(ctx, data, putter, putter) _, _, err = PyramidSplit(ctx, data, putter, putter)
@ -125,7 +124,7 @@ func (f *FileStore) GetAllReferences(ctx context.Context, data io.Reader, toEncr
type HashExplorer struct { type HashExplorer struct {
*hasherStore *hasherStore
References []Reference References []Reference
lock *sync.RWMutex lock sync.RWMutex
} }
// HashExplorer's Put will add just the chunk hashes to its `References` // HashExplorer's Put will add just the chunk hashes to its `References`