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

public interface Slice<T> extends SliceMetaDataBasic, org.aksw.commons.io.util.Sync
A concurrently accessible sequence of data of possibly unknown size.
Author:
raven
  • Method Details

    • getReadWriteLock

      ReadWriteLock getReadWriteLock()
    • getHasDataCondition

      Condition getHasDataCondition()
    • getArrayOps

      ArrayOps<T> getArrayOps()
    • 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 no data in the range may get lost due to eviction. This method should not be used directly but via {@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

      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 -
      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.