mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
swarm/storage: Store chunk size
This commit is contained in:
parent
61f5aa4e01
commit
91b6a66f03
2 changed files with 3 additions and 0 deletions
|
|
@ -17,6 +17,7 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
|
@ -211,6 +212,7 @@ func (self *dpaChunkStore) Get(key Key) (chunk *Chunk, err error) {
|
|||
return nil, notFound
|
||||
case <-chunk.ReqC:
|
||||
}
|
||||
chunk.Size = int64(binary.LittleEndian.Uint64(chunk.SData[0:8]))
|
||||
return chunk, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ func NewTestLocalStore(path string) (*LocalStore, error) {
|
|||
// LocalStore is itself a chunk store
|
||||
// unsafe, in that the data is not integrity checked
|
||||
func (self *LocalStore) Put(chunk *Chunk) {
|
||||
chunk.Size = int64(binary.LittleEndian.Uint64(chunk.SData[0:8]))
|
||||
self.memStore.Put(chunk)
|
||||
go func() {
|
||||
self.DbStore.Put(chunk)
|
||||
|
|
|
|||
Loading…
Reference in a new issue