public abstract class PersistentEnumeratorBase<Data> extends java.lang.Object implements DataEnumeratorEx<Data>, Forceable, java.io.Closeable
Modifier and Type | Class and Description |
---|---|
static class |
PersistentEnumeratorBase.CorruptedException |
static interface |
PersistentEnumeratorBase.DataFilter |
static class |
PersistentEnumeratorBase.RecordsProcessor |
static class |
PersistentEnumeratorBase.Version |
static class |
PersistentEnumeratorBase.VersionUpdatedException |
Modifier and Type | Field and Description |
---|---|
protected static Logger |
LOG |
protected java.nio.file.Path |
myFile |
protected ResizeableMappedFile |
myStorage |
protected static int |
NULL_ID |
Constructor and Description |
---|
PersistentEnumeratorBase(java.nio.file.Path file,
ResizeableMappedFile storage,
KeyDescriptor<Data> dataDescriptor,
int initialSize,
PersistentEnumeratorBase.Version version,
com.intellij.util.io.PersistentEnumeratorBase.RecordBufferHandler<? extends PersistentEnumeratorBase> recordBufferHandler,
boolean doCaching) |
Modifier and Type | Method and Description |
---|---|
static void |
clearCacheForTests() |
void |
close() |
protected void |
doClose() |
protected void |
doFlush() |
protected int |
doWriteData(Data value) |
int |
enumerate(Data value) |
protected abstract int |
enumerateImpl(Data value,
boolean onlyCheckForExisting,
boolean saveNewValue) |
void |
force() |
java.util.Collection<Data> |
getAllDataObjects(PersistentEnumeratorBase.DataFilter filter) |
int |
getLargestId() |
protected long |
getMetaData() |
Data |
getValue(int keyId,
int processingKey) |
protected abstract int |
indexToAddr(int idx) |
boolean |
isClosed() |
boolean |
isCorrupted() |
boolean |
isDirty() |
protected boolean |
isKeyAtIndex(Data value,
int idx) |
boolean |
iterateData(Processor<? super Data> processor) |
protected void |
markCorrupted() |
protected void |
markDirty(boolean dirty) |
boolean |
processAllDataObject(Processor<? super Data> processor,
PersistentEnumeratorBase.DataFilter filter) |
protected void |
putMetaData(long data) |
void |
setRecordHandler(com.intellij.util.io.PersistentEnumeratorBase.RecordBufferHandler<PersistentEnumeratorBase> recordHandler) |
protected abstract void |
setupEmptyFile() |
protected int |
setupValueId(int hashCode,
int dataOff) |
abstract boolean |
traverseAllRecords(PersistentEnumeratorBase.RecordsProcessor p) |
int |
tryEnumerate(Data value) |
Data |
valueOf(int idx) |
protected int |
writeData(Data value,
int hashCode) |
protected static final Logger LOG
protected static final int NULL_ID
protected final ResizeableMappedFile myStorage
protected final java.nio.file.Path myFile
public PersistentEnumeratorBase(java.nio.file.Path file, ResizeableMappedFile storage, KeyDescriptor<Data> dataDescriptor, int initialSize, PersistentEnumeratorBase.Version version, com.intellij.util.io.PersistentEnumeratorBase.RecordBufferHandler<? extends PersistentEnumeratorBase> recordBufferHandler, boolean doCaching) throws java.io.IOException
java.io.IOException
public static void clearCacheForTests()
protected abstract void setupEmptyFile() throws java.io.IOException
java.io.IOException
public void setRecordHandler(com.intellij.util.io.PersistentEnumeratorBase.RecordBufferHandler<PersistentEnumeratorBase> recordHandler)
public Data getValue(int keyId, int processingKey) throws java.io.IOException
java.io.IOException
public int tryEnumerate(Data value) throws java.io.IOException
tryEnumerate
in interface DataEnumeratorEx<Data>
java.io.IOException
public int enumerate(Data value) throws java.io.IOException
enumerate
in interface DataEnumerator<Data>
java.io.IOException
protected void putMetaData(long data)
protected long getMetaData()
public boolean processAllDataObject(Processor<? super Data> processor, PersistentEnumeratorBase.DataFilter filter) throws java.io.IOException
java.io.IOException
public java.util.Collection<Data> getAllDataObjects(PersistentEnumeratorBase.DataFilter filter) throws java.io.IOException
java.io.IOException
public abstract boolean traverseAllRecords(PersistentEnumeratorBase.RecordsProcessor p) throws java.io.IOException
java.io.IOException
protected abstract int enumerateImpl(Data value, boolean onlyCheckForExisting, boolean saveNewValue) throws java.io.IOException
java.io.IOException
protected boolean isKeyAtIndex(Data value, int idx) throws java.io.IOException
java.io.IOException
protected int writeData(Data value, int hashCode)
public int getLargestId()
protected int doWriteData(Data value) throws java.io.IOException
java.io.IOException
protected int setupValueId(int hashCode, int dataOff)
public boolean iterateData(Processor<? super Data> processor) throws java.io.IOException
java.io.IOException
public Data valueOf(int idx) throws java.io.IOException
valueOf
in interface DataEnumerator<Data>
java.io.IOException
protected abstract int indexToAddr(int idx)
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
protected void doClose() throws java.io.IOException
java.io.IOException
public boolean isClosed()
public boolean isCorrupted()
protected void doFlush() throws java.io.IOException
java.io.IOException
protected final void markDirty(boolean dirty) throws java.io.IOException
java.io.IOException
protected void markCorrupted()