Commit 5438d55d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 3b98998d
......@@ -203,11 +203,21 @@ func (fs *FileStorage) Load(xid zodb.Xid) (data []byte, tid zodb.Tid, err error)
return nil, zodb.Tid(0), &ErrXidLoad{xid, &zodb.ErrXidMissing{Xid: xid}}
}
// now read actual data / scan via backpointers
if dh.DataLen == 0 {
// backpointer - TODO
// scan via backpointers
for dh.DataLen == 0 {
var xxx [8]byte // XXX escapes ?
_, err = fs.f.ReadAt(xxx[:], dataPos + DataHeaderSize)
if err != nil {
panic(err) // XXX
}
dataPos = int64(binary.BigEndian.Uint64(xxx[:]))
err = dh.Decode(fs.f, dataPos)
if err != nil {
panic(err) // XXX
}
}
// now read actual data
data = make([]byte, dh.DataLen) // TODO -> slab ?
n, err := fs.f.ReadAt(data, dataPos + DataHeaderSize)
if n == len(data) {
......
......@@ -46,7 +46,7 @@ func TestLoad(t *testing.T) {
t.Errorf("load %v: %v", xid, err)
}
if tid != txh.Tid {
t.Errorf("load %v: returned tid unexpected: %v", xid)
t.Errorf("load %v: returned tid unexpected: %v", xid, tid)
}
if !bytes.Equal(data, txe.Data()) {
t.Errorf("load %v: different data:\nhave: %s\nwant: %s", xid, strconv.Quote(string(data)), strconv.Quote(string(txe.Data())))
......
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