Class SegmentTarReader

    • Constructor Summary

      Constructors 
      Constructor Description
      SegmentTarReader​(java.io.File file, org.apache.jackrabbit.oak.segment.file.tar.FileAccess access, Index index, IOMonitor ioMonitor)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the archive.
      boolean containsSegment​(long msb, long lsb)
      Check if the segment exists.
      Buffer getBinaryReferences()
      Load binary references.
      int getEntrySize​(int size)
      Transforms the segment size in bytes into the effective size on disk for the given entry (eg.
      Buffer getGraph()
      Load the segment graph.
      java.lang.String getName()
      Get the name of the archive.
      boolean hasGraph()
      Check if the segment graph has been persisted for this archive.
      boolean isRemote()
      This method returns true if the storage is accessed via a network protocol, not tight to the traditional storage technology, for example, HTTP.
      long length()
      Get the current length of the archive.
      java.util.List<SegmentArchiveEntry> listSegments()
      List all the segments, in the order as they have been written to the archive.
      static Index loadAndValidateIndex​(java.io.RandomAccessFile file, java.lang.String name)  
      Buffer readSegment​(long msb, long lsb)
      Read the segment.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SegmentTarReader

        public SegmentTarReader​(java.io.File file,
                                org.apache.jackrabbit.oak.segment.file.tar.FileAccess access,
                                Index index,
                                IOMonitor ioMonitor)
    • Method Detail

      • readSegment

        public Buffer readSegment​(long msb,
                                  long lsb)
                           throws java.io.IOException
        Description copied from interface: SegmentArchiveReader
        Read the segment.
        Specified by:
        readSegment in interface SegmentArchiveReader
        Parameters:
        msb - the most significant bits of the identifier of the segment
        lsb - the least significant bits of the identifier of the segment
        Returns:
        byte buffer containing the segment data or null if the segment doesn't exist
        Throws:
        java.io.IOException
      • containsSegment

        public boolean containsSegment​(long msb,
                                       long lsb)
        Description copied from interface: SegmentArchiveReader
        Check if the segment exists.
        Specified by:
        containsSegment in interface SegmentArchiveReader
        Parameters:
        msb - the most significant bits of the identifier of the segment
        lsb - the least significant bits of the identifier of the segment
        Returns:
        true if the segment exists
      • loadAndValidateIndex

        public static Index loadAndValidateIndex​(java.io.RandomAccessFile file,
                                                 java.lang.String name)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • getGraph

        public Buffer getGraph()
                        throws java.io.IOException
        Description copied from interface: SegmentArchiveReader
        Load the segment graph.
        Specified by:
        getGraph in interface SegmentArchiveReader
        Returns:
        byte buffer representing the graph or null if the graph hasn't been persisted.
        Throws:
        java.io.IOException
      • hasGraph

        public boolean hasGraph()
        Description copied from interface: SegmentArchiveReader
        Check if the segment graph has been persisted for this archive.
        Specified by:
        hasGraph in interface SegmentArchiveReader
        Returns:
        true if the graph exists, false otherwise
      • getBinaryReferences

        public Buffer getBinaryReferences()
                                   throws java.io.IOException
        Description copied from interface: SegmentArchiveReader
        Load binary references.
        Specified by:
        getBinaryReferences in interface SegmentArchiveReader
        Returns:
        byte buffer representing the binary references structure.
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Description copied from interface: SegmentArchiveReader
        Close the archive.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface SegmentArchiveReader
        Throws:
        java.io.IOException
      • getEntrySize

        public int getEntrySize​(int size)
        Description copied from interface: SegmentArchiveReader
        Transforms the segment size in bytes into the effective size on disk for the given entry (eg. by adding the number of padding bytes, header, etc.)
        Specified by:
        getEntrySize in interface SegmentArchiveReader
        Parameters:
        size - the segment size in bytes
        Returns:
        the number of bytes effectively used on the storage to save the segment
      • isRemote

        public boolean isRemote()
        Description copied from interface: SegmentArchiveReader
        This method returns true if the storage is accessed via a network protocol, not tight to the traditional storage technology, for example, HTTP. Based on that info, for instance, calling classes can decide to update archive metadata (graph, binary references, index) more frequently, and not only when the archive is being closed. With that multiple Oak processes can access the storage simultaneously, with one process in read-write mode and one or more processes in read-only mode.
        Specified by:
        isRemote in interface SegmentArchiveReader
        Returns: