public class IndexSummaryBuilder
extends java.lang.Object
implements java.lang.AutoCloseable
Modifier and Type | Class and Description |
---|---|
static class |
IndexSummaryBuilder.ReadableBoundary
Represents a boundary that is guaranteed fully readable in the summary, index file and data file.
|
Constructor and Description |
---|
IndexSummaryBuilder(long expectedKeys,
int minIndexInterval,
int samplingLevel) |
Modifier and Type | Method and Description |
---|---|
IndexSummary |
build(IPartitioner partitioner) |
IndexSummary |
build(IPartitioner partitioner,
IndexSummaryBuilder.ReadableBoundary boundary) |
static int |
calculateSamplingLevel(int currentSamplingLevel,
int currentNumEntries,
long targetNumEntries,
int minIndexInterval,
int maxIndexInterval) |
void |
close() |
java.lang.Throwable |
close(java.lang.Throwable accumulate) |
static IndexSummary |
downsample(IndexSummary existing,
int newSamplingLevel,
int minIndexInterval,
IPartitioner partitioner)
Downsamples an existing index summary to a new sampling level.
|
static int |
entriesAtSamplingLevel(int samplingLevel,
int maxSummarySize) |
IndexSummaryBuilder.ReadableBoundary |
getLastReadableBoundary() |
void |
markDataSynced(long upToPosition) |
void |
markIndexSynced(long upToPosition) |
IndexSummaryBuilder |
maybeAddEntry(DecoratedKey decoratedKey,
long indexStart) |
IndexSummaryBuilder |
maybeAddEntry(DecoratedKey decoratedKey,
long indexStart,
long indexEnd,
long dataEnd) |
void |
prepareToCommit() |
public IndexSummaryBuilder(long expectedKeys, int minIndexInterval, int samplingLevel)
public void markIndexSynced(long upToPosition)
public void markDataSynced(long upToPosition)
public IndexSummaryBuilder.ReadableBoundary getLastReadableBoundary()
public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexStart) throws java.io.IOException
java.io.IOException
public IndexSummaryBuilder maybeAddEntry(DecoratedKey decoratedKey, long indexStart, long indexEnd, long dataEnd) throws java.io.IOException
decoratedKey
- the key for this recordindexStart
- the position in the index file this record beginsindexEnd
- the position in the index file we need to be able to read to (exclusive) to read this recorddataEnd
- the position in the data file we need to be able to read to (exclusive) to read this record
a value of 0 indicates we are not tracking readable boundariesjava.io.IOException
public void prepareToCommit()
public IndexSummary build(IPartitioner partitioner)
public IndexSummary build(IPartitioner partitioner, IndexSummaryBuilder.ReadableBoundary boundary)
public void close()
close
in interface java.lang.AutoCloseable
public java.lang.Throwable close(java.lang.Throwable accumulate)
public static int entriesAtSamplingLevel(int samplingLevel, int maxSummarySize)
public static int calculateSamplingLevel(int currentSamplingLevel, int currentNumEntries, long targetNumEntries, int minIndexInterval, int maxIndexInterval)
public static IndexSummary downsample(IndexSummary existing, int newSamplingLevel, int minIndexInterval, IPartitioner partitioner)
existing
- an existing IndexSummarynewSamplingLevel
- the target level for the new IndexSummary. This must be less than the current sampling
level for `existing`.partitioner
- the partitioner used for the index summaryCopyright © 2020 The Apache Software Foundation