swarm/storage: with toEncrypt flag

This commit is contained in:
Fabio Barone 2019-02-03 20:31:11 -05:00
parent eb2d20ff17
commit 3dc9065680
2 changed files with 3 additions and 3 deletions

View file

@ -98,11 +98,11 @@ func (f *FileStore) HashSize() int {
}
// Public API. This endpoint returns all chunk hashes (only) for a given file
func (f *FileStore) GetAllReferences(ctx context.Context, data io.Reader) (addrs []Address, err error) {
func (f *FileStore) GetAllReferences(ctx context.Context, data io.Reader, toEncrypt bool) (addrs []Address, err error) {
addrs = make([]Address, 0)
// create a special kind of putter, which only will store the references
putter := &HashExplorer{
hasherStore: NewHasherStore(f.ChunkStore, f.hashFunc, false),
hasherStore: NewHasherStore(f.ChunkStore, f.hashFunc, toEncrypt),
References: make([]Reference, 0),
}
// do the actual splitting anyway, no way around it

View file

@ -193,7 +193,7 @@ func TestGetAllReferences(t *testing.T) {
checkRefs := func(dataSize int, expectedLen int) {
slice := testutil.RandomBytes(1, dataSize)
addrs, err := fileStore.GetAllReferences(context.Background(), bytes.NewReader(slice))
addrs, err := fileStore.GetAllReferences(context.Background(), bytes.NewReader(slice), false)
if err != nil {
t.Fatal(err)
}