com.sleepycat.je.log
Class LogBufferPool

java.lang.Object
  extended by com.sleepycat.je.log.LogBufferPool

 class LogBufferPool
extends Object

LogBufferPool keeps a set of log buffers.


Constructor Summary
LogBufferPool(FileManager fileManager, EnvironmentImpl envImpl)
           
 
Method Summary
(package private)  LogBuffer getReadBuffer(long lsn)
          Find a buffer that holds this LSN.
(package private)  ByteBuffer getWriteBuffer(int sizeNeeded, boolean flippedFile)
          Get a log buffer for writing sizeNeeded bytes.
(package private)  void loadStats(StatsConfig config, EnvironmentStats stats)
           
(package private)  void reset(DbConfigManager configManager)
          Initialize the pool at construction time and when the cache is resized.
(package private)  void writeBufferToFile(int sizeNeeded)
          Write the contents of the currentWriteBuffer to disk.
(package private)  void writeCompleted(long lsn, boolean flushRequired)
          A loggable object has been freshly marshalled into the write log buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogBufferPool

LogBufferPool(FileManager fileManager,
              EnvironmentImpl envImpl)
        throws DatabaseException
Throws:
DatabaseException
Method Detail

reset

void reset(DbConfigManager configManager)
     throws DatabaseException
Initialize the pool at construction time and when the cache is resized. This method is called after the memory budget has been calculated.

Throws:
DatabaseException

getWriteBuffer

ByteBuffer getWriteBuffer(int sizeNeeded,
                          boolean flippedFile)
                    throws IOException,
                           DatabaseException
Get a log buffer for writing sizeNeeded bytes. If currentWriteBuffer is too small or too full, flush currentWriteBuffer and get a new one. Called within the log write latch.

Returns:
a buffer that can hold sizeNeeded bytes.
Throws:
IOException
DatabaseException

writeBufferToFile

void writeBufferToFile(int sizeNeeded)
                 throws IOException,
                        DatabaseException
Write the contents of the currentWriteBuffer to disk. Leave this buffer in memory to be available to would be readers. Set up a new currentWriteBuffer. Assumes the log write latch is held.

Parameters:
sizeNeeded - is the size of the next object we need to write to the log. May be 0 if this is called on behalf of LogManager.flush().
Throws:
IOException
DatabaseException

writeCompleted

void writeCompleted(long lsn,
                    boolean flushRequired)
              throws DatabaseException,
                     IOException
A loggable object has been freshly marshalled into the write log buffer. 1. Update buffer so it knows what LSNs it contains. 2. If this object requires a flush, write this buffer out to the backing file. Assumes log write latch is held.

Throws:
DatabaseException
IOException

getReadBuffer

LogBuffer getReadBuffer(long lsn)
                  throws DatabaseException
Find a buffer that holds this LSN.

Returns:
the buffer that contains this LSN, latched and ready to read, or return null.
Throws:
DatabaseException

loadStats

void loadStats(StatsConfig config,
               EnvironmentStats stats)
         throws DatabaseException
Throws:
DatabaseException


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