Commit b897d7b5 authored by Jeromy's avatar Jeromy

add basic test for blocks package #59

parent 6d19c80d
...@@ -17,7 +17,6 @@ type DagReader struct { ...@@ -17,7 +17,6 @@ type DagReader struct {
node *Node node *Node
position int position int
buf *bytes.Buffer buf *bytes.Buffer
thisData []byte
} }
func NewDagReader(n *Node, serv *DAGService) (io.Reader, error) { func NewDagReader(n *Node, serv *DAGService) (io.Reader, error) {
...@@ -32,7 +31,6 @@ func NewDagReader(n *Node, serv *DAGService) (io.Reader, error) { ...@@ -32,7 +31,6 @@ func NewDagReader(n *Node, serv *DAGService) (io.Reader, error) {
case PBData_File: case PBData_File:
return &DagReader{ return &DagReader{
node: n, node: n,
thisData: pb.GetData(),
serv: serv, serv: serv,
buf: bytes.NewBuffer(pb.GetData()), buf: bytes.NewBuffer(pb.GetData()),
}, nil }, nil
...@@ -63,12 +61,12 @@ func (dr *DagReader) precalcNextBuf() error { ...@@ -63,12 +61,12 @@ func (dr *DagReader) precalcNextBuf() error {
} }
dr.position++ dr.position++
// TODO: dont assume a single layer of indirection
switch pb.GetType() { switch pb.GetType() {
case PBData_Directory: case PBData_Directory:
panic("Why is there a directory under a file?") panic("Why is there a directory under a file?")
case PBData_File: case PBData_File:
//TODO: maybe have a PBData_Block type for indirect blocks? //TODO: this *should* work, needs testing first
//return NewDagReader(nxt, dr.serv)
panic("Not yet handling different layers of indirection!") panic("Not yet handling different layers of indirection!")
case PBData_Raw: case PBData_Raw:
dr.buf = bytes.NewBuffer(pb.GetData()) dr.buf = bytes.NewBuffer(pb.GetData())
......
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