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 Details

    • getReadWriteLock

      ReadWriteLock getReadWriteLock()
    • getHasDataCondition

      Condition getHasDataCondition()
    • addEvictionGuard

      Disposable addEvictionGuard(com.google.common.collect.RangeSet<Long> range)
      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 via SliceAccessor.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

      default void mutateMetaData(Consumer<? super SliceMetaDataBasic> fn)
    • readMetaData

      default void readMetaData(Consumer<? super SliceMetaDataBasic> fn)
    • computeFromMetaData

      default <X> X computeFromMetaData(boolean isWrite, Function<? super SliceMetaDataBasic,X> fn)
      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 reading
      fn - 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