Interface SegmentStore

    • Field Detail

      • EMPTY_STORE

        static final SegmentStore EMPTY_STORE
        A store that is always empty and that cannot be written to.
    • Method Detail

      • containsSegment

        boolean containsSegment​(SegmentId id)
        Checks whether the identified segment exists in this store.
        Parameters:
        id - segment identifier
        Returns:
        true if the segment exists, false otherwise
      • readSegment

        @NotNull
        @NotNull Segment readSegment​(SegmentId segmentId)
        Reads the identified segment from this store.
        Parameters:
        segmentId - segment identifier
        Returns:
        identified segment, or a SegmentNotFoundException thrown if not found
      • writeSegment

        void writeSegment​(SegmentId id,
                          byte[] bytes,
                          int offset,
                          int length)
                   throws java.io.IOException
        Writes the given segment to the segment store.
        Parameters:
        id - segment identifier
        bytes - byte buffer that contains the raw contents of the segment
        offset - start offset within the byte buffer
        length - length of the segment
        Throws:
        java.io.IOException