Commit a3553578 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 7e364c72
// XXX license/copyright
package fs1
// one entry inside transaction
type txnEntry struct {
header DataHeader
data []byte
}
type dbEntry struct {
header TxnHeader
// TODO user, desc, ext
Recordv []txnEntry
}
......@@ -124,16 +124,21 @@ def main():
assert th.tid == txn.tid
assert th.tlen == txn._tend - txn._tpos
emit("\t{")
# -> TxnHeader
emit("\tTxnHeader{")
emit("\t\tTid:\t%s," % hex64(txn.tid))
emit("\t\tRecLenm8:\t%i," % th.tlen)
emit("\t\tStatus:\t'%s'," % txn.status)
emit("\t\tUser:\t\t[]byte(%s)," % escapeqq(txn.user))
emit("\t\tDescription:\t[]byte(%s)," % escapeqq(txn.description))
emit("\t\tExtension:\t[]byte(%s)," % escapeqq(th.ext))
emit("\t\tTxnHeader{")
emit("\t\t\tTid:\t%s," % hex64(txn.tid))
emit("\t\t\tRecLenm8:\t%i," % th.tlen)
emit("\t\t\tStatus:\t'%s'," % txn.status)
emit("\t\t\tUser:\t\t[]byte(%s)," % escapeqq(txn.user))
emit("\t\t\tDescription:\t[]byte(%s)," % escapeqq(txn.description))
emit("\t\t\tExtension:\t[]byte(%s)," % escapeqq(th.ext))
emit("\t\t},")
# -> DataHeader + payload
emit("\n\t\t[]txnEntry{")
for drec in txn: # drec is itemof(TransactionRecordIterator) = Record
# same as with txn - not everything is possible to get via
# higher-level api
......@@ -142,22 +147,25 @@ def main():
assert dh.tid == drec.tid
assert dh.tloc == txn._tpos
emit("\n\t\tDataHeader{")
emit("\t\t\tOid:\t%i," % unpack64(drec.oid))
emit("\t\t\tTid:\t%s," % hex64(drec.tid))
emit("\t\t\t{")
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\tPrevDataRecPos:\t%i," % dh.prev)
emit("\t\t\tTxnPos:\t%i," % txn._tpos)
emit("\t\t\t\t\tPrevDataRecPos:\t%i," % dh.prev)
emit("\t\t\t\t\tTxnPos:\t%i," % txn._tpos)
assert drec.version == ''
emit("\t\t\tDataLen:\t%i," % dh.plen)
emit("\t\t\t\t\tDataLen:\t%i," % dh.plen)
emit("\t\t\t\t},")
plen = dh.plen
if plen == 0:
data = p64(dh.back) # back-pointer or 0 (= delete)
else:
data = drec.data
emit("\t\t\tData:\t[]byte(%s)," % escapeqq(data))
emit("\t\t\t\tData:\t[]byte(%s)," % escapeqq(data))
emit("\t\t\t},")
#.data .data_txn
emit("\t\t},")
......
This diff is collapsed.
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