KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > store > raw > log > Logger


1 /*
2
3    Derby - Class org.apache.derby.iapi.store.raw.log.Logger
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.store.raw.log;
23
24 import org.apache.derby.iapi.store.raw.RawStoreFactory;
25 import org.apache.derby.iapi.store.raw.Loggable;
26 import org.apache.derby.iapi.store.raw.Compensation;
27
28 import org.apache.derby.iapi.store.raw.xact.RawTransaction;
29 import org.apache.derby.iapi.store.raw.xact.TransactionFactory;
30 import org.apache.derby.iapi.store.raw.xact.TransactionId;
31
32 import org.apache.derby.iapi.store.raw.data.DataFactory;
33
34 import org.apache.derby.iapi.error.StandardException;
35
36 import org.apache.derby.iapi.services.io.LimitObjectInput;
37
38 public interface Logger {
39
40     /**
41         Log the loggable operation under the context of the transaction and then
42         apply the operation to the RawStore.
43
44         <BR>
45         Before you call this method, make sure that the Loggable's doMe
46         method will succeed. This method will go ahead and send the log record
47         to disk, and once it does that, then doMe cannot fail or the system
48         will be shut down and recovery may fail. So it is <B> very important
49         </B> to make sure that every resource you need for the loggable's doMe
50         method, such as disk space, has be acquired or accounted for before
51         calling logAndDo.
52
53         @param xact the transaction that is affecting the change
54         @param operation the loggable operation that describes the change
55         @return LogInstant that is the LogInstant of the loggable operation
56
57         @exception StandardException Standard Cloudscape error policy
58        */

59     public LogInstant logAndDo(RawTransaction xact, Loggable operation)
60          throws StandardException;
61
62     /**
63         Log the compensation operation under the context of the transaction
64         and then apply the undo to the RawStore.
65
66         <BR>
67         Before you call this method, make sure that the Compensation's doMe
68         method will succeed. This method will go ahead and send the log record
69         to disk, and once it does that, then doMe cannot fail or the system
70         will be shut down and recovery may fail. So it is <B> very important
71         </B> to make sure that every resource you need for the Compensation's
72         doMe method, such as disk space, has be acquired or accounted for before
73         calling logAndUnDo.
74
75         @param xact the transaction that is affecting the undo
76         @param operation the compensation operation
77         @param undoInstant the logInstant of the change that is to be undone
78         @param in optional data
79
80         @return LogInstant that is the LogInstant of the compensation operation
81
82         @exception StandardException Standard Cloudscape error policy
83        */

84     public LogInstant logAndUndo(RawTransaction xact,
85                                  Compensation operation, LogInstant undoInstant,
86                                  LimitObjectInput in)
87          throws StandardException;
88
89     /**
90         Flush all unwritten log record up to the log instance indicated to disk.
91
92         @param where flush log up to here
93
94         @exception StandardException cannot flush due to sync error
95     */

96     public void flush(LogInstant where) throws StandardException;
97
98
99     /**
100         Flush all unwritten log to disk
101
102         @exception StandardException cannot flush due to sync error
103     */

104     public void flushAll() throws StandardException;
105
106     /**
107      * During recovery re-prepare a transaction.
108      * <p>
109      * After redo() and undo(), this routine is called on all outstanding
110      * in-doubt (prepared) transactions. This routine re-acquires all
111      * logical write locks for operations in the xact, and then modifies
112      * the transaction table entry to make the transaction look as if it
113      * had just been prepared following startup after recovery.
114      * <p>
115      *
116      * @param t is the transaction performing the re-prepare
117      * @param undoId is the transaction ID to be re-prepared
118      * @param undoStopAt is where the log instant (inclusive) where the
119      * re-prepare should stop.
120      * @param undoStartAt is the log instant (inclusive) where re-prepare
121      * should begin, this is normally the log instant of
122      * the last log record of the transaction that is to
123      * be re-prepare. If null, then re-prepare starts
124      * from the end of the log.
125      *
126      * @exception StandardException Standard exception policy.
127      **/

128     public void reprepare(
129     RawTransaction t,
130     TransactionId undoId,
131     LogInstant undoStopAt,
132     LogInstant undoStartAt)
133         throws StandardException;
134
135     /**
136       Undo transaction.
137
138       @param t is the transaction performing the rollback
139       @param undoId is the transaction ID to be rolled back
140       @param undoStopAt is where the log instant (inclusive) where
141                 the rollback should stop.
142       @param undoStartAt is the log instant (inclusive) where rollback
143                 should begin, this is normally the log instant of
144                 the last log record of the transaction that is
145                 to be rolled back.
146                 If null, then rollback starts from the end of the log.
147
148         @exception StandardException Standard Cloudscape error policy
149       */

150     public void undo(RawTransaction t,
151                      TransactionId undoId,
152                      LogInstant undoStopAt,
153                      LogInstant undoStartAt) throws StandardException;
154 }
155
Popular Tags