com.faunos.skwish.sys.mgr
Class MutableBaseIdIndex
java.lang.Object
com.faunos.skwish.sys.Index
com.faunos.skwish.sys.mgr.MutableBaseIdIndex
- All Implemented Interfaces:
- Closeable
public class MutableBaseIdIndex
- extends Index
An index whose base ID can be adjusted.
- Author:
- Babak Farhang
- See Also:
setBaseId(long)
Methods inherited from class com.faunos.skwish.sys.Index |
close, commit, delete, delete, flush, getContentsSize, getEntryCount, getIndexSize, getLastOffset, getNextId, isAutoCommit, killNext, killNext, pushNext, readOffsets, readOffsets, readOffsets, setAutoCommit |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
mutableMetrics
protected IndexMetrics mutableMetrics
MutableBaseIdIndex
public MutableBaseIdIndex(FileChannel indexFile)
throws IOException
- Throws:
IOException
MutableBaseIdIndex
public MutableBaseIdIndex(FileChannel indexFile,
boolean recover)
throws IOException
- Throws:
IOException
MutableBaseIdIndex
protected MutableBaseIdIndex(FileChannel indexFile,
Word offsetWidth,
long baseId,
long baseOffset)
throws IOException
- Writes a new index to the specified file. This method was made protected in
order to prevent the user from accidentally overwriting an existing index.
- Throws:
IOException
- See Also:
writeNewIndex(FileChannel, Word, long, long)
writeNewIndex
public static MutableBaseIdIndex writeNewIndex(FileChannel indexFile,
Word offsetWidth,
long baseId,
long baseOffset)
throws IOException
- Writes a new index to the specified file.
- Returns:
- the newly created index instance
- Throws:
IOException
setBaseId
public void setBaseId(long baseId)
throws IOException
- Sets the base ID of the index by writing it to the backing file.
After this method returns,
getMetrics()
returns
a new IndexMetrics
instance reflecting the new
base Id.
- Throws:
IOException
getMetrics
public IndexMetrics getMetrics()
- Description copied from class:
Index
- Returns the metrics of the index.
- Overrides:
getMetrics
in class Index