KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > quadcap > sql > file > Log


1 package com.quadcap.sql.file;
2
3 /* Copyright 1999 - 2003 Quadcap Software. All rights reserved.
4  *
5  * This software is distributed under the Quadcap Free Software License.
6  * This software may be used or modified for any purpose, personal or
7  * commercial. Open Source redistributions are permitted. Commercial
8  * redistribution of larger works derived from, or works which bundle
9  * this software requires a "Commercial Redistribution License"; see
10  * http://www.quadcap.com/purchase.
11  *
12  * Redistributions qualify as "Open Source" under one of the following terms:
13  *
14  * Redistributions are made at no charge beyond the reasonable cost of
15  * materials and delivery.
16  *
17  * Redistributions are accompanied by a copy of the Source Code or by an
18  * irrevocable offer to provide a copy of the Source Code for up to three
19  * years at the cost of materials and delivery. Such redistributions
20  * must allow further use, modification, and redistribution of the Source
21  * Code under substantially the same terms as this license.
22  *
23  * Redistributions of source code must retain the copyright notices as they
24  * appear in each source code file, these license terms, and the
25  * disclaimer/limitation of liability set forth as paragraph 6 below.
26  *
27  * Redistributions in binary form must reproduce this Copyright Notice,
28  * these license terms, and the disclaimer/limitation of liability set
29  * forth as paragraph 6 below, in the documentation and/or other materials
30  * provided with the distribution.
31  *
32  * The Software is provided on an "AS IS" basis. No warranty is
33  * provided that the Software is free of defects, or fit for a
34  * particular purpose.
35  *
36  * Limitation of Liability. Quadcap Software shall not be liable
37  * for any damages suffered by the Licensee or any third party resulting
38  * from use of the Software.
39  */

40
41 import java.io.File JavaDoc;
42 import java.io.IOException JavaDoc;
43
44 import java.util.Properties JavaDoc;
45
46 import com.quadcap.sql.lock.Transaction;
47
48 /**
49  * Interface to logging subsystem.
50  *
51  * @author Stan Bailes
52  */

53 public interface Log {
54     /**
55      * Initialize the logging subsystem
56      */

57     public void init(Datafile db, boolean create, Properties JavaDoc props)
58     throws IOException JavaDoc;
59
60     /**
61      * Start the logging subsystem
62      */

63     public void start();
64
65     /**
66      * Return the database that we're logging for
67      */

68     public Datafile getDatafile();
69
70 // /**
71
// * Return the database root directory
72
// */
73
// public File getDbRootDir();
74

75     /**
76      * Add a transaction's log record to the end of the open log file
77      */

78     public void addEntry(LogEntry entry) throws IOException JavaDoc;
79
80     /**
81      * XXX why public?
82      */

83     public void reallyAddEntry(LogEntry entry) throws IOException JavaDoc;
84     
85     /**
86      * Flush and close the log file.
87      */

88     public void close() throws IOException JavaDoc;
89     
90     /**
91      * Flush all log records to disk.
92      */

93     public void flushLog() throws IOException JavaDoc;
94
95     /**
96      * Perform a checkpoint operation.
97      */

98     public void checkpoint() throws IOException JavaDoc;
99
100     /**
101      * Wait for all queue ops to be processed by the log sync thread
102      */

103     public void sync() throws IOException JavaDoc;
104
105     /**
106      * Transaction rollback.
107      */

108     public void rollbackTransaction(Transaction trans) throws IOException JavaDoc;
109         
110     /**
111      * Statement rollback.
112      */

113     public void rollbackStatement(Transaction trans, int stmtId)
114     throws IOException JavaDoc;
115
116     /**
117      * Restart from a previous state
118      */

119     public void restart() throws Exception JavaDoc;
120
121     /**
122      * Retrieve a row mapping.
123      */

124     public long getRowMap(long rowId);
125
126     /**
127      * Remember a row mapping {old,new} The old row (logRow) is now stored
128      * in a new place (fileRow), so any stored log entries that refer to
129      * the old row need to be translated to use the new row.
130      *
131      * @param logRow the "old" row
132      * @param fileRow the "new" row
133      */

134     public void putRowMap(long logRow, long fileRow);
135
136     /**
137      * Discard a row mapping
138      */

139     public void removeRowMap(long row);
140
141     /**
142      * Are you logging?
143      */

144     public boolean isLogging();
145
146     /**
147      * Save a "before" image
148      */

149     public void saveBlock(long b) throws IOException JavaDoc;
150
151     /**
152      * Restore all the "before" images
153      */

154     public void restoreBlocks() throws IOException JavaDoc;
155
156     /**
157      * Reset the "before" list to be empty
158      */

159     public void resetBlocks() throws IOException JavaDoc;
160
161     /**
162      * Remove the log
163      */

164     public void remove() throws IOException JavaDoc;
165
166     /**
167      * Are we currently performing restart log recovery?
168      */

169     public boolean inRecovery() throws IOException JavaDoc;
170 }
171
Popular Tags