Interface SegmentArchiveReader
- All Superinterfaces:
- AutoCloseable,- Closeable
- All Known Implementing Classes:
- AbstractRemoteSegmentArchiveReader,- AwsSegmentArchiveReader,- AzureSegmentArchiveReader,- AzureSegmentArchiveReaderV8,- CachingSegmentArchiveReader,- SegmentTarReader
This interface represents a read-only segment archive. Since the underlying
 data structure is immutable, the implementation should be thread safe.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclose()Close the archive.booleancontainsSegment(long msb, long lsb) Check if the segment exists.@NotNull BufferLoad binary references.intgetEntrySize(int size) Transforms the segment size in bytes into the effective size on disk for the given entry (eg.@Nullable BuffergetGraph()Load the segment graph.@NotNull StringgetName()Get the name of the archive.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.longlength()Get the current length of the archive.List all the segments, in the order as they have been written to the archive.@Nullable BufferreadSegment(long msb, long lsb) Read the segment.
- 
Method Details- 
readSegmentRead the segment.- 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
 
- 
containsSegmentboolean containsSegment(long msb, long lsb) Check if the segment exists.- 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
 
- 
listSegmentsList<SegmentArchiveEntry> listSegments()List all the segments, in the order as they have been written to the archive.- Returns:
- segment list, ordered by their position in the archive
 
- 
getGraphLoad the segment graph.- Returns:
- byte buffer representing the graph or null if the graph hasn't been persisted.
- Throws:
- IOException
 
- 
hasGraphboolean hasGraph()Check if the segment graph has been persisted for this archive.- Returns:
- trueif the graph exists, false otherwise
 
- 
getBinaryReferencesLoad binary references.- Returns:
- byte buffer representing the binary references structure.
- Throws:
- IOException
 
- 
lengthlong length()Get the current length of the archive.- Returns:
- length of the archive, in bytes
 
- 
getNameGet the name of the archive.- Returns:
- archive name
 
- 
closeClose the archive.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
- 
getEntrySizeint getEntrySize(int size) 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.)- Parameters:
- size- the segment size in bytes
- Returns:
- the number of bytes effectively used on the storage to save the segment
 
- 
isRemoteboolean isRemote()This 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.- Returns:
 
 
-