org.apache.cassandra.io.util
Class SegmentedFile
java.lang.Object
org.apache.cassandra.io.util.SegmentedFile
- Direct Known Subclasses:
- BufferedSegmentedFile, 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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
path
public final java.lang.String path
length
public final long length
getBuilder
public static SegmentedFile.Builder getBuilder(Config.DiskAccessMode mode)
- Returns:
- A SegmentedFile.Builder.
getSegment
public abstract FileDataInput getSegment(long position,
int bufferSize)
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.
Copyright © 2010 The Apache Software Foundation