Berkeley DB
version 4.7.25

com.sleepycat.db
Class LogCursor

java.lang.Object
  extended by com.sleepycat.db.LogCursor

public class LogCursor
extends Object

The LogCursor object is the handle for a cursor into the log files, supporting sequential access to the records stored in log files.

The handle is not free-threaded. Once the LogCursor.close method is called, the handle may not be accessed again, regardless of that method's success or failure.


Method Summary
 void close()
           
 OperationStatus getCurrent(LogSequenceNumber lsn, DatabaseEntry data)
          Return the LogSequenceNumber and log record to which the log cursor currently refers.
 OperationStatus getFirst(LogSequenceNumber lsn, DatabaseEntry data)
          Return the first LogSequenceNumber and log record.
 OperationStatus getLast(LogSequenceNumber lsn, DatabaseEntry data)
          Return the last LogSequenceNumber and log record.
 OperationStatus getNext(LogSequenceNumber lsn, DatabaseEntry data)
          Return the next LogSequenceNumber and log record.
 OperationStatus getPrev(LogSequenceNumber lsn, DatabaseEntry data)
          Return the previous LogSequenceNumber and log record.
 OperationStatus set(LogSequenceNumber lsn, DatabaseEntry data)
          Return a specific log record.
 int version()
          Get the log file version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

close

public void close()
           throws DatabaseException
Throws:
DatabaseException

getCurrent

public OperationStatus getCurrent(LogSequenceNumber lsn,
                                  DatabaseEntry data)
                           throws DatabaseException
Return the LogSequenceNumber and log record to which the log cursor currently refers.

Parameters:
lsn - The returned LogSequenceNumber.

data - The returned log record. The data field is set to the record retrieved, and the size field indicates the number of bytes in the record.

Returns:
The status of the operation.

Throws:
DatabaseException - if a failure occurs.

getNext

public OperationStatus getNext(LogSequenceNumber lsn,
                               DatabaseEntry data)
                        throws DatabaseException
Return the next LogSequenceNumber and log record.

The current log position is advanced to the next record in the log, and its LogSequenceNumber and data are returned. If the cursor has not been initialized, the first available log record in the log will be returned.

Parameters:
lsn - The returned LogSequenceNumber.

data - The returned log record.

Returns:
The status of the operation; a return of NOTFOUND indicates the last log record has already been returned or the log is empty.

Throws:
DatabaseException - if a failure occurs.

getFirst

public OperationStatus getFirst(LogSequenceNumber lsn,
                                DatabaseEntry data)
                         throws DatabaseException
Return the first LogSequenceNumber and log record.

The current log position is set to the first record in the log, and its LogSequenceNumber and data are returned.

Parameters:
lsn - The returned LogSequenceNumber.

data - The returned log record.

Returns:
The status of the operation; a return of NOTFOUND indicates the log is empty.

Throws:
DatabaseException - if a failure occurs.

getLast

public OperationStatus getLast(LogSequenceNumber lsn,
                               DatabaseEntry data)
                        throws DatabaseException
Return the last LogSequenceNumber and log record.

The current log position is set to the last record in the log, and its LogSequenceNumber and data are returned.

Parameters:
lsn - The returned LogSequenceNumber.

data - The returned log record.

Returns:
The status of the operation; a return of NOTFOUND indicates the log is empty.

Throws:
DatabaseException - if a failure occurs.

getPrev

public OperationStatus getPrev(LogSequenceNumber lsn,
                               DatabaseEntry data)
                        throws DatabaseException
Return the previous LogSequenceNumber and log record.

The current log position is advanced to the previous record in the log, and its LogSequenceNumber and data are returned. If the cursor has not been initialized, the last available log record in the log will be returned.

Parameters:
lsn - The returned LogSequenceNumber.

data - The returned log record.

Returns:
The status of the operation; a return of NOTFOUND indicates the first log record has already been returned or the log is empty.

Throws:
DatabaseException - if a failure occurs.

set

public OperationStatus set(LogSequenceNumber lsn,
                           DatabaseEntry data)
                    throws DatabaseException
Return a specific log record.

The current log position is set to the specified record in the log, and its data is returned.

Parameters:
lsn - The specified LogSequenceNumber.

data - The returned log record.

Returns:
The status of the operation.

Throws:
DatabaseException - if a failure occurs.

version

public int version()
            throws DatabaseException
Get the log file version.

Returns:
The log file version.

Throws:
DatabaseException - if a failure occurs.

Berkeley DB
version 4.7.25

Copyright (c) 1996,2008 Oracle. All rights reserved.