Commit 3b98998d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent adea442b
......@@ -12,13 +12,22 @@ import (
// one entry inside transaction
type txnEntry struct {
header DataHeader
data []byte
Header DataHeader
rawData []byte // what is on disk, e.g. it can be backpointer
data []byte // data client should see on load; nil means same as RawData
}
func (txe *txnEntry) Data() []byte {
data := txe.data
if data == nil {
data = txe.rawData
}
return data
}
type dbEntry struct {
header TxnHeader
entryv []txnEntry
Header TxnHeader
Entryv []txnEntry
}
func TestLoad(t *testing.T) {
......@@ -28,11 +37,8 @@ func TestLoad(t *testing.T) {
}
for _, dbe := range _1fs_dbEntryv {
for _, txe := range dbe.entryv {
txh := txe.header
if txh.DataLen == 0 {
continue // FIXME skipping backpointers
}
for _, txe := range dbe.Entryv {
txh := txe.Header
xid := zodb.Xid{zodb.XTid{txh.Tid, false}, txh.Oid} // loadSerial
data, tid, err := fs.Load(xid)
......@@ -42,8 +48,8 @@ func TestLoad(t *testing.T) {
if tid != txh.Tid {
t.Errorf("load %v: returned tid unexpected: %v", xid)
}
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)))
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())))
}
}
}
......
......@@ -151,7 +151,6 @@ def main():
emit("\t\t\t\tDataHeader{")
emit("\t\t\t\t\tOid:\t%i," % unpack64(drec.oid))
emit("\t\t\t\t\tTid:\t%s," % hex64(drec.tid))
# drec: .data .prev (=prev_txn)
emit("\t\t\t\t\tPrevDataRecPos:\t%i," % dh.prev)
emit("\t\t\t\t\tTxnPos:\t%i," % txn._tpos)
......@@ -160,11 +159,14 @@ def main():
emit("\t\t\t\t},")
plen = dh.plen
if plen == 0:
data = p64(dh.back) # back-pointer or 0 (= delete)
rawdata = p64(dh.back) # back-pointer or 0 (= delete)
data = "[]byte(%s)" % escapeqq(drec.data) # XXX vs .data = None ?
else:
data = drec.data
rawdata = drec.data
data = "nil"
emit("\t\t\t\t[]byte(%s)," % escapeqq(data))
emit("\t\t\t\t[]byte(%s)," % escapeqq(rawdata))
emit("\t\t\t\t%s /* same as ^^^ */," % data)
emit("\t\t\t},")
emit("\t\t},")
......
......@@ -34,6 +34,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 60,
},
[]byte("(cpersistent.mapping\nPersistentMapping\nq\x01Nt.}q\x02U\x04dataq\x03}q\x04s."),
nil /* same as ^^^ */,
},
},
},
......@@ -57,6 +58,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 95,
},
[]byte("cpersistent.mapping\nPersistentMapping\nq\x01.}q\x02U\x04dataq\x03}q\x04U\x01f(U\x08\x00\x00\x00\x00\x00\x00\x00\x01q\x05c__main__\nObject\nq\x06tQss."),
nil /* same as ^^^ */,
},
{
DataHeader{
......@@ -67,6 +69,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04f0.0q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -90,6 +93,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04f0.1q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -113,6 +117,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 116,
},
[]byte("cpersistent.mapping\nPersistentMapping\nq\x01.}q\x02U\x04dataq\x03}q\x04(U\x01c(U\x08\x00\x00\x00\x00\x00\x00\x00\x02q\x05c__main__\nObject\nq\x06tQU\x01f(U\x08\x00\x00\x00\x00\x00\x00\x00\x01q\x07h\x06tQus."),
nil /* same as ^^^ */,
},
{
DataHeader{
......@@ -123,6 +128,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04c0.2q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -146,6 +152,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 136,
},
[]byte("cpersistent.mapping\nPersistentMapping\nq\x01.}q\x02U\x04dataq\x03}q\x04(U\x01c(U\x08\x00\x00\x00\x00\x00\x00\x00\x02q\x05c__main__\nObject\nq\x06tQU\x01b(U\x08\x00\x00\x00\x00\x00\x00\x00\x03q\x07h\x06tQU\x01f(U\x08\x00\x00\x00\x00\x00\x00\x00\x01q\x08h\x06tQus."),
nil /* same as ^^^ */,
},
{
DataHeader{
......@@ -156,6 +163,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04b0.3q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -179,6 +187,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 156,
},
[]byte("cpersistent.mapping\nPersistentMapping\nq\x01.}q\x02U\x04dataq\x03}q\x04(U\x01c(U\x08\x00\x00\x00\x00\x00\x00\x00\x02q\x05c__main__\nObject\nq\x06tQU\x01b(U\x08\x00\x00\x00\x00\x00\x00\x00\x03q\x07h\x06tQU\x01d(U\x08\x00\x00\x00\x00\x00\x00\x00\x04q\x08h\x06tQU\x01f(U\x08\x00\x00\x00\x00\x00\x00\x00\x01q\th\x06tQus."),
nil /* same as ^^^ */,
},
{
DataHeader{
......@@ -189,6 +198,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04d0.4q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -212,6 +222,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04c0.5q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -235,6 +246,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04f0.6q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -258,6 +270,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04c0.7q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -281,6 +294,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04d0.8q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -304,6 +318,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 176,
},
[]byte("cpersistent.mapping\nPersistentMapping\nq\x01.}q\x02U\x04dataq\x03}q\x04(U\x01c(U\x08\x00\x00\x00\x00\x00\x00\x00\x02q\x05c__main__\nObject\nq\x06tQU\x01b(U\x08\x00\x00\x00\x00\x00\x00\x00\x03q\x07h\x06tQU\x01e(U\x08\x00\x00\x00\x00\x00\x00\x00\x05q\x08h\x06tQU\x01d(U\x08\x00\x00\x00\x00\x00\x00\x00\x04q\th\x06tQU\x01f(U\x08\x00\x00\x00\x00\x00\x00\x00\x01q\nh\x06tQus."),
nil /* same as ^^^ */,
},
{
DataHeader{
......@@ -314,6 +329,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04e0.9q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -337,6 +353,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 196,
},
[]byte("cpersistent.mapping\nPersistentMapping\nq\x01.}q\x02U\x04dataq\x03}q\x04(U\x01c(U\x08\x00\x00\x00\x00\x00\x00\x00\x02q\x05c__main__\nObject\nq\x06tQU\x01b(U\x08\x00\x00\x00\x00\x00\x00\x00\x03q\x07h\x06tQU\x01e(U\x08\x00\x00\x00\x00\x00\x00\x00\x05q\x08h\x06tQU\x01d(U\x08\x00\x00\x00\x00\x00\x00\x00\x04q\th\x06tQU\x01g(U\x08\x00\x00\x00\x00\x00\x00\x00\x06q\nh\x06tQU\x01f(U\x08\x00\x00\x00\x00\x00\x00\x00\x01q\x0bh\x06tQus."),
nil /* same as ^^^ */,
},
{
DataHeader{
......@@ -347,6 +364,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05g0.10q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -370,6 +388,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05d0.11q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -393,6 +412,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05b0.12q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -416,6 +436,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05f0.13q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -439,6 +460,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05e0.14q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -462,6 +484,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05b0.15q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -485,6 +508,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05g0.16q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -508,6 +532,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05g0.17q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -531,6 +556,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05f0.18q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -554,6 +580,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05g0.19q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -577,6 +604,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05c0.20q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -600,6 +628,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05f0.21q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -623,6 +652,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05g0.22q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -646,6 +676,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05e0.23q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -669,6 +700,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05d0.24q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -692,6 +724,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 0,
},
[]byte("\x00\x00\x00\x00\x00\x00\r\xa1"),
[]byte("c__main__\nObject\nq\x01.U\x05e0.14q\x02.") /* same as ^^^ */,
},
},
},
......@@ -715,6 +748,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 0,
},
[]byte("\x00\x00\x00\x00\x00\x00\x0b\xd3"),
[]byte("c__main__\nObject\nq\x01.U\x05d0.11q\x02.") /* same as ^^^ */,
},
},
},
......@@ -738,6 +772,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 216,
},
[]byte("cpersistent.mapping\nPersistentMapping\nq\x01.}q\x02U\x04dataq\x03}q\x04(U\x01a(U\x08\x00\x00\x00\x00\x00\x00\x00\x07q\x05c__main__\nObject\nq\x06tQU\x01c(U\x08\x00\x00\x00\x00\x00\x00\x00\x02q\x07h\x06tQU\x01b(U\x08\x00\x00\x00\x00\x00\x00\x00\x03q\x08h\x06tQU\x01e(U\x08\x00\x00\x00\x00\x00\x00\x00\x05q\th\x06tQU\x01d(U\x08\x00\x00\x00\x00\x00\x00\x00\x04q\nh\x06tQU\x01g(U\x08\x00\x00\x00\x00\x00\x00\x00\x06q\x0bh\x06tQU\x01f(U\x08\x00\x00\x00\x00\x00\x00\x00\x01q\x0ch\x06tQus."),
nil /* same as ^^^ */,
},
{
DataHeader{
......@@ -748,6 +783,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04a1.0q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -771,6 +807,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04d1.1q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -794,6 +831,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04e1.2q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -817,6 +855,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04g1.3q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -840,6 +879,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04g1.4q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -863,6 +903,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04d1.5q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -886,6 +927,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04g1.6q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -909,6 +951,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04b1.7q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -932,6 +975,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04f1.8q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -955,6 +999,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 29,
},
[]byte("c__main__\nObject\nq\x01.U\x04d1.9q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -978,6 +1023,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05a1.10q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1001,6 +1047,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05f1.11q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1024,6 +1071,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05c1.12q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1047,6 +1095,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05f1.13q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1070,6 +1119,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05e1.14q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1093,6 +1143,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05a1.15q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1116,6 +1167,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05d1.16q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1139,6 +1191,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05g1.17q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1162,6 +1215,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05b1.18q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1185,6 +1239,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05c1.19q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1208,6 +1263,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05g1.20q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1231,6 +1287,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05b1.21q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1254,6 +1311,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05d1.22q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1277,6 +1335,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05b1.23q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1300,6 +1359,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 30,
},
[]byte("c__main__\nObject\nq\x01.U\x05g1.24q\x02."),
nil /* same as ^^^ */,
},
},
},
......@@ -1323,6 +1383,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 0,
},
[]byte("\x00\x00\x00\x00\x00\x00#L"),
[]byte("c__main__\nObject\nq\x01.U\x05b1.21q\x02.") /* same as ^^^ */,
},
},
},
......@@ -1346,6 +1407,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataLen: 0,
},
[]byte("\x00\x00\x00\x00\x00\x00\"\xb2"),
[]byte("c__main__\nObject\nq\x01.U\x05g1.20q\x02.") /* same as ^^^ */,
},
},
},
......
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