Class AbstractRemoteSegmentArchiveReader
java.lang.Object
org.apache.jackrabbit.oak.segment.remote.AbstractRemoteSegmentArchiveReader
- All Implemented Interfaces:
- Closeable,- AutoCloseable,- SegmentArchiveReader
- Direct Known Subclasses:
- AwsSegmentArchiveReader,- AzureSegmentArchiveReader,- AzureSegmentArchiveReaderV8
public abstract class AbstractRemoteSegmentArchiveReader
extends Object
implements SegmentArchiveReader
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected abstract FileReturns the decoded file component of this archive.voidclose()Close the archive.protected abstract longPopulates the archive index, summing up each entry's length.booleancontainsSegment(long msb, long lsb) Check if the segment exists.protected abstract BufferdoReadDataFile(String extension) Reads a data file inside the archive.protected abstract voiddoReadSegmentToBuffer(String segmentFileName, Buffer buffer) Reads the segment from the remote storage.Load binary references.intgetEntrySize(int size) Transforms the segment size in bytes into the effective size on disk for the given entry (eg.getGraph()Load the segment graph.booleanhasGraph()Check if the segment graph has been persisted for this archive.booleanisRemote()This method returnstrueif the storage is accessed via a network protocol, not tight to the traditional storage technology, for example, HTTP.List all the segments, in the order as they have been written to the archive.readSegment(long msb, long lsb) Read the segment.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.jackrabbit.oak.segment.spi.persistence.SegmentArchiveReadergetName, length
- 
Field Details- 
ioMonitor
- 
index
- 
hasGraph
 
- 
- 
Constructor Details- 
AbstractRemoteSegmentArchiveReader- Throws:
- IOException
 
 
- 
- 
Method Details- 
readSegmentDescription copied from interface:SegmentArchiveReaderRead the segment.- Specified by:
- readSegmentin 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:
- IOException
 
- 
containsSegmentpublic boolean containsSegment(long msb, long lsb) Description copied from interface:SegmentArchiveReaderCheck if the segment exists.- Specified by:
- containsSegmentin 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:
- trueif the segment exists
 
- 
listSegmentsDescription copied from interface:SegmentArchiveReaderList all the segments, in the order as they have been written to the archive.- Specified by:
- listSegmentsin interface- SegmentArchiveReader
- Returns:
- segment list, ordered by their position in the archive
 
- 
getGraphDescription copied from interface:SegmentArchiveReaderLoad the segment graph.- Specified by:
- getGraphin interface- SegmentArchiveReader
- Returns:
- byte buffer representing the graph or null if the graph hasn't been persisted.
- Throws:
- IOException
 
- 
hasGraphpublic boolean hasGraph()Description copied from interface:SegmentArchiveReaderCheck if the segment graph has been persisted for this archive.- Specified by:
- hasGraphin interface- SegmentArchiveReader
- Returns:
- trueif the graph exists, false otherwise
 
- 
getBinaryReferencesDescription copied from interface:SegmentArchiveReaderLoad binary references.- Specified by:
- getBinaryReferencesin interface- SegmentArchiveReader
- Returns:
- byte buffer representing the binary references structure.
- Throws:
- IOException
 
- 
closepublic void close()Description copied from interface:SegmentArchiveReaderClose the archive.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein interface- SegmentArchiveReader
 
- 
getEntrySizepublic int getEntrySize(int size) Description copied from interface:SegmentArchiveReaderTransforms 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:
- getEntrySizein interface- SegmentArchiveReader
- Parameters:
- size- the segment size in bytes
- Returns:
- the number of bytes effectively used on the storage to save the segment
 
- 
computeArchiveIndexAndLengthPopulates the archive index, summing up each entry's length.- Returns:
- length, the total length of the archive
- Throws:
- IOException
 
- 
doReadSegmentToBufferprotected abstract void doReadSegmentToBuffer(String segmentFileName, Buffer buffer) throws IOException Reads the segment from the remote storage.- Parameters:
- segmentFileName- , the name of the segment (msb + lsb) prefixed by its position in the archive
- buffer- , the buffer to which to read
- Throws:
- IOException
 
- 
doReadDataFileReads a data file inside the archive. This entry is not a segment. Its full name is given by archive name + extension.- Parameters:
- extension- , extension of the file
- Returns:
- the buffer containing the data file bytes
- Throws:
- IOException
 
- 
archivePathAsFileReturns the decoded file component of this archive.- Returns:
- the decoded file component of this archive.
 
- 
isRemotepublic boolean isRemote()Description copied from interface:SegmentArchiveReaderThis method returnstrueif 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:
- isRemotein interface- SegmentArchiveReader
- Returns:
 
 
-