org.apache.lucene.index
Class FSTransLog

java.lang.Object
  extended by org.apache.lucene.index.FSTransLog
All Implemented Interfaces:
TransLog, CompassConfigurable

public class FSTransLog
extends Object
implements TransLog

A transaction log that saves most of the transactional data log into disk.

Can be provided with a transaction log path (using LuceneEnvironment.Transaction.TransLog.PATH setting), where different directories will be created in (in the form of PATH/compass/translog/[tran id]). All the trans data is stored into a single file called transdata.

Two parameters can be set on this transaction log as well, the first is read buffer size, which controls the size of the buffer for read operations. This can affect the memory consumption of this transaction log, and defaults to 64 (bytes). The write buffer is the memory buffer used to write data into the file system, and defaults to 2048 (bytes). It is pooled so does not affect memory consumption that much.

Author:
kimchy

Nested Class Summary
(package private)  class FSTransLog.TransDirectory
          Transactional log directory implementation, writes all the data into memory until FSTransLog.TransDirectory.flush() is called (it is called in the onDocumentAdded() callback).
 
Constructor Summary
FSTransLog()
           
 
Method Summary
 void close()
          Closes the transaction log.
 void configure(CompassSettings settings)
          Configure using the given settings.
 Directory getDirectory()
          Returns the Lucene directory the transaction log will be written to
 void onDocumentAdded()
          A callback notifiying the trasaction log that a document was added (can be used for flushing for example).
 boolean shouldUpdateTransSegments()
          Returns true if the transaction segments should be written for each change made to it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSTransLog

public FSTransLog()
Method Detail

configure

public void configure(CompassSettings settings)
               throws CompassException
Description copied from interface: CompassConfigurable
Configure using the given settings.

Specified by:
configure in interface CompassConfigurable
Parameters:
settings - The settings for the configured object
Throws:
CompassException

getDirectory

public Directory getDirectory()
Description copied from interface: TransLog
Returns the Lucene directory the transaction log will be written to

Specified by:
getDirectory in interface TransLog

shouldUpdateTransSegments

public boolean shouldUpdateTransSegments()
Description copied from interface: TransLog
Returns true if the transaction segments should be written for each change made to it.

Specified by:
shouldUpdateTransSegments in interface TransLog

close

public void close()
           throws IOException
Description copied from interface: TransLog
Closes the transaction log.

Specified by:
close in interface TransLog
Throws:
IOException

onDocumentAdded

public void onDocumentAdded()
                     throws IOException
Description copied from interface: TransLog
A callback notifiying the trasaction log that a document was added (can be used for flushing for example).

Specified by:
onDocumentAdded in interface TransLog
Throws:
IOException


Copyright (c) 2004-2006 The Compass Project.