org.apache.lucene.store.db

Class DbDirectory

public class DbDirectory extends Directory

A DbDirectory is a Berkeley DB 4.3 based implementation of Directory. It uses two com.sleepycat.db.internal.Db Db database handles, one for storing file records and another for storing file data blocks.

Author: Andi Vajda

Field Summary
protected Dbblocks
protected Dbfiles
protected intflags
protected SetopenFiles
protected DbTxntxn
Constructor Summary
DbDirectory(DbTxn txn, Db files, Db blocks, int flags)
Instantiate a DbDirectory.
DbDirectory(Transaction txn, Database files, Database blocks, int flags)
DbDirectory(Transaction txn, Database files, Database blocks)
Method Summary
voidclose()
IndexOutputcreateOutput(String name)
voiddeleteFile(String name)
booleanfileExists(String name)
longfileLength(String name)
longfileModified(String name)
voidflush()
Flush the currently open files.
String[]list()
LockmakeLock(String name)
IndexInputopenInput(String name)
voidrenameFile(String from, String to)
voidsetTransaction(Transaction txn)
Once a transaction handle was committed it is no longer valid.
voidsetTransaction(DbTxn txn)
Once a transaction handle was committed it is no longer valid.
voidtouchFile(String name)

Field Detail

blocks

protected Db blocks

files

protected Db files

flags

protected int flags

openFiles

protected Set openFiles

txn

protected DbTxn txn

Constructor Detail

DbDirectory

public DbDirectory(DbTxn txn, Db files, Db blocks, int flags)
Instantiate a DbDirectory. The same threading rules that apply to Berkeley DB handles apply to instances of DbDirectory.

Parameters: txn a transaction handle that is going to be used for all db operations done by this instance. This parameter may be null. files a db handle to store file records. blocks a db handle to store file data blocks. flags flags used for db read operations.

DbDirectory

public DbDirectory(Transaction txn, Database files, Database blocks, int flags)

DbDirectory

public DbDirectory(Transaction txn, Database files, Database blocks)

Method Detail

close

public void close()

createOutput

public IndexOutput createOutput(String name)

deleteFile

public void deleteFile(String name)

fileExists

public boolean fileExists(String name)

fileLength

public long fileLength(String name)

fileModified

public long fileModified(String name)

flush

public void flush()
Flush the currently open files. After they have been flushed it is safe to commit the transaction without closing this DbDirectory instance first.

See Also: DbDirectory

list

public String[] list()

makeLock

public Lock makeLock(String name)

openInput

public IndexInput openInput(String name)

renameFile

public void renameFile(String from, String to)

setTransaction

public void setTransaction(Transaction txn)
Once a transaction handle was committed it is no longer valid. In order to continue using this DbDirectory instance after a commit, the transaction handle has to be replaced.

Parameters: txn the new transaction handle to use

setTransaction

public void setTransaction(DbTxn txn)
Once a transaction handle was committed it is no longer valid. In order to continue using this DbDirectory instance after a commit, the transaction handle has to be replaced.

Parameters: txn the new transaction handle to use

touchFile

public void touchFile(String name)
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.