Interface Slice<T>
- Type Parameters:
T-
- All Superinterfaces:
SliceMetaDataBasic, org.aksw.commons.io.util.Sync
- All Known Subinterfaces:
SliceWithPages<T>
- All Known Implementing Classes:
SliceBase, SliceInMemory, SliceInMemoryCache, SliceWithPagesSyncToDisk
A concurrently accessible sequence of data of possibly unknown size.
- Author:
- raven
-
Method Summary
Modifier and TypeMethodDescriptionaddEvictionGuard(com.google.common.collect.RangeSet<Long> range) Protect a set of ranges from eviction.default <X> XcomputeFromMetaData(boolean isWrite, Function<? super SliceMetaDataBasic, X> fn) Lock the metadata and then invoke a value returning function on it.default booleanRead the metadata and check whether the slice has a known size and there is only a single range of loaded data starting from offset 0 to that size.default voidmutateMetaData(Consumer<? super SliceMetaDataBasic> fn) An accessor which allows for 'claiming' a sub-range of this slice.default voidreadMetaData(Consumer<? super SliceMetaDataBasic> fn) Methods inherited from interface SliceMetaDataBasic
getFailedRanges, getGaps, getKnownSize, getLoadedRanges, getMaximumKnownSize, getMinimumKnownSize, setKnownSize, setMaximumKnownSize, setMinimumKnownSize, updateMaximumKnownSize, updateMinimumKnownSizeMethods inherited from interface org.aksw.commons.io.util.Sync
sync
-
Method Details
-
getReadWriteLock
ReadWriteLock getReadWriteLock() -
getHasDataCondition
Condition getHasDataCondition() -
getArrayOps
-
addEvictionGuard
Protect a set of ranges from eviction. If the slice does make use of eviction then this method can return null. Otherwise, a disposable must be returned. As long as it is not disposed no data in the range may get lost due to eviction. This method should not be used directly but via}.invalid @link
{@link SliceAccessor#addEvictionGuard(RangeSet)) -
isComplete
default boolean isComplete()Read the metadata and check whether the slice has a known size and there is only a single range of loaded data starting from offset 0 to that size.- Returns:
-
mutateMetaData
-
readMetaData
-
computeFromMetaData
Lock the metadata and then invoke a value returning function on it. Afterwards release the lock. Returns the obtained value.- Type Parameters:
X-- Parameters:
isWrite-fn-- Returns:
-
newSliceAccessor
SliceAccessor<T> newSliceAccessor()An accessor which allows for 'claiming' a sub-range of this slice. The claimed range can be incrementally modified which may re-use already allocated resources (e.g. claimed pages) and thus improve performance. Sub-ranges of a slice can be loaded and iterated or inserted into. The sub-ranges can be modified dynamically.
-