2 use Test::More tests => 4;
4 use t::common qw( new_fh );
8 my ($fh, $filename) = new_fh();
9 my $db = DBM::Deep->new(
20 local $TODO = "Haven't written transaction code yet";
24 # Add a commit test (using fork) - we don't have to use fork initially. Since
25 # the transaction is in the Engine object and each new() provides a new Engine
28 # Should the transaction be in the Root and not the Engine? How would that
33 Plan for transactions:
34 * In a normal world, every key's version is set to 0. 0 is the indication that
35 this value isn't part of a transaction.
36 * When a transaction is started, it is assigned the next transaction number.
37 The engine handles the transaction, not the DBM::Deep object.
38 * While the transaction is running, all mutations occur in parallel, not
39 overwriting the original. They are assigned the transaction number.
40 * How is a parallel mutation handled? It needs to be handled in the file
41 because we don't who's going to access what from where?
42 - Well, everything has to go through the same Engine object.
43 - Two processes may never access the same transaction.
44 - If a process in the middle of a transaction dies, the transaction is
45 considered void and will be reaped during the next optimize().
46 - So, in theory, by storing the fact that -this- file offset is involved
47 in a transaction should be able to be stored in memory.
50 * Every operation is now transaction-aware
51 * If a transaction is in effect against the file, everyone ELSE has to be
52 aware of it and respect it
53 * Every key now has a transaction number associated with it
54 * Every operation only operates against the key with the appropriate
56 * In the case of %$db = (), there will need to be a 0th level to tell you
58 * Transaction #0 is the HEAD.
59 * Upon commit, your version of reality is overlaid upon the HEAD.
60 * Upon rollback, your version of reality disappears.
61 * Upon process termination, an attempt is made to rollback any pending
62 transaction(s). If ABEND, it's your responsability to optimize().
63 * The exact actions for each tie-method will have to be mapped out.