Main Page | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Related Pages

LogCursor.java

00001 /*-
00002  * See the file LICENSE for redistribution information.
00003  *
00004  * Copyright (c) 2001-2005
00005  *      Sleepycat Software.  All rights reserved.
00006  *
00007  * $Id: LogCursor.java,v 12.1 2005/06/16 20:23:02 bostic Exp $
00008  */
00009 
00010 package com.sleepycat.db;
00011 
00012 import com.sleepycat.db.internal.DbConstants;
00013 import com.sleepycat.db.internal.DbLogc;
00014 
00015 public class LogCursor {
00016     protected DbLogc logc;
00017 
00018     protected LogCursor(final DbLogc logc) {
00019         this.logc = logc;
00020     }
00021 
00022     /* package */
00023     static LogCursor wrap(DbLogc logc) {
00024         return (logc == null) ? null : new LogCursor(logc);
00025     }
00026 
00027     public synchronized void close()
00028         throws DatabaseException {
00029 
00030         logc.close(0);
00031     }
00032 
00033     public OperationStatus getCurrent(final LogSequenceNumber lsn,
00034                                       final DatabaseEntry data)
00035         throws DatabaseException {
00036 
00037         return OperationStatus.fromInt(
00038             logc.get(lsn, data, DbConstants.DB_CURRENT));
00039     }
00040 
00041     public OperationStatus getNext(final LogSequenceNumber lsn,
00042                                    final DatabaseEntry data)
00043         throws DatabaseException {
00044 
00045         return OperationStatus.fromInt(
00046             logc.get(lsn, data, DbConstants.DB_NEXT));
00047     }
00048 
00049     public OperationStatus getFirst(final LogSequenceNumber lsn,
00050                                     final DatabaseEntry data)
00051         throws DatabaseException {
00052 
00053         return OperationStatus.fromInt(
00054             logc.get(lsn, data, DbConstants.DB_FIRST));
00055     }
00056 
00057     public OperationStatus getLast(final LogSequenceNumber lsn,
00058                                    final DatabaseEntry data)
00059         throws DatabaseException {
00060 
00061         return OperationStatus.fromInt(
00062             logc.get(lsn, data, DbConstants.DB_LAST));
00063     }
00064 
00065     public OperationStatus getPrev(final LogSequenceNumber lsn,
00066                                    final DatabaseEntry data)
00067         throws DatabaseException {
00068 
00069         return OperationStatus.fromInt(
00070             logc.get(lsn, data, DbConstants.DB_PREV));
00071     }
00072 
00073     public OperationStatus set(final LogSequenceNumber lsn,
00074                                final DatabaseEntry data)
00075         throws DatabaseException {
00076 
00077         return OperationStatus.fromInt(
00078             logc.get(lsn, data, DbConstants.DB_SET));
00079     }
00080 }

Generated on Sun Dec 25 12:14:33 2005 for Berkeley DB 4.4.16 by  doxygen 1.4.2