com.sleepycat.je.log
Class LogBuffer

java.lang.Object
  extended by com.sleepycat.je.log.LogBuffer
All Implemented Interfaces:
LogSource

 class LogBuffer
extends Object
implements LogSource

DbLogBuffers hold outgoing, newly written log entries.


Constructor Summary
LogBuffer(ByteBuffer buffer, long firstLsn)
           
LogBuffer(int capacity, EnvironmentImpl env)
           
 
Method Summary
(package private)  boolean containsLsn(long lsn)
          Support for reading a log entry out of a still-in-memory log
 ByteBuffer getBytes(long fileOffset)
          Fill the destination byte array with bytes.
 ByteBuffer getBytes(long fileOffset, int numBytes)
          Fill the destination byte array with the requested number of bytes.
(package private)  int getCapacity()
           
(package private)  ByteBuffer getDataBuffer()
           
(package private)  long getFirstLsn()
          Return first LSN held in this buffer.
(package private)  boolean getRewriteAllowed()
           
(package private)  boolean hasRoom(int numBytes)
          Check capacity of buffer.
(package private)  void registerLsn(long lsn)
          This LSN has been written to the log.
(package private)  void reinit()
           
 void release()
          We're done with this log source.
(package private)  void setRewriteAllowed()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogBuffer

LogBuffer(int capacity,
          EnvironmentImpl env)
    throws DatabaseException
Throws:
DatabaseException

LogBuffer

LogBuffer(ByteBuffer buffer,
          long firstLsn)
    throws DatabaseException
Throws:
DatabaseException
Method Detail

reinit

void reinit()
      throws DatabaseException
Throws:
DatabaseException

getFirstLsn

long getFirstLsn()
Return first LSN held in this buffer. Assumes the log write latch is held.


registerLsn

void registerLsn(long lsn)
           throws DatabaseException
This LSN has been written to the log.

Throws:
DatabaseException

hasRoom

boolean hasRoom(int numBytes)
Check capacity of buffer. Assumes that the log write latch is held.

Returns:
true if this buffer can hold this many more bytes.

getDataBuffer

ByteBuffer getDataBuffer()
Returns:
the actual data buffer.

getCapacity

int getCapacity()
Returns:
capacity in bytes

containsLsn

boolean containsLsn(long lsn)
              throws DatabaseException
Support for reading a log entry out of a still-in-memory log

Returns:
true if this buffer holds the entry at this LSN. The buffer will be latched for read. Returns false if LSN is not here, and releases the read latch.
Throws:
DatabaseException

release

public void release()
             throws DatabaseException
Description copied from interface: LogSource
We're done with this log source.

Specified by:
release in interface LogSource
Throws:
DatabaseException
See Also:
LogSource.release()

getRewriteAllowed

boolean getRewriteAllowed()

setRewriteAllowed

void setRewriteAllowed()

getBytes

public ByteBuffer getBytes(long fileOffset)
Description copied from interface: LogSource
Fill the destination byte array with bytes. The offset indicates the absolute log file position.

Specified by:
getBytes in interface LogSource
See Also:
LogSource.getBytes(long)

getBytes

public ByteBuffer getBytes(long fileOffset,
                           int numBytes)
Description copied from interface: LogSource
Fill the destination byte array with the requested number of bytes. The offset indicates the absolute position in the log file.

Specified by:
getBytes in interface LogSource
See Also:
LogSource.getBytes(long)


Copyright 2004-2005 Sleepycat, Inc. All Rights Reserved.