001: package com.quadcap.sql.file;
002:
003: /* Copyright 1999 - 2003 Quadcap Software. All rights reserved.
004: *
005: * This software is distributed under the Quadcap Free Software License.
006: * This software may be used or modified for any purpose, personal or
007: * commercial. Open Source redistributions are permitted. Commercial
008: * redistribution of larger works derived from, or works which bundle
009: * this software requires a "Commercial Redistribution License"; see
010: * http://www.quadcap.com/purchase.
011: *
012: * Redistributions qualify as "Open Source" under one of the following terms:
013: *
014: * Redistributions are made at no charge beyond the reasonable cost of
015: * materials and delivery.
016: *
017: * Redistributions are accompanied by a copy of the Source Code or by an
018: * irrevocable offer to provide a copy of the Source Code for up to three
019: * years at the cost of materials and delivery. Such redistributions
020: * must allow further use, modification, and redistribution of the Source
021: * Code under substantially the same terms as this license.
022: *
023: * Redistributions of source code must retain the copyright notices as they
024: * appear in each source code file, these license terms, and the
025: * disclaimer/limitation of liability set forth as paragraph 6 below.
026: *
027: * Redistributions in binary form must reproduce this Copyright Notice,
028: * these license terms, and the disclaimer/limitation of liability set
029: * forth as paragraph 6 below, in the documentation and/or other materials
030: * provided with the distribution.
031: *
032: * The Software is provided on an "AS IS" basis. No warranty is
033: * provided that the Software is free of defects, or fit for a
034: * particular purpose.
035: *
036: * Limitation of Liability. Quadcap Software shall not be liable
037: * for any damages suffered by the Licensee or any third party resulting
038: * from use of the Software.
039: */
040:
041: import java.io.IOException;
042:
043: import java.util.Properties;
044:
045: import com.quadcap.util.collections.LongMap;
046:
047: /**
048: *
049: *
050: * @author Stan Bailes
051: */
052: public interface Logger {
053: /**
054: * Initialization
055: */
056: void init(Log log, boolean create, Properties props)
057: throws IOException;
058:
059: /**
060: * Make it so.
061: */
062: void sync() throws IOException;
063:
064: /**
065: * Checkpoint.
066: */
067: void checkpoint() throws IOException;
068:
069: /**
070: * Dismissed.
071: */
072: void close() throws IOException;
073:
074: /**
075: * Reset the entire log to be empty
076: */
077: void reset() throws IOException;
078:
079: /**
080: * Return the id of the oldest active transaction
081: */
082: long getOldestTransaction();
083:
084: /**
085: * Return the number of active transactions
086: */
087: int getActiveTransactionCount();
088:
089: /**
090: * Return a map containing the active transaction ids as keys
091: */
092: LongMap getActiveTransactions();
093:
094: /**
095: * Write a single op to the buffer.
096: */
097: void put(LogEntry op) throws IOException;
098:
099: /**
100: * Set the 'redo' value for the most recently read LogEntry
101: */
102: void setRedoState(LogEntry op, int state) throws IOException;
103:
104: /**
105: * Return the last op in the log for the specified transaction
106: */
107: LogEntry getLastOp(long t) throws IOException;
108:
109: /**
110: * Return the preceding op (of the same transaction)
111: */
112: LogEntry getPrevOp(LogEntry op) throws IOException;
113:
114: /**
115: * Return the first op in the log
116: */
117: LogEntry getFirstOp() throws IOException;
118:
119: /**
120: * Return the next op
121: */
122: LogEntry getNextOp() throws IOException;
123:
124: /**
125: * Return the position of the last checkpoint
126: */
127: int getCheckpoint();
128:
129: /**
130: * Return the end position of the log buffer
131: */
132: int getEnd();
133: }
|