comparison src/org/dancres/blitz/entry/OpInfo.java @ 0:3dc0c5604566

Initial checkin of blitz 2.0 fcs - no installer yet.
author Dan Creswell <dan.creswell@gmail.com>
date Sat, 21 Mar 2009 11:00:06 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3dc0c5604566
1 package org.dancres.blitz.entry;
2
3 import java.io.Serializable;
4 import java.io.IOException;
5
6 import org.dancres.blitz.txn.TxnState;
7
8 import org.dancres.blitz.oid.OID;
9
10 import org.dancres.blitz.mangler.MangledEntry;
11
12 /**
13 Every operation performed on the disk layer results in an OpInfo being
14 returned which will contain details of that operation which can be:
15
16 <OL>
17 <LI> Logged to disk for recovery purposes either individually or as part
18 of a transaction record. In these cases, one recovers the OpInfo and
19 invokes <code>restore</code> followed by either <code>commit</code> or
20 <code>abort</code>. </LI>.
21 <LI> Used to finalize an operation either immediately in the case of a
22 null transaction or later as part of a full external transaction </LI>
23 </OL>
24
25 Basic interaction with write is to invoke on the WriteBuddy just before
26 we place the EntrySleeve in the cache so it can set a write lock. We
27 then return the OpInfo which may be put into the list of a transactions
28 operations or we commit it and then release the transaction lock asserted
29 by the WriteBuddy for null transactions <P>
30
31 Basic interaction for a read or take is to iterate through EntrySleeves
32 pinning, offering to buddy and un-pinning. On success from buddy (we
33 keep a pin applied) knowing a transaction lock has been asserted. We then
34 return the OpInfo which will, again, either be commited immediately or
35 stored for a later commit. <P>
36
37 Note that, because underlying implementations always pin their respective
38 entries in a cache, the Entry will be in cache and will be updated in
39 cache (because it can't be flushed). This means that restore can throw
40 a IOException as it reloads state but neither of commit or abort can.
41 */
42 public interface OpInfo extends Serializable {
43
44 /**
45 @return <code>true</code> if this operation is a debug operation with
46 no state that needs preserving
47 */
48 public boolean isDebugOp();
49
50 /**
51 Restore memory-state required to apply this OpInfo.
52 */
53 public void restore() throws IOException;
54
55 /**
56 Apply the action implied by this OpInfo to the underlying FS.
57
58 @return the entry associated with the UID of this OpInfo if it
59 still exists (is not deleted).
60 */
61 public MangledEntry commit(TxnState aState) throws IOException;
62
63 /**
64 Abort the action implied by this OpInfo to the underlying FS.
65
66 @return the entry associated with the UID of this OpInfo if it
67 still exists (is not deleted).
68 */
69 public MangledEntry abort(TxnState aState) throws IOException;
70
71 public String getType();
72
73 public OID getOID();
74 }