Commit a61e184f authored by Kevin Atkinson's avatar Kevin Atkinson

Create a FilestoreNode object to carry PosInfo

When doing a filestore add, we wrap whatever nodes we create in a
FilestoreNode object and add the PosInfo to it so that the filestore
will be able to extract information as needed.

Edited by whyrusleeping

License: MIT
Signed-off-by: default avatarKevin Atkinson <k@kevina.org>
parent 3381102e
......@@ -10,7 +10,8 @@ import (
var IpfsRabinPoly = chunker.Pol(17437180132763653)
type Rabin struct {
r *chunker.Chunker
r *chunker.Chunker
reader io.Reader
}
func NewRabin(r io.Reader, avgBlkSize uint64) *Rabin {
......@@ -25,7 +26,8 @@ func NewRabinMinMax(r io.Reader, min, avg, max uint64) *Rabin {
ch := chunker.New(r, IpfsRabinPoly, h, avg, min, max)
return &Rabin{
r: ch,
r: ch,
reader: r,
}
}
......@@ -37,3 +39,7 @@ func (r *Rabin) NextBytes() ([]byte, error) {
return ch.Data, nil
}
func (r *Rabin) Reader() io.Reader {
return r.reader
}
......@@ -12,6 +12,7 @@ var log = logging.Logger("chunk")
var DefaultBlockSize int64 = 1024 * 256
type Splitter interface {
Reader() io.Reader
NextBytes() ([]byte, error)
}
......@@ -77,3 +78,7 @@ func (ss *sizeSplitterv2) NextBytes() ([]byte, error) {
return buf[:n], nil
}
func (ss *sizeSplitterv2) Reader() io.Reader {
return ss.r
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment