Commit 613dbf6a authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 928ad0b8
......@@ -39,11 +39,15 @@ def xtime():
time.time = xtime
def commit(user, description, extension):
def precommit(user, description, extension):
txn = transaction.get()
txn.user = user
txn.description = description
txn.extension = extension
return txn
def commit(user, description, extension):
txn = precommit(user, description, extension)
txn.commit()
class Object(Persistent):
......@@ -62,17 +66,17 @@ def main():
outfs = "testdata/1.fs"
stor = FileStorage(outfs, create=True)
db = DB(stor)
conn = db.open()
root = conn.root()
assert root._p_oid == p64(0), `root._p_oid`
# generate random changes to objects hooked to top-level root by a/b/c/... key
random.seed(0)
namev = [_ for _ in "abcdefg"]
for i in range(2):
stor = FileStorage(outfs, create=(i == 0))
db = DB(stor)
conn = db.open()
root = conn.root()
assert root._p_oid == p64(0), `root._p_oid`
for j in range(25):
name = random.choice(namev)
if name in root:
......@@ -92,12 +96,25 @@ def main():
u"undo %i.%i\nmore detailed description\n\nzzz ..." % (i, j) + "\t"*(i+j),
{"x-generator": "zodb/py2 (undo %s)" % ul["id"]})
# TODO delete an object
# delete an object
#obj = random.choice(root.values())
#txn = precommit(u"root%i\nYour\nRoyal\nMagesty " % i,
# u"delete %i\nalpha beta gamma\n\nqqq ..." % i,
# {"x-generator": "zodb/py2 (delete %s)" % hex64(obj._p_oid)})
#stor.tpc_begin(txn)
#stor.deleteObject(obj._p_oid, obj._p_serial, txn)
#stor.tpc_vote(txn)
#stor.tpc_finish(txn)
# close db & rest not to get conflict errors after we touched stor
# directly a bit. everything will be reopened on next iteration.
conn.close()
db.close()
stor.close()
# TODO different txn status
# dump to go what to expect
with open("testdata_expect_test.go", "w") as f:
def emit(v):
......
......@@ -940,7 +940,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 196,
Len: 409,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbaca8f5c2cc,
Tid: 0x0285cbacce81b533,
Status: ' ',
User: []byte("user1.0"),
Description: []byte("step 1.0"),
......@@ -953,7 +953,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 5572,
Oid: 0,
Tid: 0x0285cbaca8f5c2cc,
Tid: 0x0285cbacce81b533,
PrevRevPos: 2635,
TxnPos: 5500,
DataLen: 216,
......@@ -966,7 +966,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 5830,
Oid: 7,
Tid: 0x0285cbaca8f5c2cc,
Tid: 0x0285cbacce81b533,
PrevRevPos: 0,
TxnPos: 5500,
DataLen: 29,
......@@ -983,7 +983,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 409,
Len: 151,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacada74119,
Tid: 0x0285cbacd3333380,
Status: ' ',
User: []byte("user1.1"),
Description: []byte("step 1.1"),
......@@ -996,7 +996,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 5981,
Oid: 4,
Tid: 0x0285cbacada74119,
Tid: 0x0285cbacd3333380,
PrevRevPos: 5442,
TxnPos: 5909,
DataLen: 29,
......@@ -1013,7 +1013,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 151,
Len: 151,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacb258bf66,
Tid: 0x0285cbacd7e4b1cc,
Status: ' ',
User: []byte("user1.2"),
Description: []byte("step 1.2"),
......@@ -1026,7 +1026,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 6132,
Oid: 5,
Tid: 0x0285cbacb258bf66,
Tid: 0x0285cbacd7e4b1cc,
PrevRevPos: 5246,
TxnPos: 6060,
DataLen: 29,
......@@ -1043,7 +1043,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 151,
Len: 151,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacb70a3db3,
Tid: 0x0285cbacdc963019,
Status: ' ',
User: []byte("user1.3"),
Description: []byte("step 1.3"),
......@@ -1056,7 +1056,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 6283,
Oid: 6,
Tid: 0x0285cbacb70a3db3,
Tid: 0x0285cbacdc963019,
PrevRevPos: 4721,
TxnPos: 6211,
DataLen: 29,
......@@ -1073,7 +1073,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 151,
Len: 151,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacbbbbbc00,
Tid: 0x0285cbace147ae66,
Status: ' ',
User: []byte("user1.4"),
Description: []byte("step 1.4"),
......@@ -1086,7 +1086,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 6434,
Oid: 6,
Tid: 0x0285cbacbbbbbc00,
Tid: 0x0285cbace147ae66,
PrevRevPos: 6283,
TxnPos: 6362,
DataLen: 29,
......@@ -1103,7 +1103,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 151,
Len: 151,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacc06d3a4c,
Tid: 0x0285cbace5f92cb3,
Status: ' ',
User: []byte("user1.5"),
Description: []byte("step 1.5"),
......@@ -1116,7 +1116,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 6585,
Oid: 4,
Tid: 0x0285cbacc06d3a4c,
Tid: 0x0285cbace5f92cb3,
PrevRevPos: 5981,
TxnPos: 6513,
DataLen: 29,
......@@ -1133,7 +1133,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 151,
Len: 151,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacc51eb899,
Tid: 0x0285cbaceaaaab00,
Status: ' ',
User: []byte("user1.6"),
Description: []byte("step 1.6"),
......@@ -1146,7 +1146,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 6736,
Oid: 6,
Tid: 0x0285cbacc51eb899,
Tid: 0x0285cbaceaaaab00,
PrevRevPos: 6434,
TxnPos: 6664,
DataLen: 29,
......@@ -1163,7 +1163,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 151,
Len: 151,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacc9d036e6,
Tid: 0x0285cbacef5c294c,
Status: ' ',
User: []byte("user1.7"),
Description: []byte("step 1.7"),
......@@ -1176,7 +1176,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 6887,
Oid: 3,
Tid: 0x0285cbacc9d036e6,
Tid: 0x0285cbacef5c294c,
PrevRevPos: 3643,
TxnPos: 6815,
DataLen: 29,
......@@ -1193,7 +1193,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 151,
Len: 151,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacce81b533,
Tid: 0x0285cbacf40da799,
Status: ' ',
User: []byte("user1.8"),
Description: []byte("step 1.8"),
......@@ -1206,7 +1206,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 7038,
Oid: 1,
Tid: 0x0285cbacce81b533,
Tid: 0x0285cbacf40da799,
PrevRevPos: 4567,
TxnPos: 6966,
DataLen: 29,
......@@ -1223,7 +1223,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 151,
Len: 151,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacd3333380,
Tid: 0x0285cbacf8bf25e6,
Status: ' ',
User: []byte("user1.9"),
Description: []byte("step 1.9"),
......@@ -1236,7 +1236,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 7189,
Oid: 4,
Tid: 0x0285cbacd3333380,
Tid: 0x0285cbacf8bf25e6,
PrevRevPos: 6585,
TxnPos: 7117,
DataLen: 29,
......@@ -1253,7 +1253,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 151,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacd7e4b1cc,
Tid: 0x0285cbacfd70a433,
Status: ' ',
User: []byte("user1.10"),
Description: []byte("step 1.10"),
......@@ -1266,7 +1266,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 7342,
Oid: 7,
Tid: 0x0285cbacd7e4b1cc,
Tid: 0x0285cbacfd70a433,
PrevRevPos: 5830,
TxnPos: 7268,
DataLen: 30,
......@@ -1283,7 +1283,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacdc963019,
Tid: 0x0285cbad02222280,
Status: ' ',
User: []byte("user1.11"),
Description: []byte("step 1.11"),
......@@ -1296,7 +1296,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 7496,
Oid: 1,
Tid: 0x0285cbacdc963019,
Tid: 0x0285cbad02222280,
PrevRevPos: 7038,
TxnPos: 7422,
DataLen: 30,
......@@ -1313,7 +1313,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbace147ae66,
Tid: 0x0285cbad06d3a0cc,
Status: ' ',
User: []byte("user1.12"),
Description: []byte("step 1.12"),
......@@ -1326,7 +1326,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 7650,
Oid: 2,
Tid: 0x0285cbace147ae66,
Tid: 0x0285cbad06d3a0cc,
PrevRevPos: 4413,
TxnPos: 7576,
DataLen: 30,
......@@ -1343,7 +1343,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbace5f92cb3,
Tid: 0x0285cbad0b851f19,
Status: ' ',
User: []byte("user1.13"),
Description: []byte("step 1.13"),
......@@ -1356,7 +1356,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 7804,
Oid: 1,
Tid: 0x0285cbace5f92cb3,
Tid: 0x0285cbad0b851f19,
PrevRevPos: 7496,
TxnPos: 7730,
DataLen: 30,
......@@ -1373,7 +1373,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbaceaaaab00,
Tid: 0x0285cbad10369d66,
Status: ' ',
User: []byte("user1.14"),
Description: []byte("step 1.14"),
......@@ -1386,7 +1386,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 7958,
Oid: 5,
Tid: 0x0285cbaceaaaab00,
Tid: 0x0285cbad10369d66,
PrevRevPos: 6132,
TxnPos: 7884,
DataLen: 30,
......@@ -1403,7 +1403,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacef5c294c,
Tid: 0x0285cbad14e81bb3,
Status: ' ',
User: []byte("user1.15"),
Description: []byte("step 1.15"),
......@@ -1416,7 +1416,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 8112,
Oid: 7,
Tid: 0x0285cbacef5c294c,
Tid: 0x0285cbad14e81bb3,
PrevRevPos: 7342,
TxnPos: 8038,
DataLen: 30,
......@@ -1433,7 +1433,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacf40da799,
Tid: 0x0285cbad19999a00,
Status: ' ',
User: []byte("user1.16"),
Description: []byte("step 1.16"),
......@@ -1446,7 +1446,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 8266,
Oid: 4,
Tid: 0x0285cbacf40da799,
Tid: 0x0285cbad19999a00,
PrevRevPos: 7189,
TxnPos: 8192,
DataLen: 30,
......@@ -1463,7 +1463,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacf8bf25e6,
Tid: 0x0285cbad1e4b184c,
Status: ' ',
User: []byte("user1.17"),
Description: []byte("step 1.17"),
......@@ -1476,7 +1476,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 8420,
Oid: 6,
Tid: 0x0285cbacf8bf25e6,
Tid: 0x0285cbad1e4b184c,
PrevRevPos: 6736,
TxnPos: 8346,
DataLen: 30,
......@@ -1493,7 +1493,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbacfd70a433,
Tid: 0x0285cbad22fc9699,
Status: ' ',
User: []byte("user1.18"),
Description: []byte("step 1.18"),
......@@ -1506,7 +1506,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 8574,
Oid: 3,
Tid: 0x0285cbacfd70a433,
Tid: 0x0285cbad22fc9699,
PrevRevPos: 6887,
TxnPos: 8500,
DataLen: 30,
......@@ -1523,7 +1523,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbad02222280,
Tid: 0x0285cbad27ae14e6,
Status: ' ',
User: []byte("user1.19"),
Description: []byte("step 1.19"),
......@@ -1536,7 +1536,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 8728,
Oid: 2,
Tid: 0x0285cbad02222280,
Tid: 0x0285cbad27ae14e6,
PrevRevPos: 7650,
TxnPos: 8654,
DataLen: 30,
......@@ -1553,7 +1553,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbad06d3a0cc,
Tid: 0x0285cbad2c5f9333,
Status: ' ',
User: []byte("user1.20"),
Description: []byte("step 1.20"),
......@@ -1566,7 +1566,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 8882,
Oid: 6,
Tid: 0x0285cbad06d3a0cc,
Tid: 0x0285cbad2c5f9333,
PrevRevPos: 8420,
TxnPos: 8808,
DataLen: 30,
......@@ -1583,7 +1583,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbad0b851f19,
Tid: 0x0285cbad31111180,
Status: ' ',
User: []byte("user1.21"),
Description: []byte("step 1.21"),
......@@ -1596,7 +1596,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 9036,
Oid: 3,
Tid: 0x0285cbad0b851f19,
Tid: 0x0285cbad31111180,
PrevRevPos: 8574,
TxnPos: 8962,
DataLen: 30,
......@@ -1613,7 +1613,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbad10369d66,
Tid: 0x0285cbad35c28fcc,
Status: ' ',
User: []byte("user1.22"),
Description: []byte("step 1.22"),
......@@ -1626,7 +1626,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 9190,
Oid: 4,
Tid: 0x0285cbad10369d66,
Tid: 0x0285cbad35c28fcc,
PrevRevPos: 8266,
TxnPos: 9116,
DataLen: 30,
......@@ -1643,7 +1643,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbad14e81bb3,
Tid: 0x0285cbad3a740e19,
Status: ' ',
User: []byte("user1.23"),
Description: []byte("step 1.23"),
......@@ -1656,7 +1656,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 9344,
Oid: 3,
Tid: 0x0285cbad14e81bb3,
Tid: 0x0285cbad3a740e19,
PrevRevPos: 9036,
TxnPos: 9270,
DataLen: 30,
......@@ -1673,7 +1673,7 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 154,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbad19999a00,
Tid: 0x0285cbad3f258c66,
Status: ' ',
User: []byte("user1.24"),
Description: []byte("step 1.24"),
......@@ -1686,7 +1686,7 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 9498,
Oid: 6,
Tid: 0x0285cbad19999a00,
Tid: 0x0285cbad3f258c66,
PrevRevPos: 8882,
TxnPos: 9424,
DataLen: 30,
......@@ -1703,11 +1703,11 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 154,
Len: 196,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbad1e4b184c,
Tid: 0x0285cbad43d70ab3,
Status: ' ',
User: []byte("root1.0\nYour\nMagesty "),
Description: []byte("undo 1.0\nmore detailed description\n\nzzz ...\t"),
Extension: []byte("}q\x01U\x0bx-generatorq\x02U\x1czodb/py2 (undo AoXLrRToG7M=)s."),
Extension: []byte("}q\x01U\x0bx-generatorq\x02U\x1czodb/py2 (undo AoXLrTp0Dhk=)s."),
},
},
......@@ -1716,14 +1716,14 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 9716,
Oid: 3,
Tid: 0x0285cbad1e4b184c,
Tid: 0x0285cbad43d70ab3,
PrevRevPos: 9344,
TxnPos: 9578,
DataLen: 0,
},
[]byte("\x00\x00\x00\x00\x00\x00#L"),
[]byte("c__main__\nObject\nq\x01.U\x05b1.21q\x02."),
0x0285cbad0b851f19,
0x0285cbad31111180,
},
},
},
......@@ -1733,11 +1733,11 @@ var _1fs_dbEntryv = [...]dbEntry{
LenPrev: 196,
Len: 197,
TxnInfo: zodb.TxnInfo{
Tid: 0x0285cbad22fc9699,
Tid: 0x0285cbad48888900,
Status: ' ',
User: []byte("root1.1\nYour\nMagesty "),
Description: []byte("undo 1.1\nmore detailed description\n\nzzz ...\t\t"),
Extension: []byte("}q\x01U\x0bx-generatorq\x02U\x1czodb/py2 (undo AoXLrRmZmgA=)s."),
Extension: []byte("}q\x01U\x0bx-generatorq\x02U\x1czodb/py2 (undo AoXLrT8ljGY=)s."),
},
},
......@@ -1746,14 +1746,14 @@ var _1fs_dbEntryv = [...]dbEntry{
DataHeader{
Pos: 9913,
Oid: 6,
Tid: 0x0285cbad22fc9699,
Tid: 0x0285cbad48888900,
PrevRevPos: 9498,
TxnPos: 9774,
DataLen: 0,
},
[]byte("\x00\x00\x00\x00\x00\x00\"\xb2"),
[]byte("c__main__\nObject\nq\x01.U\x05g1.20q\x02."),
0x0285cbad06d3a0cc,
0x0285cbad2c5f9333,
},
},
},
......
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