Class LegacyDirectMonotonicWriter
java.lang.Object
org.apache.lucene.backward_codecs.packed.LegacyDirectMonotonicWriter
Write monotonically-increasing sequences of integers. This writer splits data into blocks and
then for each block, computes the average slope, the minimum value and only encode the delta from
the expected value using a
LegacyDirectWriter
.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final long
(package private) final long[]
(package private) int
(package private) long
(package private) final IndexOutput
(package private) boolean
static final int
max block shift(package private) final IndexOutput
static final int
min block shift(package private) final long
(package private) long
-
Constructor Summary
ConstructorsConstructorDescriptionLegacyDirectMonotonicWriter
(IndexOutput metaOut, IndexOutput dataOut, long numValues, int blockShift) -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(long v) Write a new value.void
finish()
This must be called exactly once after all values have beenadded
.private void
flush()
static LegacyDirectMonotonicWriter
getInstance
(IndexOutput metaOut, IndexOutput dataOut, long numValues, int blockShift) Returns an instance suitable for encodingnumValues
into monotonic blocks of 2blockShift
values.
-
Field Details
-
MIN_BLOCK_SHIFT
public static final int MIN_BLOCK_SHIFTmin block shift- See Also:
-
MAX_BLOCK_SHIFT
public static final int MAX_BLOCK_SHIFTmax block shift- See Also:
-
meta
-
data
-
numValues
final long numValues -
baseDataPointer
final long baseDataPointer -
buffer
final long[] buffer -
bufferSize
int bufferSize -
count
long count -
finished
boolean finished -
previous
long previous
-
-
Constructor Details
-
LegacyDirectMonotonicWriter
LegacyDirectMonotonicWriter(IndexOutput metaOut, IndexOutput dataOut, long numValues, int blockShift)
-
-
Method Details
-
flush
- Throws:
IOException
-
add
Write a new value. Note that data might not make it to storage untilfinish()
is called.- Throws:
IllegalArgumentException
- if values don't come in orderIOException
-
finish
This must be called exactly once after all values have beenadded
.- Throws:
IOException
-
getInstance
public static LegacyDirectMonotonicWriter getInstance(IndexOutput metaOut, IndexOutput dataOut, long numValues, int blockShift) Returns an instance suitable for encodingnumValues
into monotonic blocks of 2blockShift
values. Metadata will be written tometaOut
and actual data todataOut
.
-