Adding JMCR-Stable version
[Benchmarks_CSolver.git] / JMCR-Stable / real-world application / derby-10.3.2.1 / java / engine / org / apache / derby / impl / store / raw / log / StreamLogScan.java
diff --git a/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/store/raw/log/StreamLogScan.java b/JMCR-Stable/real-world application/derby-10.3.2.1/java/engine/org/apache/derby/impl/store/raw/log/StreamLogScan.java
new file mode 100644 (file)
index 0000000..ac8c293
--- /dev/null
@@ -0,0 +1,121 @@
+/*\r
+\r
+   Derby - Class org.apache.derby.impl.store.raw.log.StreamLogScan\r
+\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to you under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.store.raw.log;\r
+\r
+import org.apache.derby.iapi.store.raw.log.LogInstant;\r
+import org.apache.derby.iapi.store.raw.log.LogScan;\r
+import org.apache.derby.iapi.store.raw.xact.TransactionId;\r
+import org.apache.derby.iapi.error.StandardException;\r
+\r
+import org.apache.derby.iapi.services.io.ArrayInputStream;\r
+\r
+import java.io.InputStream;\r
+import java.io.IOException;\r
+\r
+/**\r
+       LogScan provides methods to read a log record and get its LogInstant\r
+       in an already defined scan.  A logscan also needs to know how to advance to\r
+       the next log record.\r
+*/\r
+\r
+public interface StreamLogScan extends LogScan {\r
+\r
+       /**\r
+               Get the next record in the scan and place its data in the passed in\r
+               array.  The scan is advanced to the next log record.\r
+           If the input array is of insufficient size, getNextRecord must expand\r
+               the array to accomodate the log record.  User can optionally pass in a\r
+               transaction Id and a group mask.  If provided, only log record that\r
+               matches the transaction Id and the group mask is returned.\r
+\r
+               @param input        the ArrayInputStream to put the log record\r
+               @param tranId       if non-null, only log record that equals tranId \r
+                            will be returned.  If null, log records are not \r
+                            filtered on transaction Id. \r
+               @param groupmask    if non-zero, only log record whose Loggable's group\r
+                            value is included in the groupmask is returned.  \r
+                            groupmask can be a bit wise OR of many Loggable \r
+                            groups.  If zero, log records are not filtered on \r
+                            the Loggable's group.\r
+\r
+               @return an object that represents the log record, return null if the\r
+               scan has completed. \r
+\r
+               @exception StandardException Standard Clooudscape error policy\r
+               @exception IOException       Some I/O exception raised during reading \r
+                                     the log record.\r
+       */\r
+       public LogRecord getNextRecord(ArrayInputStream input, \r
+                                                                  TransactionId tranId, \r
+                                                                  int groupmask) \r
+                throws StandardException, IOException;\r
+\r
+\r
+       /**\r
+               Get the instant of the record just retrieved with getNextRecord(). \r
+               @return INVALID_LOG_INSTANT if no records have been returned yet or\r
+               the scan has completed.\r
+       */\r
+       public long getInstant();\r
+\r
+       /**\r
+               Get the log instant that is right after the record just retrieved with\r
+               getNextRecord().  Only valid for a forward scan and on a successful\r
+               retrieval.\r
+\r
+               @return INVALID_LOG_INSTANT if this is not a FORWARD scan or, no\r
+               record have been returned yet or the scan has completed.\r
+       */\r
+       public long getLogRecordEnd();\r
+       \r
+       /**\r
+          @return true if  fuzzy log end found during forward scan, this happens\r
+          if there was a partially written log records before the crash.\r
+       */\r
+       public boolean isLogEndFuzzy();\r
+\r
+       /**\r
+           Get the LogInstant for the record just retrieved with getNextRecord().\r
+               @return null if no records have been returned yet or the scan has\r
+               completed.\r
+               */\r
+       public LogInstant getLogInstant();\r
+\r
+       /**\r
+               Reset the scan to the given LogInstant so that getNextRecord get the\r
+               log record AFTER the given LogInstant.\r
+\r
+               @param instant the log instant to reset to\r
+\r
+               @exception IOException       Some I/O exception raised when accessing \r
+                                     the log file\r
+               @exception StandardException reset to illegal position or beyond the\r
+                                            limit of the scan.\r
+       */\r
+       public void resetPosition(LogInstant instant) \r
+                throws IOException, StandardException;\r
+\r
+       /**\r
+               Close this log scan.\r
+       */\r
+       public void close();\r
+}\r