clv

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown uint32 = 0
	Default uint32 = 1
)

dictonary version

View Source
const (
	Stopped    int32 = 0
	Collecting int32 = 1
	Flushing   int32 = 2
)

the status of collector

View Source
const (
	DefaultCap = 16
)
View Source
const (
	DefaultSplitGram = ", '\";=()[]{}?@&<>/:\n\t\r"
)

Variables

View Source
var MaxDocCount uint32 = 500000
View Source
var MaxRetry int32 = 3
View Source
var Qmax = 7
View Source
var TokenThreshold = 100

Functions

func InitConfig

func InitConfig(cfg *config.ClvConfig)

func Tokenizer

func Tokenizer(log []byte) []string

Types

type Analyzer

type Analyzer struct {
	// contains filtered or unexported fields
}

func GetAnalyzer

func GetAnalyzer(path, name, field string, version uint32) (*Analyzer, error)

* return a analyzer by version. * The analyzer's location: path/name/field/MergeSetTable

func (*Analyzer) Analyze

func (a *Analyzer) Analyze(log []byte) ([]VToken, error)

func (*Analyzer) AssignId

func (a *Analyzer) AssignId() error

func (*Analyzer) FindVtokenByID

func (a *Analyzer) FindVtokenByID(id uint32) string

func (*Analyzer) InsertToDictionary

func (a *Analyzer) InsertToDictionary(tokens string)

func (*Analyzer) RegisterCollector

func (a *Analyzer) RegisterCollector(collector Collector)

func (*Analyzer) Version

func (a *Analyzer) Version() uint32

type Collector

type Collector interface {
	Collect(tokens []string)
}

type InvertIndex

type InvertIndex struct {
	// contains filtered or unexported fields
}

func IntersectExprToInvertIndex

func IntersectExprToInvertIndex(ii *InvertIndex, expr influxql.Expr) *InvertIndex

func IntersectInvertByDistance

func IntersectInvertByDistance(pre *InvertIndex, cur *InvertIndex, dis uint16, sids []uint64) *InvertIndex

func IntersectInvertIndexAndExpr

func IntersectInvertIndexAndExpr(li, ri *InvertIndex) *InvertIndex

func IntersectInvertIndexBySlip

func IntersectInvertIndexBySlip(li, ri *InvertIndex) *InvertIndex

func NewInvertIndex

func NewInvertIndex() InvertIndex

func UnionExprToInvertIndex

func UnionExprToInvertIndex(ii *InvertIndex, filter influxql.Expr) *InvertIndex

func UnionInvertIndex

func UnionInvertIndex(lii *InvertIndex, rii *InvertIndex, sids []uint64) *InvertIndex

func UnionInvertIndexAndExpr

func UnionInvertIndexAndExpr(li *InvertIndex, ri *InvertIndex) *InvertIndex

Union's principle: (1) the part of same data, use the union of lexpr and rexpr; (2) only the part of LHS, use the lexpr; (3) only the part of RHS, use the rexpr;

func UnionInvertIndexBySlip

func UnionInvertIndexBySlip(li, ri *InvertIndex) *InvertIndex

func (*InvertIndex) AddId

func (ii *InvertIndex) AddId(id uint32)

func (*InvertIndex) AddInvertState

func (ii *InvertIndex) AddInvertState(sid uint64, is InvertState)

func (*InvertIndex) Append

func (ii *InvertIndex) Append(sid uint64, is []InvertState)

func (*InvertIndex) GetFilter

func (ii *InvertIndex) GetFilter() influxql.Expr

func (*InvertIndex) GetRowFilterBySid

func (ii *InvertIndex) GetRowFilterBySid(sid uint64) []RowFilter

func (*InvertIndex) SetFilter

func (ii *InvertIndex) SetFilter(filter influxql.Expr)

func (*InvertIndex) Sort

func (ii *InvertIndex) Sort(sids []uint64)

type InvertState

type InvertState struct {
	// contains filtered or unexported fields
}

type InvertStates

type InvertStates struct {
	// contains filtered or unexported fields
}

func NewInvertStates

func NewInvertStates() *InvertStates

func NewInvertStatesAndIntersect

func NewInvertStatesAndIntersect(sid uint64, invertState []InvertState, expr influxql.Expr) *InvertStates

func NewInvertStatesAndUion

