Documentation ¶
Index ¶
- Constants
- Variables
- func BitsRequired(maxValue int64) (int, error)
- func CloneI64ToU64(src []int64, dest []uint64) int
- func CopyValues(src Reader, srcPos int, dest Mutable, destPos, size, mem int)
- func CopyValuesWithBuffer(src Reader, srcPos int, dest Mutable, destPos, size int, buf []uint64)
- func Fill(spi mutableSPI, fromIndex, toIndex int, value uint64)
- func GetBulk(reader Reader, index int, arr []uint64) int
- func MaxValue(bitsPerValue int) uint64
- func Of(format Format, bitsPerValue int) (common.BulkOperation, error)
- func SetBulk(spi mutableSPI, index int, arr []uint64) int
- func UnsignedBitsRequired(v uint64) int
- type BaseWriter
- type BlockPackedFlusher
- type BlockPackedReader
- type BlockPackedReaderIterator
- func (b *BlockPackedReaderIterator) Next(ctx context.Context) (uint64, error)
- func (b *BlockPackedReaderIterator) NextSlices(ctx context.Context, count int) ([]uint64, error)
- func (b *BlockPackedReaderIterator) Ord() int
- func (b *BlockPackedReaderIterator) Reset(in store.DataInput, valueCount int)
- func (b *BlockPackedReaderIterator) Skip(ctx context.Context, count int) error
- type BlockPackedWriter
- type Decoder
- type DeltaPackedLongValues
- type DeltaPackedLongValuesBuilder
- type Direct16
- func (d *Direct16) Clear()
- func (d *Direct16) Fill(fromIndex, toIndex int, value uint64)
- func (d *Direct16) Get(index int) (uint64, error)
- func (m Direct16) GetBitsPerValue() int
- func (d *Direct16) GetBulk(index int, arr []uint64) int
- func (d *Direct16) GetTest(index int) uint64
- func (d *Direct16) Set(index int, value uint64)
- func (d *Direct16) SetBulk(index int, arr []uint64) int
- func (m Direct16) Size() int
- type Direct32
- func (d *Direct32) Clear()
- func (d *Direct32) Fill(fromIndex, toIndex int, value uint64)
- func (d *Direct32) Get(index int) (uint64, error)
- func (m Direct32) GetBitsPerValue() int
- func (d *Direct32) GetBulk(index int, arr []uint64) int
- func (d *Direct32) GetTest(index int) uint64
- func (d *Direct32) Set(index int, value uint64)
- func (d *Direct32) SetBulk(index int, arr []uint64) int
- func (m Direct32) Size() int
- type Direct64
- func (d *Direct64) Clear()
- func (d *Direct64) Fill(fromIndex, toIndex int, value uint64)
- func (d *Direct64) Get(index int) (uint64, error)
- func (m Direct64) GetBitsPerValue() int
- func (d *Direct64) GetBulk(index int, arr []uint64) int
- func (d *Direct64) GetTest(index int) uint64
- func (d *Direct64) Set(index int, value uint64)
- func (d *Direct64) SetBulk(index int, arr []uint64) int
- func (m Direct64) Size() int
- type Direct8
- func (d *Direct8) Clear()
- func (d *Direct8) Fill(fromIndex, toIndex int, value uint64)
- func (d *Direct8) Get(index int) (uint64, error)
- func (m Direct8) GetBitsPerValue() int
- func (d *Direct8) GetBulk(index int, arr []uint64) int
- func (d *Direct8) GetTest(index int) uint64
- func (d *Direct8) Set(index int, value uint64)
- func (d *Direct8) SetBulk(index int, arr []uint64) int
- func (m Direct8) Size() int
- type DirectPacked64SingleBlockReader
- type DirectPackedReader
- type DirectPackedReader1
- type DirectPackedReader12
- type DirectPackedReader16
- type DirectPackedReader2
- type DirectPackedReader20
- type DirectPackedReader24
- type DirectPackedReader28
- type DirectPackedReader32
- type DirectPackedReader4
- type DirectPackedReader40
- type DirectPackedReader48
- type DirectPackedReader56
- type DirectPackedReader64
- type DirectPackedReader8
- type DirectReader
- type DirectWriter
- type Encoder
- type FixSizePagedMutable
- func (a FixSizePagedMutable) Get(index int) (uint64, error)
- func (a FixSizePagedMutable) GetSubMutableByIndex(index int) Mutable
- func (a FixSizePagedMutable) GetTest(index int) uint64
- func (a FixSizePagedMutable) Grow(minSize int) PagedMutable
- func (a FixSizePagedMutable) GrowOne() PagedMutable
- func (p *FixSizePagedMutable) NewMutable(valueCount, bitsPerValue int) Mutable
- func (p *FixSizePagedMutable) NewUnfilledCopy(newSize int) (PagedMutable, error)
- func (a FixSizePagedMutable) Resize(newSize int) PagedMutable
- func (a FixSizePagedMutable) Set(index int, value uint64)
- func (a FixSizePagedMutable) SetSubMutableByIndex(index int, value Mutable)
- func (a FixSizePagedMutable) Size() int
- func (a FixSizePagedMutable) SubMutables() []Mutable
- type FixSizePagedMutableBuilder
- func (b *FixSizePagedMutableBuilder) New(size, pageSize, bitsPerValue int, acceptableOverheadRatio float64) (*FixSizePagedMutable, error)
- func (b *FixSizePagedMutableBuilder) NewWithFormat(size, pageSize, bitsPerValue int, format Format) (*FixSizePagedMutable, error)
- func (b *FixSizePagedMutableBuilder) NewWithFormatAndBits(size, pageSize int, formatAndBits *FormatAndBits) (*FixSizePagedMutable, error)
- type FnPackValues
- type Format
- type FormatAndBits
- type FuncGetMutable
- type GrowableWriter
- func (g *GrowableWriter) Clear()
- func (g *GrowableWriter) Fill(fromIndex, toIndex int, value uint64)
- func (g *GrowableWriter) Get(index int) (uint64, error)
- func (g *GrowableWriter) GetBitsPerValue() int
- func (g *GrowableWriter) GetBulk(index int, arr []uint64) int
- func (g *GrowableWriter) GetFormat() Format
- func (g *GrowableWriter) GetMutable() Mutable
- func (g *GrowableWriter) GetTest(index int) uint64
- func (g *GrowableWriter) Resize(newSize int) *GrowableWriter
- func (g *GrowableWriter) Save(ctx context.Context, out store.DataOutput) error
- func (g *GrowableWriter) Set(index int, value uint64)
- func (g *GrowableWriter) SetBulk(index int, values []uint64) int
- func (g *GrowableWriter) Size() int
- type LongValuesIteratorSPI
- type LongValuesReader
- type MonotonicBlockPackedReader
- type MonotonicBlockPackedWriter
- type MonotonicLongValues
- type MonotonicLongValuesBuilder
- type Mutable
- type NullReader
- type Packed16ThreeBlocks
- func (p *Packed16ThreeBlocks) Clear()
- func (p *Packed16ThreeBlocks) Fill(fromIndex, toIndex int, value uint64)
- func (p *Packed16ThreeBlocks) Get(index int) (uint64, error)
- func (m Packed16ThreeBlocks) GetBitsPerValue() int
- func (p *Packed16ThreeBlocks) GetBulk(index int, arr []uint64) int
- func (p *Packed16ThreeBlocks) GetTest(index int) uint64
- func (p *Packed16ThreeBlocks) Set(index int, value uint64)
- func (p *Packed16ThreeBlocks) SetBulk(index int, arr []uint64) int
- func (m Packed16ThreeBlocks) Size() int
- type Packed64
- func (p *Packed64) Clear()
- func (p *Packed64) Fill(fromIndex, toIndex int, value uint64)
- func (p *Packed64) Get(index int) (uint64, error)
- func (m Packed64) GetBitsPerValue() int
- func (p *Packed64) GetBulk(index int, buffer []uint64) int
- func (p *Packed64) GetFormat() Format
- func (p *Packed64) GetTest(index int) uint64
- func (p *Packed64) Save(ctx context.Context, out store.DataOutput) error
- func (p *Packed64) Set(index int, value uint64)
- func (p *Packed64) SetBulk(index int, arr []uint64) int
- func (m Packed64) Size() int
- type Packed64SingleBlock
- type Packed8ThreeBlocks
- func (p *Packed8ThreeBlocks) Clear()
- func (p *Packed8ThreeBlocks) Fill(fromIndex, toIndex int, value uint64)
- func (p *Packed8ThreeBlocks) Get(index int) (uint64, error)
- func (m Packed8ThreeBlocks) GetBitsPerValue() int
- func (p *Packed8ThreeBlocks) GetBulk(index int, arr []uint64) int
- func (p *Packed8ThreeBlocks) GetTest(index int) uint64
- func (p *Packed8ThreeBlocks) Set(index int, value uint64)
- func (p *Packed8ThreeBlocks) SetBulk(index int, arr []uint64) int
- func (m Packed8ThreeBlocks) Size() int
- type PackedInts
- type PackedLongValues
- type PackedLongValuesBuilder
- type PackedLongValuesIterator
- type PackedWriter
- type PagedGrowableWriter
- func (a PagedGrowableWriter) Get(index int) (uint64, error)
- func (a PagedGrowableWriter) GetSubMutableByIndex(index int) Mutable
- func (a PagedGrowableWriter) GetTest(index int) uint64
- func (a PagedGrowableWriter) Grow(minSize int) PagedMutable
- func (a PagedGrowableWriter) GrowOne() PagedMutable
- func (p *PagedGrowableWriter) NewMutable(valueCount, bitsPerValue int) Mutable
- func (p *PagedGrowableWriter) NewPagedGrowableWriter(size, pageSize, startBitsPerValue int, acceptableOverheadRatio float64, ...) (*PagedGrowableWriter, error)
- func (p *PagedGrowableWriter) NewUnfilledCopy(newSize int) (PagedMutable, error)
- func (a PagedGrowableWriter) Resize(newSize int) PagedMutable
- func (a PagedGrowableWriter) Set(index int, value uint64)
- func (a PagedGrowableWriter) SetSubMutableByIndex(index int, value Mutable)
- func (a PagedGrowableWriter) Size() int
- func (a PagedGrowableWriter) SubMutables() []Mutable
- type PagedMutable
- type PagedMutableBuilder
- type Reader
- type ReaderIterator
- type Writer
- type WriterFormat
Constants ¶
const ( ABP_MIN_BLOCK_SIZE = 64 ABP_MAX_BLOCK_SIZE = 1 << (30 - 3) ABP_MIN_VALUE_EQUALS_0 = 1 << 0 ABP_BPV_SHIFT = 1 )
const ( Packed64BlockSize = 64 // 32 = int, 64 = long Packed64BlockBits = 6 // The #bits representing BLOCK_SIZE MOD_MASK = uint64(Packed64BlockSize - 1) // x % BLOCK_SIZE )
const ( // FASTEST At most 700% memory overhead, always select a direct implementation. FASTEST = 7.0 // FAST At most 50% memory overhead, always select a reasonably fast implementation. FAST = 0.5 // DEFAULT At most 25% memory overhead. DEFAULT = 0.25 // COMPACT No memory overhead at all, but the returned implementation may be slow. COMPACT = 0.0 // DEFAULT_BUFFER_SIZE Default amount of memory to use for bulk operations. DEFAULT_BUFFER_SIZE = 1024 CODEC_NAME = "PackedInts" VERSION_MONOTONIC_WITHOUT_ZIGZAG = 2 VERSION_START = VERSION_MONOTONIC_WITHOUT_ZIGZAG VERSION_CURRENT = VERSION_MONOTONIC_WITHOUT_ZIGZAG )
const ( MIN_PAGE_SIZE = 64 MAX_PAGE_SIZE = 1 << 20 INITIAL_PAGE_COUNT = 16 )
const ( MIN_BLOCK_SIZE = 1 << 6 MAX_BLOCK_SIZE = 1 << 30 )
const (
Packed16ThreeBlocks_MAX_SIZE = math.MaxInt32 / 3
)
const (
Packed8ThreeBlocks_MAX_SIZE = math.MaxInt32 / 3
)
Variables ¶
var ( FormatPacked = newFormatPacked(0) FormatPackedSingleBlock = newFormatPackedSingleBlock(1) )
Functions ¶
func BitsRequired ¶
BitsRequired Returns how many bits are required to hold values up to and including maxValue NOTE: This method returns at least 1. Params: maxValue – the maximum value that should be representable. Returns: the amount of bits needed to represent values from 0 to maxValue. lucene.internal
func CloneI64ToU64 ¶
func CopyValues ¶
CopyValues Copy src[srcPos:srcPos+len] into dest[destPos:destPos+len] using at most mem bytes.
func CopyValuesWithBuffer ¶
CopyValuesWithBuffer Same as copy(PackedInts.Reader, int, PackedInts.Mutable, int, int, int) but using a pre-allocated buffer.
func UnsignedBitsRequired ¶
Types ¶
type BaseWriter ¶
type BaseWriter struct {
// contains filtered or unexported fields
}
func (*BaseWriter) BitsPerValue ¶
func (w *BaseWriter) BitsPerValue() int
func (*BaseWriter) WriteHeader ¶
func (w *BaseWriter) WriteHeader(ctx context.Context) error
type BlockPackedFlusher ¶
type BlockPackedReader ¶
type BlockPackedReader struct {
// contains filtered or unexported fields
}
BlockPackedReader Provides random access to a stream written with BlockPackedWriter. lucene.internal
func NewBlockPackedReader ¶
func NewBlockPackedReader(ctx context.Context, in store.IndexInput, packedIntsVersion, blockSize, valueCount int, direct bool) (*BlockPackedReader, error)
type BlockPackedReaderIterator ¶
type BlockPackedReaderIterator struct {
// contains filtered or unexported fields
}
BlockPackedReaderIterator Reader for sequences of longs written with BlockPackedWriter. BlockPackedWriter lucene.internal
func NewBlockPackedReaderIterator ¶
func NewBlockPackedReaderIterator(in store.DataInput, packedIntsVersion, blockSize, valueCount int) *BlockPackedReaderIterator
NewBlockPackedReaderIterator Sole constructor. blockSize: the number of values of a block, must be equal to the block size of the BlockPackedWriter which has been used to write the stream
func (*BlockPackedReaderIterator) Next ¶
func (b *BlockPackedReaderIterator) Next(ctx context.Context) (uint64, error)
Next Read the next value.
func (*BlockPackedReaderIterator) NextSlices ¶
func (*BlockPackedReaderIterator) Ord ¶
func (b *BlockPackedReaderIterator) Ord() int
Ord Return the offset of the next value to read.
type BlockPackedWriter ¶
type BlockPackedWriter struct {
// contains filtered or unexported fields
}
BlockPackedWriter A writer for large sequences of longs. The sequence is divided into fixed-size blocks and for each block, the difference between each value and the minimum value of the block is encoded using as few bits as possible. Memory usage of this class is proportional to the block size. Each block has an overhead between 1 and 10 bytes to store the minimum value and the number of bits per value of the block. Format: <BLock>BlockCount BlockCount: ⌈ ValueCount / BlockSize ⌉ Block: <Header, (Ints)> Header: <Token, (MinValue)> Token: a byte, first 7 bits are the number of bits per value (bitsPerValue). If the 8th bit is 1, then MinValue (see next) is 0, otherwise MinValue and needs to be decoded MinValue: a zigzag-encoded variable-length long whose value should be added to every int from the block to restore the original values Ints: If the number of bits per value is 0, then there is nothing to decode and all ints are equal to MinValue. Otherwise: BlockSize packed ints encoded on exactly bitsPerValue bits per value. They are the subtraction of the original values and MinValue 请参阅: BlockPackedReaderIterator, BlockPackedReader lucene.internal
func NewBlockPackedWriter ¶
func NewBlockPackedWriter(out store.DataOutput, blockSize int) *BlockPackedWriter
type Decoder ¶
type Decoder interface { // LongBlockCount // The minimum number of long blocks to encode in a single iteration, when using long encoding. LongBlockCount() int // LongValueCount // The number of values that can be stored in longBlockCount() long blocks. LongValueCount() int // ByteBlockCount // The minimum number of byte blocks to encode in a single iteration, when using byte encoding. ByteBlockCount() int // ByteValueCount // The number of values that can be stored in byteBlockCount() byte blocks. ByteValueCount() int // DecodeUint64 // Read iterations * blockCount() blocks from blocks, // decode them and write iterations * valueCount() values into values. // blocks: the long blocks that hold packed integer values // values: the values buffer // iterations: controls how much data to decode DecodeUint64(blocks []uint64, values []uint64, iterations int) // DecodeBytes // Read 8 * iterations * blockCount() blocks from blocks, // decode them and write iterations * valueCount() values into values. // blocks: the long blocks that hold packed integer values // values: the values buffer // iterations: controls how much data to decode DecodeBytes(blocks []byte, values []uint64, iterations int) }
Decoder A decoder for packed integers.
type DeltaPackedLongValues ¶
type DeltaPackedLongValues struct { *PackedLongValues // contains filtered or unexported fields }
func (*DeltaPackedLongValues) Iterator ¶
func (d *DeltaPackedLongValues) Iterator() PackedLongValuesIterator
type DeltaPackedLongValuesBuilder ¶
type DeltaPackedLongValuesBuilder struct { *PackedLongValuesBuilder // contains filtered or unexported fields }
func NewDeltaPackedLongValuesBuilder ¶
func NewDeltaPackedLongValuesBuilder(pageSize int, acceptableOverheadRatio float64) *DeltaPackedLongValuesBuilder
func (*DeltaPackedLongValuesBuilder) Add ¶
func (d *DeltaPackedLongValuesBuilder) Add(value int64) error
func (*DeltaPackedLongValuesBuilder) Build ¶
func (d *DeltaPackedLongValuesBuilder) Build() (*DeltaPackedLongValues, error)
type Direct16 ¶
type Direct16 struct {
// contains filtered or unexported fields
}
func NewDirect16 ¶
func NewDirect16V1 ¶
func (Direct16) GetBitsPerValue ¶
func (m Direct16) GetBitsPerValue() int
type Direct32 ¶
type Direct32 struct {
// contains filtered or unexported fields
}
func NewDirect32 ¶
func NewDirect32V1 ¶
func (Direct32) GetBitsPerValue ¶
func (m Direct32) GetBitsPerValue() int
type Direct64 ¶
type Direct64 struct {
// contains filtered or unexported fields
}
func NewDirect64 ¶
func NewDirect64V1 ¶
func (Direct64) GetBitsPerValue ¶
func (m Direct64) GetBitsPerValue() int
type Direct8 ¶
type Direct8 struct {
// contains filtered or unexported fields
}
Direct8 Direct wrapping of 8-bits values to a backing array. lucene.internal
func NewDirect8 ¶
func NewDirect8V1 ¶
func (Direct8) GetBitsPerValue ¶
func (m Direct8) GetBitsPerValue() int
type DirectPacked64SingleBlockReader ¶
type DirectPacked64SingleBlockReader struct {
// contains filtered or unexported fields
}
func NewDirectPacked64SingleBlockReader ¶
func NewDirectPacked64SingleBlockReader(bitsPerValue, valueCount int, in store.IndexInput) *DirectPacked64SingleBlockReader
func (*DirectPacked64SingleBlockReader) Get ¶
func (d *DirectPacked64SingleBlockReader) Get(index int) (uint64, error)
func (*DirectPacked64SingleBlockReader) GetBulk ¶
func (d *DirectPacked64SingleBlockReader) GetBulk(index int, arr []uint64) int
func (*DirectPacked64SingleBlockReader) Size ¶
func (d *DirectPacked64SingleBlockReader) Size() int
type DirectPackedReader ¶
type DirectPackedReader struct {
// contains filtered or unexported fields
}
DirectPackedReader Reads directly from disk on each get just for back compat, use DirectReader/DirectWriter for more efficient impl
func NewDirectPackedReader ¶
func NewDirectPackedReader(bitsPerValue, valueCount int, in store.IndexInput) *DirectPackedReader
func (*DirectPackedReader) GetBulk ¶
func (d *DirectPackedReader) GetBulk(index int, arr []uint64) int
func (*DirectPackedReader) Size ¶
func (d *DirectPackedReader) Size() int
type DirectPackedReader1 ¶
type DirectPackedReader1 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader1 ¶
func NewDirectPackedReader1(in store.RandomAccessInput, offset int64) *DirectPackedReader1
type DirectPackedReader12 ¶
type DirectPackedReader12 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader12 ¶
func NewDirectPackedReader12(in store.RandomAccessInput, offset int64) *DirectPackedReader12
type DirectPackedReader16 ¶
type DirectPackedReader16 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader16 ¶
func NewDirectPackedReader16(in store.RandomAccessInput, offset int64) *DirectPackedReader16
type DirectPackedReader2 ¶
type DirectPackedReader2 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader2 ¶
func NewDirectPackedReader2(in store.RandomAccessInput, offset int64) *DirectPackedReader2
type DirectPackedReader20 ¶
type DirectPackedReader20 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader20 ¶
func NewDirectPackedReader20(in store.RandomAccessInput, offset int64) *DirectPackedReader20
type DirectPackedReader24 ¶
type DirectPackedReader24 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader24 ¶
func NewDirectPackedReader24(in store.RandomAccessInput, offset int64) *DirectPackedReader24
type DirectPackedReader28 ¶
type DirectPackedReader28 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader28 ¶
func NewDirectPackedReader28(in store.RandomAccessInput, offset int64) *DirectPackedReader28
type DirectPackedReader32 ¶
type DirectPackedReader32 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader32 ¶
func NewDirectPackedReader32(in store.RandomAccessInput, offset int64) *DirectPackedReader32
type DirectPackedReader4 ¶
type DirectPackedReader4 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader4 ¶
func NewDirectPackedReader4(in store.RandomAccessInput, offset int64) *DirectPackedReader4
type DirectPackedReader40 ¶
type DirectPackedReader40 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader40 ¶
func NewDirectPackedReader40(in store.RandomAccessInput, offset int64) *DirectPackedReader40
type DirectPackedReader48 ¶
type DirectPackedReader48 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader48 ¶
func NewDirectPackedReader48(in store.RandomAccessInput, offset int64) *DirectPackedReader48
type DirectPackedReader56 ¶
type DirectPackedReader56 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader56 ¶
func NewDirectPackedReader56(in store.RandomAccessInput, offset int64) *DirectPackedReader56
type DirectPackedReader64 ¶
type DirectPackedReader64 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader64 ¶
func NewDirectPackedReader64(in store.RandomAccessInput, offset int64) *DirectPackedReader64
type DirectPackedReader8 ¶
type DirectPackedReader8 struct {
// contains filtered or unexported fields
}
func NewDirectPackedReader8 ¶
func NewDirectPackedReader8(in store.RandomAccessInput, offset int64) *DirectPackedReader8
type DirectReader ¶
type DirectReader struct { }
DirectReader Retrieves an instance previously written by DirectWriter
func NewDirectReader ¶
func NewDirectReader() *DirectReader
func (*DirectReader) GetInstance ¶
func (d *DirectReader) GetInstance(slice store.RandomAccessInput, bitsPerValue int, offset int64) (LongValuesReader, error)
type DirectWriter ¶
type DirectWriter struct {
// contains filtered or unexported fields
}
DirectWriter Class for writing packed integers to be directly read from Directory. Integers can be read on-the-fly via DirectReader. Unlike PackedInts, it optimizes for read i/o operations and supports > 2B values.
func NewDirectWriter ¶
func NewDirectWriter(output store.DataOutput, numValues, bitsPerValue int) (*DirectWriter, error)
func (*DirectWriter) Add ¶
func (d *DirectWriter) Add(v uint64) error
type Encoder ¶
type Encoder interface { // LongBlockCount // The minimum number of long blocks to encode in a single iteration, when using long encoding. LongBlockCount() int // LongValueCount // The number of values that can be stored in longBlockCount() long blocks. LongValueCount() int // ByteBlockCount // The minimum number of byte blocks to encode in a single iteration, when using byte encoding. ByteBlockCount() int // ByteValueCount // The number of values that can be stored in byteBlockCount() byte blocks. ByteValueCount() int // EncodeUint64 // Read iterations * valueCount() values from values, encode them and write // iterations * blockCount() blocks into blocks. // values: the values buffer // blocks: the long blocks that hold packed integer values // iterations: controls how much data to encode EncodeUint64(values []uint64, blocks []uint64, iterations int) // EncodeBytes // Read iterations * valueCount() values from values, // encode them and write 8 * iterations * blockCount() blocks into blocks. // values: the values buffer // blocks: the long blocks that hold packed integer values // iterations: controls how much data to encode EncodeBytes(values []uint64, blocks []byte, iterations int) }
Encoder An encoder for packed integers.
type FixSizePagedMutable ¶
type FixSizePagedMutable struct {
// contains filtered or unexported fields
}
FixSizePagedMutable A FixSizePagedMutable. This class slices data into fixed-size blocks which have the same number of bits per value. It can be a useful replacement for PackedInts.Mutable to store more than 2B values.
func (FixSizePagedMutable) GetSubMutableByIndex ¶
func (FixSizePagedMutable) Grow ¶
func (a FixSizePagedMutable) Grow(minSize int) PagedMutable
func (FixSizePagedMutable) GrowOne ¶
func (a FixSizePagedMutable) GrowOne() PagedMutable
GrowOne Similar to ArrayUtil.grow(long[]).
func (*FixSizePagedMutable) NewMutable ¶
func (p *FixSizePagedMutable) NewMutable(valueCount, bitsPerValue int) Mutable
func (*FixSizePagedMutable) NewUnfilledCopy ¶
func (p *FixSizePagedMutable) NewUnfilledCopy(newSize int) (PagedMutable, error)
func (FixSizePagedMutable) Resize ¶
func (a FixSizePagedMutable) Resize(newSize int) PagedMutable
Resize Create a new copy of size newSize based on the content of this buffer. This method is much more efficient than creating a new instance and copying values one by one.
func (FixSizePagedMutable) SetSubMutableByIndex ¶
func (FixSizePagedMutable) SubMutables ¶
func (a FixSizePagedMutable) SubMutables() []Mutable
type FixSizePagedMutableBuilder ¶
type FixSizePagedMutableBuilder struct { }
func NewFixSizePagedMutableBuilder ¶
func NewFixSizePagedMutableBuilder() FixSizePagedMutableBuilder
func (*FixSizePagedMutableBuilder) New ¶
func (b *FixSizePagedMutableBuilder) New(size, pageSize, bitsPerValue int, acceptableOverheadRatio float64) (*FixSizePagedMutable, error)
func (*FixSizePagedMutableBuilder) NewWithFormat ¶
func (b *FixSizePagedMutableBuilder) NewWithFormat(size, pageSize, bitsPerValue int, format Format) (*FixSizePagedMutable, error)
func (*FixSizePagedMutableBuilder) NewWithFormatAndBits ¶
func (b *FixSizePagedMutableBuilder) NewWithFormatAndBits(size, pageSize int, formatAndBits *FormatAndBits) (*FixSizePagedMutable, error)
type FnPackValues ¶
type Format ¶
type Format interface { GetId() int // ByteCount Computes how many byte blocks are needed to store values values of size bitsPerValue. ByteCount(packedIntsVersion, valueCount, bitsPerValue int) int // LongCount Computes how many long blocks are needed to store values values of size bitsPerValue. LongCount(packedIntsVersion, valueCount, bitsPerValue int) int // IsSupported Tests whether the provided number of bits per value is supported by the format. IsSupported(bitsPerValue int) bool // OverheadPerValue Returns the overhead per value, in bits. OverheadPerValue(bitsPerValue int) float64 // OverheadRatio Returns the overhead ratio (overhead per value / bits per value). OverheadRatio(bitsPerValue int) float64 }
func GetFormatById ¶
type FormatAndBits ¶
type FormatAndBits struct {
// contains filtered or unexported fields
}
FormatAndBits Simple class that holds a format and a number of bits per value.
func NewFormatAndBits ¶
func NewFormatAndBits(format Format, bitsPerValue int) *FormatAndBits
type FuncGetMutable ¶
type GrowableWriter ¶
type GrowableWriter struct {
// contains filtered or unexported fields
}
GrowableWriter Implements Mutable, but grows the bit count of the underlying packed ints on-demand. Beware that this class will accept to set negative values but in order to do this, it will grow the number of bits per value to 64. @lucene.internal
func NewGrowableWriter ¶
func NewGrowableWriter(startBitsPerValue, valueCount int, acceptableOverheadRatio float64) *GrowableWriter
NewGrowableWriter startBitsPerValue: the initial number of bits per value, may grow depending on the data valueCount: the number of values acceptableOverheadRatio: an acceptable overhead ratio
func (*GrowableWriter) Clear ¶
func (g *GrowableWriter) Clear()
func (*GrowableWriter) Fill ¶
func (g *GrowableWriter) Fill(fromIndex, toIndex int, value uint64)
func (*GrowableWriter) GetBitsPerValue ¶
func (g *GrowableWriter) GetBitsPerValue() int
func (*GrowableWriter) GetFormat ¶
func (g *GrowableWriter) GetFormat() Format
func (*GrowableWriter) GetMutable ¶
func (g *GrowableWriter) GetMutable() Mutable
func (*GrowableWriter) GetTest ¶
func (g *GrowableWriter) GetTest(index int) uint64
func (*GrowableWriter) Resize ¶
func (g *GrowableWriter) Resize(newSize int) *GrowableWriter
func (*GrowableWriter) Save ¶
func (g *GrowableWriter) Save(ctx context.Context, out store.DataOutput) error
func (*GrowableWriter) Set ¶
func (g *GrowableWriter) Set(index int, value uint64)
func (*GrowableWriter) Size ¶
func (g *GrowableWriter) Size() int
type LongValuesIteratorSPI ¶
type LongValuesReader ¶
type MonotonicBlockPackedReader ¶
type MonotonicBlockPackedReader struct {
// contains filtered or unexported fields
}
MonotonicBlockPackedReader Provides random access to a stream written with MonotonicBlockPackedWriter. lucene.internal
func NewMonotonicBlockPackedReader ¶
func NewMonotonicBlockPackedReader(ctx context.Context, in store.IndexInput, packedIntsVersion, blockSize, valueCount int, direct bool) (*MonotonicBlockPackedReader, error)
NewMonotonicBlockPackedReader IndexInput in, int packedIntsVersion, int blockSize, long valueCount, boolean direct
func (*MonotonicBlockPackedReader) Get ¶
func (m *MonotonicBlockPackedReader) Get(index int) (uint64, error)
func (*MonotonicBlockPackedReader) Size ¶
func (m *MonotonicBlockPackedReader) Size() int
Size Returns the number of values
type MonotonicBlockPackedWriter ¶
type MonotonicBlockPackedWriter struct {
// contains filtered or unexported fields
}
MonotonicBlockPackedWriter A writer for large monotonically increasing sequences of positive longs. The sequence is divided into fixed-size blocks and for each block, values are modeled after a linear function f: x → A × x + B. The block encodes deltas from the expected values computed from this function using as few bits as possible. Format: <BLock>BlockCount BlockCount: ⌈ ValueCount / BlockSize ⌉ Block: <Header, (Ints)> Header: <B, A, BitsPerValue> B: the B from f: x → A × x + B using a zig-zag encoded vLong A: the A from f: x → A × x + B encoded using Float.floatToIntBits(float) on 4 bytes BitsPerValue: a variable-length int Ints: if BitsPerValue is 0, then there is nothing to read and all values perfectly match the result of the function. Otherwise, these are the packed deltas from the expected value (computed from the function) using exactly BitsPerValue bits per value. 请参阅: MonotonicBlockPackedReader lucene.internal
func NewMonotonicBlockPackedWriter ¶
func NewMonotonicBlockPackedWriter(out store.DataOutput, blockSize int) *MonotonicBlockPackedWriter
func (*MonotonicBlockPackedWriter) Add ¶
func (m *MonotonicBlockPackedWriter) Add(ctx context.Context, v uint64) error
type MonotonicLongValues ¶
type MonotonicLongValues struct { *DeltaPackedLongValues // contains filtered or unexported fields }
func NewMonotonicLongValues ¶
func (*MonotonicLongValues) Iterator ¶
func (m *MonotonicLongValues) Iterator() PackedLongValuesIterator
type MonotonicLongValuesBuilder ¶
type MonotonicLongValuesBuilder struct { *DeltaPackedLongValuesBuilder // contains filtered or unexported fields }
func NewMonotonicLongValuesBuilder ¶
func NewMonotonicLongValuesBuilder(pageSize int, acceptableOverheadRatio float64) *MonotonicLongValuesBuilder
func (*MonotonicLongValuesBuilder) Add ¶
func (m *MonotonicLongValuesBuilder) Add(value int64) error
func (*MonotonicLongValuesBuilder) Build ¶
func (m *MonotonicLongValuesBuilder) Build() (*MonotonicLongValues, error)
type Mutable ¶
type Mutable interface { Reader // GetBitsPerValue returns the number of bits used to store any given value. // Note: This does not imply that memory usage is bitsPerValue * #values as implementations // are free to use non-space-optimal packing of bits. GetBitsPerValue() int // Set the value at the given index in the array. // index: where the value should be positioned. // value: a value conforming to the constraints set by the array. Set(index int, value uint64) // SetBulk set at least one and at most len longs starting at off in arr into this mutable, // starting at index. Returns the actual number of values that have been set. SetBulk(index int, values []uint64) int // Fill the mutable from fromIndex (inclusive) to toIndex (exclusive) with val. Fill(fromIndex, toIndex int, value uint64) // Clear Sets all values to 0. Clear() // Save this mutable into out. Instantiating a reader from the generated data will return a // reader with the same number of bits per value. Save(ctx context.Context, out store.DataOutput) error GetFormat() Format }
Mutable A packed integer array that can be modified. lucene.internal
func DefaultGetMutable ¶
DefaultGetMutable Create a packed integer array with the given amount of values initialized to 0. the valueCount and the bitsPerValue cannot be changed after creation. All Mutables known by this factory are kept fully in RAM. Positive values of acceptableOverheadRatio will trade space for speed by selecting a faster but potentially less memory-efficient implementation. An acceptableOverheadRatio of COMPACT will make sure that the most memory-efficient implementation is selected whereas FASTEST will make sure that the fastest implementation is selected.
valueCount: the number of elements bitsPerValue: the number of bits available for any given value acceptableOverheadRatio: an acceptable overhead ratio per value
Returns a mutable packed integer array lucene.internal
type NullReader ¶
type NullReader struct {
// contains filtered or unexported fields
}
NullReader A PackedInts.PackedIntsReader which has all its values equal to 0 (bitsPerValue = 0).
func NewNullReader ¶
func NewNullReader(valueCount int) *NullReader
func (*NullReader) Size ¶
func (n *NullReader) Size() int
type Packed16ThreeBlocks ¶
type Packed16ThreeBlocks struct {
// contains filtered or unexported fields
}
Packed16ThreeBlocks Packs integers into 3 shorts (48 bits per value). lucene.internal
func NewPacked16ThreeBlocks ¶
func NewPacked16ThreeBlocks(valueCount int) *Packed16ThreeBlocks
func (*Packed16ThreeBlocks) Clear ¶
func (p *Packed16ThreeBlocks) Clear()
func (*Packed16ThreeBlocks) Fill ¶
func (p *Packed16ThreeBlocks) Fill(fromIndex, toIndex int, value uint64)
func (Packed16ThreeBlocks) GetBitsPerValue ¶
func (m Packed16ThreeBlocks) GetBitsPerValue() int
func (*Packed16ThreeBlocks) GetBulk ¶
func (p *Packed16ThreeBlocks) GetBulk(index int, arr []uint64) int
func (*Packed16ThreeBlocks) GetTest ¶
func (p *Packed16ThreeBlocks) GetTest(index int) uint64
func (*Packed16ThreeBlocks) Set ¶
func (p *Packed16ThreeBlocks) Set(index int, value uint64)
type Packed64 ¶
type Packed64 struct {
// contains filtered or unexported fields
}
func NewPacked64 ¶
NewPacked64 Creates an array with the internal structures adjusted for the given limits and initialized to 0. valueCount: the number of elements. bitsPerValue: the number of bits available for any given value.
func NewPacked64V1 ¶
func NewPacked64V1(ctx context.Context, packedIntsVersion int, in store.DataInput, valueCount, bitsPerValue int) (*Packed64, error)
NewPacked64V1 Creates an array with content retrieved from the given DataInput. in: a DataInput, positioned at the start of Packed64-content. valueCount: the number of elements. bitsPerValue the number of bits available for any given value.
func (Packed64) GetBitsPerValue ¶
func (m Packed64) GetBitsPerValue() int
type Packed64SingleBlock ¶
type Packed64SingleBlock struct {
// contains filtered or unexported fields
}
func NewPacked64SingleBlock ¶
func NewPacked64SingleBlock(valueCount, bitsPerValue int) (*Packed64SingleBlock, error)
func (*Packed64SingleBlock) Clear ¶
func (p *Packed64SingleBlock) Clear()
func (Packed64SingleBlock) GetBitsPerValue ¶
func (m Packed64SingleBlock) GetBitsPerValue() int
func (*Packed64SingleBlock) Set ¶
func (p *Packed64SingleBlock) Set(index int, value uint64)
type Packed8ThreeBlocks ¶
type Packed8ThreeBlocks struct {
// contains filtered or unexported fields
}
Packed8ThreeBlocks Packs integers into 3 bytes (24 bits per value). lucene.internal
func NewPacked8ThreeBlocks ¶
func NewPacked8ThreeBlocks(valueCount int) *Packed8ThreeBlocks
func (*Packed8ThreeBlocks) Clear ¶
func (p *Packed8ThreeBlocks) Clear()
func (*Packed8ThreeBlocks) Fill ¶
func (p *Packed8ThreeBlocks) Fill(fromIndex, toIndex int, value uint64)
func (Packed8ThreeBlocks) GetBitsPerValue ¶
func (m Packed8ThreeBlocks) GetBitsPerValue() int
func (*Packed8ThreeBlocks) GetBulk ¶
func (p *Packed8ThreeBlocks) GetBulk(index int, arr []uint64) int
func (*Packed8ThreeBlocks) GetTest ¶
func (p *Packed8ThreeBlocks) GetTest(index int) uint64
func (*Packed8ThreeBlocks) Set ¶
func (p *Packed8ThreeBlocks) Set(index int, value uint64)
type PackedInts ¶
type PackedInts struct { }
PackedInts Simplistic compression for array of unsigned long values. Each value is >= 0 and <= a specified maximum value. The values are stored as packed ints, with each value consuming a fixed number of bits. lucene.internal
type PackedLongValues ¶
type PackedLongValues struct {
// contains filtered or unexported fields
}
PackedLongValues compress integers into a PackedLongValues instance.
func NewPackedLongValues ¶
func NewPackedLongValues(values []Reader, pageShift int, pageMask uint64, size int) *PackedLongValues
func (*PackedLongValues) Iterator ¶
func (p *PackedLongValues) Iterator() PackedLongValuesIterator
func (*PackedLongValues) Size ¶
func (p *PackedLongValues) Size() int
type PackedLongValuesBuilder ¶
type PackedLongValuesBuilder struct {
// contains filtered or unexported fields
}
func NewPackedLongValuesBuilder ¶
func NewPackedLongValuesBuilder(pageSize int, acceptableOverheadRatio float64) *PackedLongValuesBuilder
func (*PackedLongValuesBuilder) Add ¶
func (p *PackedLongValuesBuilder) Add(value int64) error
Add a new element to this builder.
func (*PackedLongValuesBuilder) Build ¶
func (p *PackedLongValuesBuilder) Build() (*PackedLongValues, error)
func (*PackedLongValuesBuilder) Size ¶
func (p *PackedLongValuesBuilder) Size() int
type PackedWriter ¶
type PackedWriter struct { *BaseWriter // contains filtered or unexported fields }
func NewPackedWriter ¶
func NewPackedWriter(format Format, out store.DataOutput, valueCount, bitsPerValue, mem int) *PackedWriter
func (*PackedWriter) Add ¶
func (p *PackedWriter) Add(v uint64) error
func (*PackedWriter) Finish ¶
func (p *PackedWriter) Finish() error
func (*PackedWriter) GetFormat ¶
func (p *PackedWriter) GetFormat() Format
func (*PackedWriter) Ord ¶
func (p *PackedWriter) Ord() int
type PagedGrowableWriter ¶
type PagedGrowableWriter struct {
// contains filtered or unexported fields
}
PagedGrowableWriter A PagedGrowableWriter. This class slices data into fixed-size blocks which have independent numbers of bits per value and grow on-demand. You should use this class instead of the packedLongValues related ones only when you need random write-access. Otherwise this class will likely be slower and less memory-efficient. lucene.internal
func NewPagedGrowableWriter ¶
func NewPagedGrowableWriter(size, pageSize, startBitsPerValue int, acceptableOverheadRatio float64) (*PagedGrowableWriter, error)
func (PagedGrowableWriter) GetSubMutableByIndex ¶
func (PagedGrowableWriter) Grow ¶
func (a PagedGrowableWriter) Grow(minSize int) PagedMutable
func (PagedGrowableWriter) GrowOne ¶
func (a PagedGrowableWriter) GrowOne() PagedMutable
GrowOne Similar to ArrayUtil.grow(long[]).
func (*PagedGrowableWriter) NewMutable ¶
func (p *PagedGrowableWriter) NewMutable(valueCount, bitsPerValue int) Mutable
func (*PagedGrowableWriter) NewPagedGrowableWriter ¶
func (p *PagedGrowableWriter) NewPagedGrowableWriter(size, pageSize, startBitsPerValue int, acceptableOverheadRatio float64, fillPages bool) (*PagedGrowableWriter, error)
func (*PagedGrowableWriter) NewUnfilledCopy ¶
func (p *PagedGrowableWriter) NewUnfilledCopy(newSize int) (PagedMutable, error)
func (PagedGrowableWriter) Resize ¶
func (a PagedGrowableWriter) Resize(newSize int) PagedMutable
Resize Create a new copy of size newSize based on the content of this buffer. This method is much more efficient than creating a new instance and copying values one by one.
func (PagedGrowableWriter) SetSubMutableByIndex ¶
func (PagedGrowableWriter) SubMutables ¶
func (a PagedGrowableWriter) SubMutables() []Mutable
type PagedMutable ¶
type PagedMutable interface { Get(index int) (uint64, error) GetTest(index int) uint64 Set(index int, value uint64) Resize(newSize int) PagedMutable Grow(minSize int) PagedMutable GrowOne() PagedMutable SubMutables() []Mutable GetSubMutableByIndex(index int) Mutable SetSubMutableByIndex(index int, value Mutable) }
type PagedMutableBuilder ¶
type PagedMutableBuilder interface { NewMutable(valueCount, bitsPerValue int) Mutable NewUnfilledCopy(newSize int) (PagedMutable, error) }
type Reader ¶
type Reader interface { // Get the long at the given index. Behavior is undefined for out-of-range indices. Get(index int) (uint64, error) // GetBulk Bulk get: read at least one and at most len longs starting from index into // arr[off:off+len] and return the actual number of values that have been read. GetBulk(index int, arr []uint64) int // Size Returns: the number of values. Size() int }
Reader A read-only random access array of positive integers. lucene.internal
type ReaderIterator ¶
type ReaderIterator interface { }
ReaderIterator Run-once iterator interface, to decode previously saved PackedInts.
type Writer ¶
type Writer interface { WriteHeader(ctx context.Context) error // GetFormat The format used to serialize values. GetFormat() Format // Add a value to the stream. Add(v uint64) error // BitsPerValue The number of bits per value. BitsPerValue() int // Finish Perform end-of-stream operations. Finish() error // Ord Returns the current ord in the stream (number of values that have been written so far minus one). Ord() int }
Writer A write-once Writer. lucene.internal
type WriterFormat ¶
type WriterFormat interface {
GetFormat() Format
}
Source Files ¶
- abstractblockpackedwriter.go
- blockpacked.go
- bulkoperation.go
- deltapackedlongvalues.go
- direct.go
- directpacked64singleblockreader.go
- directpackedreader.go
- directreader.go
- directwriter.go
- fixsizepagedmutable.go
- format.go
- growablewriter.go
- monotonicblockpacked.go
- monotoniclongvalues.go
- mutable.go
- packed16threeblocks.go
- packed64.go
- packed64singleblock.go
- packed8threeblocks.go
- packedints.go
- packedlongvalues.go
- packedwriter.go
- pagedgrowablewriter.go
- pagedmutable.go
- reader.go
- writer.go