mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +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
|
package storage
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -211,6 +212,7 @@ func (self *dpaChunkStore) Get(key Key) (chunk *Chunk, err error) {
|
||||||
return nil, notFound
|
return nil, notFound
|
||||||
case <-chunk.ReqC:
|
case <-chunk.ReqC:
|
||||||
}
|
}
|
||||||
|
chunk.Size = int64(binary.LittleEndian.Uint64(chunk.SData[0:8]))
|
||||||
return chunk, nil
|
return chunk, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,7 @@ func NewTestLocalStore(path string) (*LocalStore, error) {
|
||||||
// LocalStore is itself a chunk store
|
// LocalStore is itself a chunk store
|
||||||
// unsafe, in that the data is not integrity checked
|
// unsafe, in that the data is not integrity checked
|
||||||
func (self *LocalStore) Put(chunk *Chunk) {
|
func (self *LocalStore) Put(chunk *Chunk) {
|
||||||
|
chunk.Size = int64(binary.LittleEndian.Uint64(chunk.SData[0:8]))
|
||||||
self.memStore.Put(chunk)
|
self.memStore.Put(chunk)
|
||||||
go func() {
|
go func() {
|
||||||
self.DbStore.Put(chunk)
|
self.DbStore.Put(chunk)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue