Documentation
¶
Index ¶
- Constants
- type Block
- func (b *Block) GetFreq(index int) uint32
- func (b *Block) GetToken(index int) []byte
- func (b *Block) Len() int
- func (b *Block) LettersBitset() util.LettersBitset
- func (b Block) Pack(dst []byte, buf []uint32) []byte
- func (b *Block) Size() int
- func (b *Block) Unpack(data []byte, fracVer config.BinaryDataVersion, unpackBuf *UnpackBuffer) error
- type BlockLoader
- type FieldData
- type FieldTable
- type Provider
- type Table
- type TableBlock
- type TableEntry
- type TableLoader
- type UnpackBuffer
Constants ¶
View Source
const ( TableEntrySize = unsafe.Sizeof(TableEntry{}) + unsafe.Sizeof(&TableEntry{}) FieldDataSize = unsafe.Sizeof(FieldData{}) + unsafe.Sizeof(&FieldData{}) )
View Source
const CacheKeyTable = 1
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
Payload []byte
Offsets []uint32
FreqIndexes []uint16 // indexes of tokens which have doc freqs (frequencies)
Freqs []uint32 // frequencies of certain tokens (how many docs have this token included at least once)
}
func (*Block) GetFreq ¶ added in v0.75.0
GetFreq returns frequency for a token if stored or 0 otherwise
func (*Block) LettersBitset ¶ added in v0.75.0
func (b *Block) LettersBitset() util.LettersBitset
func (*Block) Unpack ¶
func (b *Block) Unpack(data []byte, fracVer config.BinaryDataVersion, unpackBuf *UnpackBuffer) error
type BlockLoader ¶
type BlockLoader struct {
// contains filtered or unexported fields
}
BlockLoader is responsible for Reading from disk, unpacking and caching tokens blocks. NOT THREAD SAFE. Do not use concurrently. Use your own BlockLoader instance for each search query
func NewBlockLoader ¶
func NewBlockLoader( fracName string, fracVer config.BinaryDataVersion, reader *storage.IndexReader, c *cache.Cache[*Block], ) *BlockLoader
func (*BlockLoader) Load ¶
func (l *BlockLoader) Load(index uint32) *Block
type FieldData ¶
type FieldData struct {
MinVal string
Entries []*TableEntry // expect that TableEntry are necessarily ordered by StartTID here
}
type FieldTable ¶
type FieldTable struct {
Field string
Entries []*TableEntry // expect that TableEntry are necessarily ordered by StartTID here
}
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func NewProvider ¶
func NewProvider(loader *BlockLoader, entries []*TableEntry) *Provider
func (*Provider) FindContains ¶ added in v0.72.0
type Table ¶
func TableFromBlocks ¶
func TableFromBlocks(blocks []TableBlock) Table
func (Table) GetEntryByTID ¶
func (t Table) GetEntryByTID(tid uint32, field string) *TableEntry
func (Table) SelectEntries ¶
func (t Table) SelectEntries(field, hint string) []*TableEntry
SelectEntries returns monotonic and continuous sequence of token table entries
type TableBlock ¶
type TableBlock struct {
FieldsTables []FieldTable
}
TableBlock represents how token.Table is stored on disk
func (TableBlock) Pack ¶
func (b TableBlock) Pack(buf []byte) []byte
func (*TableBlock) Unpack ¶
func (b *TableBlock) Unpack(data []byte, fracVer config.BinaryDataVersion)
type TableEntry ¶
type TableEntry struct {
StartIndex uint32 // offset from the beginning of the block to the first token pointed to by the TableEntry
StartTID uint32 // first TID of TableEntry
BlockIndex uint32 // sequence number of the physical block of tokens in the file
ValCount uint32
MinVal string // only saved for the first entry in block
MaxVal string
Letters util.LettersBitset // case-insensitive English letters present in entry tokens
}
TableEntry is part of token.Table and points to a fragment of token.Block
func (*TableEntry) GetIndexInTokensBlock ¶
func (t *TableEntry) GetIndexInTokensBlock(tid uint32) int
func (*TableEntry) GetLastTID ¶ added in v0.74.0
func (t *TableEntry) GetLastTID() uint32
type TableLoader ¶
type TableLoader struct {
// contains filtered or unexported fields
}
func NewTableLoader ¶
func NewTableLoader( fracName string, fracVer config.BinaryDataVersion, isLegacy bool, reader *storage.IndexReader, c *cache.Cache[Table], ) *TableLoader
func (*TableLoader) Load ¶
func (l *TableLoader) Load() Table
type UnpackBuffer ¶ added in v0.75.0
type UnpackBuffer struct {
// contains filtered or unexported fields
}
func (*UnpackBuffer) Reset ¶ added in v0.75.0
func (b *UnpackBuffer) Reset(fracVer config.BinaryDataVersion)
Click to show internal directories.
Click to hide internal directories.