func NewInvertStatesAndUion(sid uint64, invertState []InvertState, filter influxql.Expr) *InvertStates

func (*InvertStates) GetInvertStateByRowId

func (iss *InvertStates) GetInvertStateByRowId(rowId int64) *InvertState

func (*InvertStates) InvertIsExisted

func (iss *InvertStates) InvertIsExisted(is InvertState) bool

func (*InvertStates) InvertRowIdIsExisted

func (iss *InvertStates) InvertRowIdIsExisted(rowId int64) bool

func (*InvertStates) Len

func (iss *InvertStates) Len() int

Len is the number of elements in the InvertStates.

func (*InvertStates) Less

func (iss *InvertStates) Less(i, j int) bool

i < j. if Less() return false, should call Swap()

func (*InvertStates) Swap

func (iss *InvertStates) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type Logs

type Logs struct {
	// contains filtered or unexported fields
}

type MergerPool

type MergerPool struct {
	// contains filtered or unexported fields
}

func (*MergerPool) Get

func (mp *MergerPool) Get() *merger

func (*MergerPool) Put

func (mp *MergerPool) Put(m *merger)

type Options

type Options struct {
	Path        string
	Measurement string
	Field       string
	Lock        *string
}

type QueryType

type QueryType int
const (
	Match        QueryType = 1
	Match_Phrase QueryType = 2
	Fuzzy        QueryType = 3
)

type RowFilter

type RowFilter struct {
	RowId  int64 // RowId is the timestamp, primary key for timeseries databases.
	Filter influxql.Expr
}

type RowFilters

type RowFilters struct {
	RowFilters [][]RowFilter
}

func NewRowFilters

func NewRowFilters() *RowFilters

func (*RowFilters) Append

func (rfs *RowFilters) Append(rowFilter []RowFilter)

func (*RowFilters) GetRowFilter

func (rfs *RowFilters) GetRowFilter(idx int) *[]RowFilter

func (*RowFilters) Reset

func (rfs *RowFilters) Reset()

func (*RowFilters) Swap

func (rfs *RowFilters) Swap(i, j int)

type SimpleTokenizer

type SimpleTokenizer struct {
	// contains filtered or unexported fields
}

func NewDefaultSimpleTokenzier

func NewDefaultSimpleTokenzier() *SimpleTokenizer

func NewSimpleTokenizer

func NewSimpleTokenizer() *SimpleTokenizer

func (*SimpleTokenizer) Next

func (t *SimpleTokenizer) Next() bool

func (*SimpleTokenizer) SetData

func (t *SimpleTokenizer) SetData(data []byte)

func (*SimpleTokenizer) SetSplitGram

func (t *SimpleTokenizer) SetSplitGram(splitGram string)

init the split-gram-table

func (*SimpleTokenizer) Token

func (t *SimpleTokenizer) Token() []byte

type TokenIndex

type TokenIndex struct {
	// contains filtered or unexported fields
}

func NewTokenIndex

func NewTokenIndex(opts *Options) (*TokenIndex, error)

func (*TokenIndex) AddDocument

func (idx *TokenIndex) AddDocument(log string, sid uint64, rowId int64) error

func (*TokenIndex) Analyse

func (idx *TokenIndex) Analyse() *TrieNode

func (*TokenIndex) Close

func (idx *TokenIndex) Close()

func (*TokenIndex) Flush

func (idx *TokenIndex) Flush()

func (*TokenIndex) Fuzzy

func (idx *TokenIndex) Fuzzy(queryStr string, sids []uint64) (*InvertIndex, error)

func (*TokenIndex) Match

func (idx *TokenIndex) Match(queryStr string, sids []uint64) (*InvertIndex, error)

func (*TokenIndex) MatchPhrase

func (idx *TokenIndex) MatchPhrase(queryStr string, sids []uint64) (*InvertIndex, error)

func (*TokenIndex) Open

func (idx *TokenIndex) Open() error

func (*TokenIndex) Search

func (idx *TokenIndex) Search(t QueryType, queryStr string, sids []uint64) (*InvertIndex, error)

if not found any matched text, need return a empty InvertIndex, not nil InvertIndex.

type TrieNode

type TrieNode struct {
	// contains filtered or unexported fields
}

func NewTrieNode

func NewTrieNode() *TrieNode

type VToken

type VToken struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL