Class SliceInMemory<A>

java.lang.Object
org.aksw.commons.io.slice.SliceBase<A>
org.aksw.commons.io.slice.SliceInMemory<A>
Type Parameters:
A -
All Implemented Interfaces:
Slice<A>, SliceMetaDataBasic, org.aksw.commons.io.util.Sync

public class SliceInMemory<A> extends SliceBase<A>
Slice implementation backed only by a single Buffer. This implementation never evicts data hence using it with large amounts of data is subject to out of memory issues.
Author:
raven
  • Field Details

  • Constructor Details

    • SliceInMemory

      protected SliceInMemory(ArrayOps<A> arrayOps, Buffer<A> buffer)
  • Method Details

    • create

      public static <A> SliceInMemory<A> create(ArrayOps<A> arrayOps, Buffer<A> buffer)
    • getMetaData

      protected SliceMetaDataBasic getMetaData()
      Specified by:
      getMetaData in class SliceBase<A>
    • newSliceAccessor

      public SliceAccessor<A> newSliceAccessor()
      Description copied from interface: Slice
      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.
    • sync

      public void sync() throws IOException
      Throws:
      IOException
    • addEvictionGuard

      public Disposable addEvictionGuard(com.google.common.collect.RangeSet<Long> range)
      Description copied from interface: Slice
      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))
      }.