public abstract class MapIndexStorage<Key,Value> extends java.lang.Object implements IndexStorage<Key,Value>
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.locks.Lock |
l |
protected java.nio.file.Path |
myBaseStorageFile |
protected SLRUCache<Key,ChangeTrackingValueContainer<Value>> |
myCache |
protected KeyDescriptor<Key> |
myKeyDescriptor |
protected PersistentMap<Key,UpdatableValueContainer<Value>> |
myMap |
Modifier | Constructor and Description |
---|---|
protected |
MapIndexStorage(java.nio.file.Path storageFile,
KeyDescriptor<Key> keyDescriptor,
DataExternalizer<Value> valueExternalizer,
int cacheSize,
boolean keyIsUniqueForIndexedFile) |
protected |
MapIndexStorage(java.nio.file.Path storageFile,
KeyDescriptor<Key> keyDescriptor,
DataExternalizer<Value> valueExternalizer,
int cacheSize,
boolean keyIsUniqueForIndexedFile,
boolean initialize,
boolean readOnly,
ValueContainerInputRemapping inputRemapping) |
Modifier and Type | Method and Description |
---|---|
void |
addValue(Key key,
int inputId,
Value value) |
protected abstract void |
checkCanceled() |
void |
clear() |
void |
clearCaches() |
void |
close() |
protected boolean |
doProcessKeys(Processor<? super Key> processor) |
void |
flush() |
PersistentMap<Key,UpdatableValueContainer<Value>> |
getIndexMap() |
static java.nio.file.Path |
getIndexStorageFile(java.nio.file.Path baseFile) |
protected void |
initMapAndCache() |
boolean |
processKeys(Processor<? super Key> processor) |
ChangeTrackingValueContainer<Value> |
read(Key key) |
void |
removeAllValues(Key key,
int inputId) |
protected static <T> T |
unwrapCauseAndRethrow(java.lang.RuntimeException e) |
protected PersistentMap<Key,UpdatableValueContainer<Value>> myMap
protected SLRUCache<Key,ChangeTrackingValueContainer<Value>> myCache
protected final java.nio.file.Path myBaseStorageFile
protected final KeyDescriptor<Key> myKeyDescriptor
protected final java.util.concurrent.locks.Lock l
protected MapIndexStorage(java.nio.file.Path storageFile, KeyDescriptor<Key> keyDescriptor, DataExternalizer<Value> valueExternalizer, int cacheSize, boolean keyIsUniqueForIndexedFile) throws java.io.IOException
java.io.IOException
protected MapIndexStorage(java.nio.file.Path storageFile, KeyDescriptor<Key> keyDescriptor, DataExternalizer<Value> valueExternalizer, int cacheSize, boolean keyIsUniqueForIndexedFile, boolean initialize, boolean readOnly, ValueContainerInputRemapping inputRemapping) throws java.io.IOException
java.io.IOException
protected void initMapAndCache() throws java.io.IOException
java.io.IOException
protected abstract void checkCanceled()
public void flush()
flush
in interface IndexStorage<Key,Value>
flush
in interface java.io.Flushable
public void close() throws StorageException
close
in interface IndexStorage<Key,Value>
StorageException
public void clear() throws StorageException
clear
in interface IndexStorage<Key,Value>
StorageException
public ChangeTrackingValueContainer<Value> read(Key key) throws StorageException
read
in interface IndexStorage<Key,Value>
StorageException
public void addValue(Key key, int inputId, Value value) throws StorageException
addValue
in interface IndexStorage<Key,Value>
StorageException
public void removeAllValues(Key key, int inputId) throws StorageException
removeAllValues
in interface IndexStorage<Key,Value>
StorageException
public void clearCaches()
clearCaches
in interface IndexStorage<Key,Value>
protected static <T> T unwrapCauseAndRethrow(java.lang.RuntimeException e) throws StorageException
StorageException
public boolean processKeys(Processor<? super Key> processor) throws StorageException
StorageException
protected boolean doProcessKeys(Processor<? super Key> processor) throws java.io.IOException
java.io.IOException
public PersistentMap<Key,UpdatableValueContainer<Value>> getIndexMap()
public static java.nio.file.Path getIndexStorageFile(java.nio.file.Path baseFile)