|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.store.Directory
org.apache.lucene.store.db.DbDirectory
public class DbDirectory
A DbDirectory is a Berkeley DB 4.3 based implementation of
Directory
. It uses two
Db
database handles, one for storing file
records and another for storing file data blocks.
Field Summary | |
---|---|
protected com.sleepycat.db.internal.Db |
blocks
|
protected com.sleepycat.db.internal.Db |
files
|
protected int |
flags
|
protected Set<DbIndexOutput> |
openFiles
|
protected com.sleepycat.db.internal.DbTxn |
txn
|
Fields inherited from class org.apache.lucene.store.Directory |
---|
isOpen, lockFactory |
Constructor Summary | |
---|---|
DbDirectory(com.sleepycat.db.internal.DbTxn txn,
com.sleepycat.db.internal.Db files,
com.sleepycat.db.internal.Db blocks,
int flags)
Instantiate a DbDirectory. |
|
DbDirectory(com.sleepycat.db.Transaction txn,
com.sleepycat.db.Database files,
com.sleepycat.db.Database blocks)
|
|
DbDirectory(com.sleepycat.db.Transaction txn,
com.sleepycat.db.Database files,
com.sleepycat.db.Database blocks,
int flags)
|
Method Summary | |
---|---|
void |
close()
Closes the store. |
IndexOutput |
createOutput(String name)
Creates a new, empty file in the directory with the given name. |
void |
deleteFile(String name)
Removes an existing file in the directory. |
boolean |
fileExists(String name)
Returns true iff a file with the given name exists. |
long |
fileLength(String name)
Returns the length of a file in the directory. |
long |
fileModified(String name)
Returns the time the named file was last modified. |
void |
flush()
Flush the currently open files. |
String[] |
listAll()
Returns an array of strings, one for each file in the directory. |
Lock |
makeLock(String name)
Construct a Lock . |
IndexInput |
openInput(String name)
Returns a stream reading an existing file. |
void |
setTransaction(com.sleepycat.db.internal.DbTxn txn)
Once a transaction handle was committed it is no longer valid. |
void |
setTransaction(com.sleepycat.db.Transaction txn)
Once a transaction handle was committed it is no longer valid. |
void |
touchFile(String name)
Set the modified time of an existing file to now. |
Methods inherited from class org.apache.lucene.store.Directory |
---|
clearLock, copy, copy, ensureOpen, getLockFactory, getLockID, openInput, setLockFactory, sync, sync, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Set<DbIndexOutput> openFiles
protected com.sleepycat.db.internal.Db files
protected com.sleepycat.db.internal.Db blocks
protected com.sleepycat.db.internal.DbTxn txn
protected int flags
Constructor Detail |
---|
public DbDirectory(com.sleepycat.db.internal.DbTxn txn, com.sleepycat.db.internal.Db files, com.sleepycat.db.internal.Db blocks, int flags)
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.public DbDirectory(com.sleepycat.db.Transaction txn, com.sleepycat.db.Database files, com.sleepycat.db.Database blocks, int flags)
public DbDirectory(com.sleepycat.db.Transaction txn, com.sleepycat.db.Database files, com.sleepycat.db.Database blocks)
Method Detail |
---|
public void close() throws IOException
Directory
close
in interface Closeable
close
in class Directory
IOException
public void flush() throws IOException
IOException
setTransaction(com.sleepycat.db.Transaction)
public IndexOutput createOutput(String name) throws IOException
Directory
createOutput
in class Directory
IOException
public void deleteFile(String name) throws IOException
Directory
deleteFile
in class Directory
IOException
public boolean fileExists(String name) throws IOException
Directory
fileExists
in class Directory
IOException
public long fileLength(String name) throws IOException
Directory
FileNotFoundException
if the file does not exist
fileLength
in class Directory
name
- the name of the file for which to return the length.
FileNotFoundException
- if the file does not exist.
IOException
- if there was an IO error while retrieving the file's
length.public long fileModified(String name) throws IOException
Directory
fileModified
in class Directory
IOException
public String[] listAll() throws IOException
Directory
listAll
in class Directory
NoSuchDirectoryException
- if the directory is not prepared for any
write operations (such as Directory.createOutput(String)
).
IOException
- in case of other IO errorspublic IndexInput openInput(String name) throws IOException
Directory
openInput
in class Directory
IOException
public Lock makeLock(String name)
Directory
Lock
.
makeLock
in class Directory
name
- the name of the lock filepublic void touchFile(String name) throws IOException
Directory
touchFile
in class Directory
IOException
public void setTransaction(com.sleepycat.db.Transaction txn)
txn
- the new transaction handle to usepublic void setTransaction(com.sleepycat.db.internal.DbTxn txn)
txn
- the new transaction handle to use
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |