org.apache.cassandra.io.util
Class SegmentedFile
java.lang.Object
org.apache.cassandra.io.util.SegmentedFile
- Direct Known Subclasses:
- BufferedSegmentedFile, CompressedSegmentedFile, MmappedSegmentedFile
public abstract class SegmentedFile
- extends java.lang.Object
Abstracts a read-only file that has been split into segments, each of which can be represented by an independent
FileDataInput. Allows for iteration over the FileDataInputs, or random access to the FileDataInput for a given
position.
The JVM can only map up to 2GB at a time, so each segment is at most that size when using mmap i/o. If a segment
would need to be longer than 2GB, that segment will not be mmap'd, and a new RandomAccessFile will be created for
each access to that segment.
Nested Class Summary |
static class |
SegmentedFile.Builder
Collects potential segmentation points in an underlying file, and builds a SegmentedFile to represent it. |
Constructor Summary |
protected |
SegmentedFile(java.lang.String path,
long length,
long onDiskLength)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
path
public final java.lang.String path
length
public final long length
onDiskLength
public final long onDiskLength
SegmentedFile
protected SegmentedFile(java.lang.String path,
long length,
long onDiskLength)
getBuilder
public static SegmentedFile.Builder getBuilder(Config.DiskAccessMode mode)
- Returns:
- A SegmentedFile.Builder.
getCompressedBuilder
public static SegmentedFile.Builder getCompressedBuilder()
getSegment
public abstract FileDataInput getSegment(long position)
iterator
public java.util.Iterator<FileDataInput> iterator(long position,
int bufferSize)
- Returns:
- An Iterator over segments, beginning with the segment containing the given position: each segment must be closed after use.
cleanup
public abstract void cleanup()
- Do whatever action is needed to reclaim ressources used by this SegmentedFile.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
Copyright © 2011 The Apache Software Foundation