Interface Slice<T>
- Type Parameters:
T
- The array type for transferring data in blocks
- All Superinterfaces:
HasArrayOps<T>
,SliceMetaDataBasic
,org.apache.jena.atlas.lib.Sync
- All Known Subinterfaces:
SliceWithPages<T>
- All Known Implementing Classes:
SliceBase
,SliceInMemoryCache
public interface Slice<T>
extends SliceMetaDataBasic, HasArrayOps<T>, org.apache.jena.atlas.lib.Sync
A concurrently accessible sequence of data of possibly unknown size.
-
Method Summary
Modifier and TypeMethodDescriptionaddEvictionGuard
(com.google.common.collect.RangeSet<Long> range) Protect a set of ranges from eviction.void
clear()
Reset this slice - removes all data and sets the size to unknowndefault <X> X
computeFromMetaData
(boolean isWrite, Function<? super SliceMetaDataBasic, X> fn) Lock the metadata and then invoke a value returning function on it.default boolean
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.default void
mutateMetaData
(Consumer<? super SliceMetaDataBasic> fn) An accessor which allows for 'claiming' a sub-range of this slice.default void
readMetaData
(Consumer<? super SliceMetaDataBasic> fn) Methods inherited from interface org.apache.jena.sparql.service.enhancer.slice.api.HasArrayOps
getArrayOps
Methods inherited from interface org.apache.jena.sparql.service.enhancer.slice.api.SliceMetaDataBasic
getFailedRanges, getGaps, getKnownSize, getLoadedRanges, getMaximumKnownSize, getMinimumKnownSize, setKnownSize, setMaximumKnownSize, setMinimumKnownSize, updateMaximumKnownSize, updateMinimumKnownSize
Methods inherited from interface org.apache.jena.atlas.lib.Sync
sync
-
Method Details
-
getReadWriteLock
ReadWriteLock getReadWriteLock() -
getHasDataCondition
Condition getHasDataCondition() -
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, the no data in the range may get lost due to eviction. This method should not be used directly but viaSliceAccessor.addEvictionGuard(com.google.common.collect.RangeSet<java.lang.Long>)
. -
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. -
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
- The type of the value being computed- Parameters:
isWrite
- If true then lock for writing, otherwise for readingfn
- The custom computing function- Returns:
- The computed value
-
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. -
clear
void clear()Reset this slice - removes all data and sets the size to unknown
-