Interface MessageReadSet


  • public interface MessageReadSet
    This represents a list of messages from a given store.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int count()  
      void doPrefetch​(int index, long relativeOffset, long size)
      Do data prefetch from store.
      StoreKey getKeyAt​(int index)
      Returns the key of the ith message
      io.netty.buffer.ByteBuf getPrefetchedData​(int index)
      Return prefetched data at given index.
      long sizeInBytes​(int index)
      Returns the size of the ith message
      long writeTo​(int index, java.nio.channels.WritableByteChannel channel, long relativeOffset, long maxSize)
      Write the message referred by the index in this set to the given channel from the given relative offset up to maxSize.
      void writeTo​(AsyncWritableChannel channel, Callback<java.lang.Long> callback)
      This method is intend to write prefetched data from MessageReadSet to AsyncWritableChannel.
    • Method Detail

      • writeTo

        long writeTo​(int index,
                     java.nio.channels.WritableByteChannel channel,
                     long relativeOffset,
                     long maxSize)
              throws java.io.IOException
        Write the message referred by the index in this set to the given channel from the given relative offset up to maxSize. Less than the complete amount may be written, but no more than maxSize can be. The number of bytes written is returned
        Parameters:
        index - the index of the message in the set that needs to be written
        channel - the channel into which the data needs to be written to
        relativeOffset - The relative offset into the message from which the write needs to start
        maxSize - The max size that needs to be written from the given message
        Returns:
        The total bytes that was written into the channel
        Throws:
        java.io.IOException
      • writeTo

        void writeTo​(AsyncWritableChannel channel,
                     Callback<java.lang.Long> callback)
        This method is intend to write prefetched data from MessageReadSet to AsyncWritableChannel. Data should be ready in memory(no blocking call) before write to AsyncWritableChannel asynchronously. Callback is called when the entire batch of writes succeeds or fails.
        Parameters:
        channel - the channel into which the data needs to be written to
        callback - The callback when data is fully wrote to the channel.
      • count

        int count()
        Returns:
        The total number of messages in this set
      • sizeInBytes

        long sizeInBytes​(int index)
        Returns the size of the ith message
        Parameters:
        index - The index into the message set
        Returns:
        The size in bytes of the message represented by the index
      • getKeyAt

        StoreKey getKeyAt​(int index)
        Returns the key of the ith message
        Parameters:
        index - The index into the message set
        Returns:
        The key of the message represented by the index
      • doPrefetch

        void doPrefetch​(int index,
                        long relativeOffset,
                        long size)
                 throws java.io.IOException
        Do data prefetch from store.
        Parameters:
        index - The index into the message set
        relativeOffset - The relativeOffset to start with
        size - The size requested to doPrefetch.
        Throws:
        java.io.IOException
      • getPrefetchedData

        io.netty.buffer.ByteBuf getPrefetchedData​(int index)
        Return prefetched data at given index.
        Parameters:
        index - The index into the message set.
        Returns:
        The prefetched data.