Class TapeQueueFile

    • Constructor Detail

      • TapeQueueFile

        public TapeQueueFile​(com.squareup.tape2.QueueFile delegate)
        Parameters:
        delegate - tape queue file
      • TapeQueueFile

        public TapeQueueFile​(com.squareup.tape2.QueueFile delegate,
                             @Nullable
                             BiConsumer<Integer,​Long> writeStatsConsumer)
        Parameters:
        delegate - tape queue file
        writeStatsConsumer - consumer for statistics on writes (bytes written and millis taken)
      • TapeQueueFile

        public TapeQueueFile​(com.squareup.tape2.QueueFile delegate,
                             @Nullable
                             BiConsumer<Integer,​Long> writeStatsConsumer,
                             @Nullable
                             com.wavefront.common.TimeProvider clock)
        Parameters:
        delegate - tape queue file
        writeStatsConsumer - consumer for statistics on writes (bytes written and millis taken)
        clock - time provider (in millis)
    • Method Detail

      • add

        public void add​(byte[] data,
                        int offset,
                        int count)
                 throws IOException
        Description copied from interface: QueueFile
        Adds an element to the end of the queue.
        Specified by:
        add in interface QueueFile
        Parameters:
        data - to copy bytes from
        offset - to start from in buffer
        count - number of bytes to copy
        Throws:
        IOException
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: QueueFile
        Checks whether this queue is empty.
        Specified by:
        isEmpty in interface QueueFile
        Returns:
        true if this queue contains no entries
      • size

        public int size()
        Description copied from interface: QueueFile
        Returns the number of elements in this queue.
        Specified by:
        size in interface QueueFile
      • storageBytes

        public long storageBytes()
        Description copied from interface: QueueFile
        Returns the storage size (on-disk file size) in bytes.
        Specified by:
        storageBytes in interface QueueFile
        Returns:
        file size in bytes.
      • usedBytes

        public long usedBytes()
        Description copied from interface: QueueFile
        Returns the number of bytes used for data.
        Specified by:
        usedBytes in interface QueueFile
        Returns:
        bytes used.
      • availableBytes

        public long availableBytes()
        Description copied from interface: QueueFile
        Returns the number of bytes available for adding new tasks without growing the file.
        Specified by:
        availableBytes in interface QueueFile
        Returns:
        bytes available.