tsi

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2026 License: Apache-2.0 Imports: 58 Imported by: 1

Documentation

Overview

nolint

Index

Constants

View Source
const (
	SeriesKeyToTSIDCacheName  = "seriesKey_tsid"
	TSIDToSeriesKeyCacheName  = "tsid_seriesKey"
	TSIDToFieldCacheName      = "tsid_field"
	TagKeyToTagValueCacheName = "tagKey_tagValue"
)
View Source
const (
	Mergeset = "mergeset"
	Tmp      = "tmp"
	Txn      = "txn"
)
View Source
const (
	MergeSetDirName        = "mergeset"
	PruneWithSetTagValSize = 10
)
View Source
const (
	DefaultTagsNumPerSeriesKey = 16
)
View Source
const (
	FieldIndexDirName = "field"
)
View Source
const (
	SeriesNumPerTagSetForExcept = 1
)
View Source
const (
	TextDirectory = "text"
)

Variables

View Source
var DefaultTR = TimeRange{Min: 0, Max: math.MaxInt64 - 1}
View Source
var ErrAllFields = errors.New("error all fields")
View Source
var ErrFieldExpr = errors.New("field expr")
View Source
var ErrTextExpr = errors.New("no text expr")
View Source
var IndexKeyPool sync.Pool
View Source
var IndexTagColsPool sync.Pool
View Source
var WriteBufferPool sync.Pool

Functions

func AnalyzeTagSets added in v1.3.0

func AnalyzeTagSets(dstTagSets *tagSets, tags []influx.Tag) error

AnalyzeTagSets eg, inputTags:

{{Key: "tk1", Value: "[tv1,tv11]", IsArray: 0},
{Key: "tk2", Value: "[tv2,tv22]", IsArray: 0},
{Key: "tk3", Value: "[tv3,tv33]", IsArray: 0}}

tagArray:

[[{Key: "tk1", Value: "tv1", IsArray: 0},
{Key: "tk2", Value: "tv2", IsArray: 0},
{Key: "tk3", Value: "tv3", IsArray: 0},]
[{Key: "tk1", Value: "tv11", IsArray: 0},
{Key: "tk2", Value: "tv22", IsArray: 0},
{Key: "tk3", Value: "tv33", IsArray: 0},]]

func CompressKey added in v1.3.0

func CompressKey(src, dst []byte) ([]byte, error)

func FastCheckTagArray added in v1.4.1

func FastCheckTagArray(src []byte) bool

func FieldBuild added in v1.0.0

func FieldBuild(relation *IndexRelation) error

func FieldCacheClear added in v1.2.0

func FieldCacheClear(index interface{}) error

func FieldClose added in v1.0.0

func FieldClose(index interface{}) error

func FieldDelete added in v1.0.0

func FieldDelete(index interface{}, primaryIndex PrimaryIndex, name []byte, condition influxql.Expr, tr TimeRange) error

func FieldFlush added in v1.0.1

func FieldFlush(index interface{})

func FieldInsert added in v1.0.0

func FieldInsert(index interface{}, primaryIndex PrimaryIndex, name []byte, row interface{}) (uint64, error)

func FieldOpen added in v1.0.0

func FieldOpen(index interface{}) error

func FieldScan added in v1.0.0

func FieldScan(index interface{}, primaryIndex PrimaryIndex, span *tracing.Span, name []byte, opt *query.ProcessorOptions, callBack func(num int64) error, groups interface{}) (interface{}, int64, error)

func GenerateUUID

func GenerateUUID() uint64

func GetIndexKeyCache added in v1.2.0

func GetIndexKeyCache() *keyCache

func GetWriteBuffer added in v1.2.0

func GetWriteBuffer() *bytes.Buffer

func LoadCache

func LoadCache(name, cachePath string, sizeBytes int) *workingsetcache.Cache

func MakeGroupTagsKey

func MakeGroupTagsKey(dims []string, tags influx.PointTags, dst []byte) []byte

func MakeGroupTagsKeyByDims added in v1.3.0

func MakeGroupTagsKeyByDims(byDims []string, tags influx.PointTags, dst []byte) []byte

func MakeGroupTagsKeyByWithoutDims added in v1.3.0

func MakeGroupTagsKeyByWithoutDims(withoutDims []string, tags influx.PointTags, dst []byte) []byte

func MergeSetBuild

func MergeSetBuild(relation *IndexRelation) error

indexRelation contains MergeSetIndex meta store IndexBuild

func MergeSetCacheClear added in v1.2.0

func MergeSetCacheClear(index interface{}) error

func MergeSetClose

func MergeSetClose(index interface{}) error

func MergeSetDelete

func MergeSetDelete(index interface{}, primaryIndex PrimaryIndex, name []byte, condition influxql.Expr, tr TimeRange) error

func MergeSetFlush added in v1.0.1

func MergeSetFlush(index interface{})

func MergeSetInsert

func MergeSetInsert(index interface{}, primaryIndex PrimaryIndex, name []byte, row interface{}) (uint64, error)

func MergeSetOpen

func MergeSetOpen(index interface{}) error

func MergeSetScan

func MergeSetScan(index interface{}, primaryIndex PrimaryIndex, span *tracing.Span, name []byte, opt *query.ProcessorOptions, callBack func(num int64) error, _ interface{}) (interface{}, int64, error)

upper function call should analyze result

func NewFieldIndex added in v1.0.0

func NewFieldIndex(opts *Options) (*fieldIndex, error)

func NewTagKeyReflection

func NewTagKeyReflection(src, curr []string) *tagKeyReflection

func NewTagSetPool

func NewTagSetPool() *tagSetInfoPool

func ParseItem added in v1.5.0

func ParseItem(item []byte) (res *util.Item, err error)

func PutIndexKeyCache added in v1.2.0

func PutIndexKeyCache(key *keyCache)

func PutIndexTagCols added in v1.1.0

func PutIndexTagCols(tagCols *IndexTagCols)

func PutWriteBuffer added in v1.2.0

func PutWriteBuffer(buf *bytes.Buffer)

func TextBuild

func TextBuild(relation *IndexRelation) error

func TextCacheClear added in v1.2.0

func TextCacheClear(index interface{}) error

func TextClose

func TextClose(index interface{}) error

func TextDelete

func TextDelete(index interface{}, primaryIndex PrimaryIndex, name []byte, condition influxql.Expr, tr TimeRange) error

func TextFlush added in v1.1.0

func TextFlush(index interface{})

func TextInsert

func TextInsert(index interface{}, primaryIndex PrimaryIndex, name []byte, row interface{}) (uint64, error)

func TextOpen

func TextOpen(index interface{}) error

func TextScan

func TextScan(index interface{}, primaryIndex PrimaryIndex, span *tracing.Span, name []byte, opt *query.ProcessorOptions, callBack func(num int64) error, groups interface{}) (interface{}, int64, error)

upper function call should analyze result

func UnMarshalTSIDs added in v1.3.0

func UnMarshalTSIDs(dst []uint64, src []byte) ([]uint64, error)

Types

type CsIndexImpl added in v1.1.0

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

func (*CsIndexImpl) CreateIndexIfNotExistsByCol added in v1.2.0

func (csIdx *CsIndexImpl) CreateIndexIfNotExistsByCol(idx *MergeSetIndex, col *TagCol) error

func (*CsIndexImpl) CreateIndexIfNotExistsByRow added in v1.1.0

func (csIdx *CsIndexImpl) CreateIndexIfNotExistsByRow(idx *MergeSetIndex, row *influx.Row) error

func (*CsIndexImpl) SearchTagValues added in v1.1.0

func (csIdx *CsIndexImpl) SearchTagValues(name []byte, tagKeys [][]byte, condition influxql.Expr, is *indexSearch) ([][]string, error)

type DumpInfo

type DumpInfo struct {
	ShowTagKeys        bool
	ShowTagValues      bool
	ShowTagValueSeries bool
	MeasurementFilter  *regexp.Regexp
	TagKeyFilter       *regexp.Regexp
	TagValueFilter     *regexp.Regexp
}

type GroupSeries

type GroupSeries []TagSetEx

func (GroupSeries) Len

func (gs GroupSeries) Len() int

func (GroupSeries) Less

func (gs GroupSeries) Less(i, j int) bool

func (GroupSeries) Reverse

func (gs GroupSeries) Reverse()

func (GroupSeries) SeriesCnt

func (gs GroupSeries) SeriesCnt() int

func (GroupSeries) Swap

func (gs GroupSeries) Swap(i, j int)

type Index

type Index interface {
	CreateIndexIfNotExists(mmRows dictmap.DictMap[string, *[]influx.Row]) error
	GetSeriesIdBySeriesKey(key []byte) (uint64, error)
	SearchSeries(series [][]byte, name []byte, condition influxql.Expr, tr TimeRange) ([][]byte, error)
	SearchSeriesWithOpts(span *tracing.Span, name []byte, opt *query.ProcessorOptions, callBack func(num int64) error, _ interface{}) (GroupSeries, int64, error)
	SeriesCardinality(name []byte, condition influxql.Expr, tr TimeRange) (uint64, error)
	SearchSeriesKeys(series [][]byte, name []byte, condition influxql.Expr) ([][]byte, error)
	SearchSeriesByTableAndCond(name []byte, expr influxql.Expr, tr TimeRange) ([]uint64, error)
	SearchTagValues(name []byte, tagKeys [][]byte, condition influxql.Expr) ([][]string, error)
	SearchTagValuesCardinality(name, tagKey []byte) (uint64, error)
	GetSeries(sid uint64, buf []byte, condition influxql.Expr, callback func(key *influx.SeriesKey)) error

	// search
	GetPrimaryKeys(name []byte, opt *query.ProcessorOptions) ([]uint64, error)
	// delete
	GetDeletePrimaryKeys(name []byte, condition influxql.Expr, tr TimeRange) ([]uint64, error)

	SetIndexBuilder(builder *IndexBuilder)

	DeleteTSIDs(name []byte, condition influxql.Expr, tr TimeRange) error
	LoadDeletedTSIDs() error

	Path() string

	DebugFlush()
	Open() error
	Close() error
}

func NewIndex

func NewIndex(opts *Options) (Index, error)

type IndexAmRoutine

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

func FieldIndexHandler added in v1.0.0

func FieldIndexHandler(opt *Options, primaryIndex PrimaryIndex) (*IndexAmRoutine, error)

func MergeSetIndexHandler

func MergeSetIndexHandler(opt *Options, primaryIndex PrimaryIndex) (*IndexAmRoutine, error)

func TextIndexHandler

func TextIndexHandler(opt *Options, primaryIndex PrimaryIndex) (*IndexAmRoutine, error)

type IndexBuilder

type IndexBuilder struct {
	Relations []*IndexRelation // <oid, indexRelation>

	EnableTagArray bool

	ObsOpt *obs.ObsOptions

	MoveIndexStartTime time.Time
	Tier               uint64
	IndexColdDuration  time.Duration
	// contains filtered or unexported fields
}

IndexBuilder is a collection of all indexes

func NewIndexBuilder

func NewIndexBuilder(opt *Options) *IndexBuilder

func (*IndexBuilder) ClearCache added in v1.2.0

func (iBuilder *IndexBuilder) ClearCache() error

func (*IndexBuilder) Close

func (iBuilder *IndexBuilder) Close() error

func (*IndexBuilder) CreateIndexIfNotExists

func (iBuilder *IndexBuilder) CreateIndexIfNotExists(mmRows dictmap.DictMap[string, *[]influx.Row], needSecondaryIndex bool) error

func (*IndexBuilder) CreateIndexIfNotExistsByCol added in v1.2.0

func (iBuilder *IndexBuilder) CreateIndexIfNotExistsByCol(rec *record.Record, tagIndex []int, mst string) error

func (*IndexBuilder) CreateSecondaryIndexIfNotExist added in v1.0.1

func (iBuilder *IndexBuilder) CreateSecondaryIndexIfNotExist(mmRows dictmap.DictMap[string, *[]influx.Row]) error

func (*IndexBuilder) Delete

func (iBuilder *IndexBuilder) Delete(name []byte, condition influxql.Expr, tr TimeRange) error

func (*IndexBuilder) DeleteMsts added in v1.5.0

func (iBuilder *IndexBuilder) DeleteMsts(msts []string, onlyUseDiskThreshold uint64) error

func (*IndexBuilder) DropSeries added in v1.5.0

func (iBuilder *IndexBuilder) DropSeries() error

func (*IndexBuilder) ExecIndexMove added in v1.5.0

func (iBuilder *IndexBuilder) ExecIndexMove() error

func (*IndexBuilder) Expired

func (iBuilder *IndexBuilder) Expired() bool

func (*IndexBuilder) ExpiredCache added in v1.2.0

func (iBuilder *IndexBuilder) ExpiredCache() bool

func (*IndexBuilder) Flush

func (iBuilder *IndexBuilder) Flush()

func (*IndexBuilder) GenerateUUID added in v1.0.0

func (iBuilder *IndexBuilder) GenerateUUID() uint64

func (*IndexBuilder) GetDuration

func (iBuilder *IndexBuilder) GetDuration() time.Duration

func (*IndexBuilder) GetEndTime

func (iBuilder *IndexBuilder) GetEndTime() time.Time

func (*IndexBuilder) GetIndexID

func (iBuilder *IndexBuilder) GetIndexID() uint64

func (*IndexBuilder) GetPrimaryIndex

func (iBuilder *IndexBuilder) GetPrimaryIndex() PrimaryIndex

func (*IndexBuilder) GetTier added in v1.5.0

func (iBuilder *IndexBuilder) GetTier() (tier uint64)

func (*IndexBuilder) Ident

func (iBuilder *IndexBuilder) Ident() *meta.IndexIdentifier

func (*IndexBuilder) IsTierExpired added in v1.5.0

func (iBuilder *IndexBuilder) IsTierExpired() bool

func (*IndexBuilder) Open

func (iBuilder *IndexBuilder) Open() error

func (*IndexBuilder) Overlaps added in v1.1.0

func (iBuilder *IndexBuilder) Overlaps(tr influxql.TimeRange) bool

func (*IndexBuilder) Path

func (iBuilder *IndexBuilder) Path() string

func (*IndexBuilder) RPName

func (iBuilder *IndexBuilder) RPName() string

func (*IndexBuilder) ReplaceByNoClearIndexId added in v1.5.0

func (iBuilder *IndexBuilder) ReplaceByNoClearIndexId(noClearIndex uint64) (string, *string, error)

func (*IndexBuilder) Scan

func (iBuilder *IndexBuilder) Scan(span *tracing.Span, name []byte, opt *query.ProcessorOptions, callBack func(num int64) error) (interface{}, int64, error)

func (*IndexBuilder) SeriesLimited added in v1.1.0

func (iBuilder *IndexBuilder) SeriesLimited() error

func (*IndexBuilder) SetDuration

func (iBuilder *IndexBuilder) SetDuration(duration time.Duration)

func (*IndexBuilder) SetMergeDuration added in v1.5.0

func (iBuilder *IndexBuilder) SetMergeDuration(duration time.Duration)

func (*IndexBuilder) SetPath added in v1.3.0

func (iBuilder *IndexBuilder) SetPath(path string)

func (*IndexBuilder) SetSeriesLimiter added in v1.1.0

func (iBuilder *IndexBuilder) SetSeriesLimiter(limiter func() error)

type IndexCache

type IndexCache struct {
	// series key -> TSID.
	SeriesKeyToTSIDCache *workingsetcache.Cache

	// TSID -> series key
	TSIDToSeriesKeyCache *workingsetcache.Cache

	// Cache for TagKeys -> TagValues
	TagKeyValueCache *workingsetcache.Cache

	// Cache for tagFilter->cost
	TagFilterCostCache *workingsetcache.Cache
	// contains filtered or unexported fields
}

func (*IndexCache) GetTSIDFromTSIDCache

func (ic *IndexCache) GetTSIDFromTSIDCache(id *uint64, key []byte) (bool, error)

func (*IndexCache) PutTSIDToTSIDCache

func (ic *IndexCache) PutTSIDToTSIDCache(id *uint64, key []byte) error

func (*IndexCache) PutTagValuesToTagKeysCache added in v1.1.0

func (ic *IndexCache) PutTagValuesToTagKeysCache(value []byte, key []byte)

type IndexRecord added in v1.1.0

type IndexRecord struct {
	TagCol *TagCol
	Err    error
}

type IndexRelation

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

IndexRelation define functions of a specific index

func NewIndexRelation

func NewIndexRelation(opt *Options, primaryIndex PrimaryIndex, iBuilder *IndexBuilder) (*IndexRelation, error)

func (*IndexRelation) IndexBuild

func (relation *IndexRelation) IndexBuild(name []byte, indexMap map[string]int) error

func (*IndexRelation) IndexCacheClear added in v1.2.0

func (relation *IndexRelation) IndexCacheClear() error

func (*IndexRelation) IndexClose

func (relation *IndexRelation) IndexClose() error

func (*IndexRelation) IndexDelete

func (relation *IndexRelation) IndexDelete(name []byte, condition influxql.Expr, tr TimeRange) error

func (*IndexRelation) IndexFlush added in v1.0.1

func (relation *IndexRelation) IndexFlush()

func (*IndexRelation) IndexInsert

func (relation *IndexRelation) IndexInsert(name []byte, point interface{}) error

func (*IndexRelation) IndexOpen

func (relation *IndexRelation) IndexOpen() error

func (*IndexRelation) IndexRelation

func (relation *IndexRelation) IndexRelation(oid1 int, oid2 int, result1 interface{}, result2 interface{}) (interface{}, error)

func (*IndexRelation) IndexScan

func (relation *IndexRelation) IndexScan(span *tracing.Span, name []byte, opt *query.ProcessorOptions, groups interface{}, callBack func(num int64) error) (interface{}, int64, error)

type IndexTagCols added in v1.1.0

type IndexTagCols []TagCol

func GetIndexTagCols added in v1.1.0

func GetIndexTagCols(num int) *IndexTagCols

type MergeSetIndex

type MergeSetIndex struct {
	StorageIndex StorageIndex
	// contains filtered or unexported fields
}

func NewMergeSetIndex

func NewMergeSetIndex(opts *Options) (*MergeSetIndex, error)

func (*MergeSetIndex) AddNewSeriesKey added in v1.3.0

func (idx *MergeSetIndex) AddNewSeriesKey(key []byte)

func (*MergeSetIndex) CheckSeriesKeyExist added in v1.3.0

func (idx *MergeSetIndex) CheckSeriesKeyExist(key []byte) bool

func (*MergeSetIndex) ClearCache added in v1.2.0

func (idx *MergeSetIndex) ClearCache() error

func (*MergeSetIndex) Close

func (idx *MergeSetIndex) Close() error

func (*MergeSetIndex) CreateIndexIfNotExists

func (idx *MergeSetIndex) CreateIndexIfNotExists(mmRows dictmap.DictMap[string, *[]influx.Row]) error

func (*MergeSetIndex) CreateIndexIfNotExistsByRow

func (idx *MergeSetIndex) CreateIndexIfNotExistsByRow(row *influx.Row) (uint64, error)

for row with no tags, eg: insert foo foo.bar.baz=1 use old path

func (*MergeSetIndex) CreateIndexIfNotExistsBySeries added in v1.4.0

func (idx *MergeSetIndex) CreateIndexIfNotExistsBySeries(mst []byte, key []byte, tags influx.PointTags) (uint64, error)

func (*MergeSetIndex) DebugFlush

func (idx *MergeSetIndex) DebugFlush()

func (*MergeSetIndex) DeleteMergeSet added in v1.5.0

func (idx *MergeSetIndex) DeleteMergeSet() *MergeSetIndex

func (*MergeSetIndex) DeleteTSIDs

func (idx *MergeSetIndex) DeleteTSIDs(name []byte, condition influxql.Expr, tr TimeRange) error

func (*MergeSetIndex) DumpMeasurements

func (idx *MergeSetIndex) DumpMeasurements(tw *tabwriter.Writer, dumpInfo *DumpInfo) error

func (*MergeSetIndex) DumpSeries

func (idx *MergeSetIndex) DumpSeries(tw *tabwriter.Writer) error

func (*MergeSetIndex) EnabledTagArray added in v1.3.0

func (idx *MergeSetIndex) EnabledTagArray() bool

func (*MergeSetIndex) GetDeletePrimaryKeys

func (idx *MergeSetIndex) GetDeletePrimaryKeys(name []byte, condition influxql.Expr, tr TimeRange) ([]uint64, error)

func (*MergeSetIndex) GetDeletedTSIDs added in v1.5.0

func (idx *MergeSetIndex) GetDeletedTSIDs() *uint64set.Set

func (*MergeSetIndex) GetPrimaryKeys

func (idx *MergeSetIndex) GetPrimaryKeys(name []byte, opt *query.ProcessorOptions) ([]uint64, error)

func (*MergeSetIndex) GetSeries added in v1.3.0

func (idx *MergeSetIndex) GetSeries(sid uint64, buf []byte, condition influxql.Expr, callback func(key *influx.SeriesKey)) error

func (*MergeSetIndex) GetSeriesBytes added in v1.4.0

func (idx *MergeSetIndex) GetSeriesBytes(sid uint64, buf []byte, condition influxql.Expr, callback func(key *influx.SeriesBytes)) error

func (*MergeSetIndex) GetSeriesIdBySeriesKey

func (idx *MergeSetIndex) GetSeriesIdBySeriesKey(seriesKey []byte) (uint64, error)

func (*MergeSetIndex) GetSeriesIdBySeriesKeyFromCache added in v1.4.0

func (idx *MergeSetIndex) GetSeriesIdBySeriesKeyFromCache(seriesKey []byte) (uint64, error)

func (*MergeSetIndex) HasDeletedTSID added in v1.5.0

func (idx *MergeSetIndex) HasDeletedTSID(tsid uint64) bool

func (*MergeSetIndex) IsTagKeyExist added in v1.1.0

func (idx *MergeSetIndex) IsTagKeyExist(row influx.Row) (bool, error)

func (*MergeSetIndex) IsTagKeyExistByArrowFlight added in v1.1.0

func (idx *MergeSetIndex) IsTagKeyExistByArrowFlight(col *TagCol) (bool, error)

func (*MergeSetIndex) LoadDeletedTSIDs added in v1.5.0

func (idx *MergeSetIndex) LoadDeletedTSIDs() error

LoadDeletedTSIDs Only called by delIndex when powered on or clear index

func (*MergeSetIndex) Open

func (idx *MergeSetIndex) Open() error

func (*MergeSetIndex) Path

func (idx *MergeSetIndex) Path() string

func (*MergeSetIndex) RemoveDeletedPart added in v1.5.0

func (idx *MergeSetIndex) RemoveDeletedPart()

func (*MergeSetIndex) RpName added in v1.5.0

func (idx *MergeSetIndex) RpName() string

func (*MergeSetIndex) SearchSeries

func (idx *MergeSetIndex) SearchSeries(series [][]byte, name []byte, condition influxql.Expr, tr TimeRange) ([][]byte, error)

func (*MergeSetIndex) SearchSeriesByTableAndCond added in v1.5.0

func (idx *MergeSetIndex) SearchSeriesByTableAndCond(name []byte, expr influxql.Expr, tr TimeRange) ([]uint64, error)

func (*MergeSetIndex) SearchSeriesIterator added in v1.0.0

func (idx *MergeSetIndex) SearchSeriesIterator(span *tracing.Span, name []byte, opt *query.ProcessorOptions) (index.SeriesIDIterator, error)

func (*MergeSetIndex) SearchSeriesKeys

func (idx *MergeSetIndex) SearchSeriesKeys(series [][]byte, name []byte, condition influxql.Expr) ([][]byte, error)

func (*MergeSetIndex) SearchSeriesWithOpts

func (idx *MergeSetIndex) SearchSeriesWithOpts(span *tracing.Span, name []byte, opt *query.ProcessorOptions, callBack func(num int64) error, _ interface{}) (GroupSeries, int64, error)

func (*MergeSetIndex) SearchTagValues

func (idx *MergeSetIndex) SearchTagValues(name []byte, tagKeys [][]byte, condition influxql.Expr) ([][]string, error)

func (*MergeSetIndex) SearchTagValuesCardinality

func (idx *MergeSetIndex) SearchTagValuesCardinality(name, tagKey []byte) (uint64, error)

func (*MergeSetIndex) SeriesCardinality

func (idx *MergeSetIndex) SeriesCardinality(name []byte, condition influxql.Expr, tr TimeRange) (uint64, error)

func (*MergeSetIndex) SeriesGroup2Map added in v1.3.0

func (idx *MergeSetIndex) SeriesGroup2Map(seriesNum int64, querySeriesUpperBound int, itr index.SeriesIDIterator, opt *query.ProcessorOptions, name []byte) (map[string]TagSetEx, []TagSetEx, int64, int, error)

func (*MergeSetIndex) SeriesGroup2MapOfProm added in v1.3.0

func (idx *MergeSetIndex) SeriesGroup2MapOfProm(seriesNum int64, querySeriesUpperBound int, itr index.SeriesIDIterator, opt *query.ProcessorOptions, name []byte) (map[string]TagSetEx, []TagSetEx, int64, int, error)

func (*MergeSetIndex) SetDeleteMergeSet added in v1.5.0

func (idx *MergeSetIndex) SetDeleteMergeSet(deleteMergeSet *MergeSetIndex)

func (*MergeSetIndex) SetIndexBuilder

func (idx *MergeSetIndex) SetIndexBuilder(builder *IndexBuilder)

func (*MergeSetIndex) SetLabelForDeletePart added in v1.5.0

func (idx *MergeSetIndex) SetLabelForDeletePart()

func (*MergeSetIndex) WriteDeleteTsids added in v1.5.0

func (idx *MergeSetIndex) WriteDeleteTsids(tsids []uint64) error

func (*MergeSetIndex) WriteRow added in v0.2.0

func (idx *MergeSetIndex) WriteRow(row *indexRow)

func (*MergeSetIndex) WriteTagCols added in v1.1.0

func (idx *MergeSetIndex) WriteTagCols(tagCol *TagCol)

type Options

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

func (*Options) CacheDuration added in v1.2.0

func (opts *Options) CacheDuration(cacheDuration time.Duration) *Options

func (*Options) Duration

func (opts *Options) Duration(duration time.Duration) *Options

func (*Options) EndTime

func (opts *Options) EndTime(endTime time.Time) *Options

func (*Options) EngineType added in v1.1.0

func (opts *Options) EngineType(engineType config.EngineType) *Options

func (*Options) Ident

func (opts *Options) Ident(ident *meta.IndexIdentifier) *Options

func (*Options) IndexType

func (opts *Options) IndexType(indexType index.IndexType) *Options

func (*Options) Lock added in v1.0.0

func (opts *Options) Lock(lock *string) *Options

func (*Options) LogicalClock added in v1.0.0

func (opts *Options) LogicalClock(clock uint64) *Options

func (*Options) MergeDuration added in v1.5.0

func (opts *Options) MergeDuration(duration time.Duration) *Options

func (*Options) ObsOpt added in v1.5.0

func (opts *Options) ObsOpt(obsOpt *obs.ObsOptions) *Options

func (*Options) OpId added in v1.0.0

func (opts *Options) OpId(opId uint64) *Options

func (*Options) Path

func (opts *Options) Path(path string) *Options

func (*Options) SequenceId added in v1.0.0

func (opts *Options) SequenceId(id *uint64) *Options

func (*Options) StartTime added in v1.1.0

func (opts *Options) StartTime(startTime time.Time) *Options

type PrimaryIndex

type PrimaryIndex interface {
	CreateIndexIfNotExists(mmRows dictmap.DictMap[string, *[]influx.Row]) error
	GetPrimaryKeys(name []byte, opt *query.ProcessorOptions) ([]uint64, error)
	GetDeletePrimaryKeys(name []byte, condition influxql.Expr, tr TimeRange) ([]uint64, error)
	SearchSeriesWithOpts(span *tracing.Span, name []byte, opt *query.ProcessorOptions, callBack func(num int64) error, _ interface{}) (GroupSeries, int64, error)
	SearchSeriesByTableAndCond(name []byte, expr influxql.Expr, tr TimeRange) ([]uint64, error)
	Path() string
}

type PruneContext added in v1.4.0

type PruneContext struct {
	SeriesKey  []byte
	SeriesKeys [][]byte
	Ids        []uint64
	// contains filtered or unexported fields
}

func (*PruneContext) Instance added in v1.4.1

func (ctx *PruneContext) Instance() *PruneContext

func (*PruneContext) MemSize added in v1.4.0

func (ctx *PruneContext) MemSize() int

type SortGroupSeries added in v1.0.0

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

func NewSortGroupSeries added in v1.0.0

func NewSortGroupSeries(groupSeries []TagSetEx, ascending bool) *SortGroupSeries

func (SortGroupSeries) Len added in v1.0.0

func (s SortGroupSeries) Len() int

func (SortGroupSeries) Less added in v1.0.0

func (s SortGroupSeries) Less(i, j int) bool

func (SortGroupSeries) Swap added in v1.0.0

func (s SortGroupSeries) Swap(i, j int)

type StorageIndex added in v1.1.0

type StorageIndex interface {
	SearchTagValues(name []byte, tagKeys [][]byte, condition influxql.Expr, is *indexSearch) ([][]string, error)
	// contains filtered or unexported methods
}

type Tag

type Tag struct {
	Key   []byte // Tag key bytes
	Value []byte // Tag value bytes
}

Tag represents a (key, value) tag for metric.

func (*Tag) Equal

func (tag *Tag) Equal(other *Tag) bool

Equal checks if two tags are identical in both key and value.

func (*Tag) Marshal

func (tag *Tag) Marshal(dst []byte) []byte

Marshal appends the marshaled tag (key + value) to the destination buffer.

func (*Tag) Reset

func (tag *Tag) Reset()

Reset clears the tag's key and value while retaining underlying memory.

func (*Tag) Unmarshal

func (tag *Tag) Unmarshal(src []byte) ([]byte, error)

Unmarshal parses a tag from the source buffer, updating the tag's key and value. Returns the remaining unparsed bytes and any error encountered.

type TagCol added in v1.1.0

type TagCol struct {
	Wg       *sync.WaitGroup
	Val      []byte
	Mst, Key []byte
	Err      error
}

type TagFilters

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

func (*TagFilters) Reset

func (tfs *TagFilters) Reset()

Reset resets the tf

type TagSet added in v1.4.0

type TagSet interface {
	Ref()
	Unref()
	Len() int
	Less(i, j int) bool
	Swap(i, j int)
	GetSid(int, int) uint64
	GetShardId(int, int) uint64
	GetShardNum(int) int
	GetSeriesKeys(int) []byte
	GetFilters(int) influxql.Expr
	GetKey() []byte
	GetTagsVec(int) *influx.PointTags
	GetRowFilter(int) *[]clv.RowFilter
}

type TagSetEx added in v1.5.0

type TagSetEx interface {
	TagSet
	Cut(idx int)
	GetTagSetItem(int) *TagSetInfoItem
	SetKey([]byte)
	AppendKey(...byte)
	Append(uint64, []byte, influxql.Expr, influx.PointTags, []clv.RowFilter)
	AppendWithOpt(uint64, []byte, influxql.Expr, influx.PointTags, []clv.RowFilter, *query.ProcessorOptions)
	GetTagsWithQuerySchema(i int, schema *executor.QuerySchema) *influx.PointTags
	Sort(schema *executor.QuerySchema)
	TagSetItems() []TagSetInfoItem
}

type TagSetInfo

type TagSetInfo struct {
	TagSetInfoItems []TagSetInfoItem

	RowFilters *clv.RowFilters // only uesed in full-text index for row filtering
	// contains filtered or unexported fields
}

func NewSingleTagSetInfo added in v1.0.0

func NewSingleTagSetInfo() *TagSetInfo

func NewTagSetInfo

func NewTagSetInfo() *TagSetInfo

func (*TagSetInfo) Append

func (t *TagSetInfo) Append(id uint64, seriesKey []byte, filter influxql.Expr, tags influx.PointTags, rowFilter []clv.RowFilter)

func (*TagSetInfo) AppendKey added in v1.5.0

func (t *TagSetInfo) AppendKey(key ...byte)

func (*TagSetInfo) AppendWithOpt added in v1.3.0

func (t *TagSetInfo) AppendWithOpt(id uint64, seriesKey []byte, filter influxql.Expr, tags influx.PointTags,
	rowFilter []clv.RowFilter, opt *query.ProcessorOptions)

func (*TagSetInfo) Cut added in v1.3.0

func (t *TagSetInfo) Cut(idx int)

func (*TagSetInfo) GetFilters added in v1.4.0

func (t *TagSetInfo) GetFilters(sidIdx int) influxql.Expr

func (*TagSetInfo) GetKey added in v1.4.0

func (t *TagSetInfo) GetKey() []byte

func (*TagSetInfo) GetRowFilter added in v1.1.0

func (t *TagSetInfo) GetRowFilter(idx int) *[]clv.RowFilter

func (*TagSetInfo) GetSeriesKeys added in v1.4.0

func (t *TagSetInfo) GetSeriesKeys(sidIdx int) []byte

func (*TagSetInfo) GetShardId added in v1.4.0

func (t *TagSetInfo) GetShardId(_, _ int) uint64

func (*TagSetInfo) GetShardNum added in v1.4.0

func (t *TagSetInfo) GetShardNum(_ int) int

func (*TagSetInfo) GetSid added in v1.4.0

func (t *TagSetInfo) GetSid(sidIdx, _ int) uint64

func (*TagSetInfo) GetTagSetItem added in v1.5.0

func (t *TagSetInfo) GetTagSetItem(idx int) *TagSetInfoItem

func (*TagSetInfo) GetTagsVec added in v1.4.0

func (t *TagSetInfo) GetTagsVec(sidIdx int) *influx.PointTags

func (*TagSetInfo) GetTagsWithQuerySchema added in v1.3.0

func (t *TagSetInfo) GetTagsWithQuerySchema(i int, s *executor.QuerySchema) *influx.PointTags

func (*TagSetInfo) Len

func (t *TagSetInfo) Len() int

func (*TagSetInfo) Less

func (t *TagSetInfo) Less(i, j int) bool

func (*TagSetInfo) Ref

func (t *TagSetInfo) Ref()

func (*TagSetInfo) SetKey added in v1.5.0

func (t *TagSetInfo) SetKey(key []byte)

func (*TagSetInfo) Sort added in v1.0.0

func (t *TagSetInfo) Sort(schema *executor.QuerySchema)

func (*TagSetInfo) String

func (t *TagSetInfo) String() string

func (*TagSetInfo) Swap

func (t *TagSetInfo) Swap(i, j int)

func (*TagSetInfo) TagSetItems added in v1.5.0

func (t *TagSetInfo) TagSetItems() []TagSetInfoItem

func (*TagSetInfo) Unref

func (t *TagSetInfo) Unref()

type TagSetInfoItem added in v1.5.0

type TagSetInfoItem struct {
	ID        uint64
	Filter    influxql.Expr
	SeriesKey []byte           // encoded series key
	TagsVec   influx.PointTags // tags of series
}

type TagSetMergeInfo added in v1.4.0

type TagSetMergeInfo struct {
	ShardIds   [][]uint64
	IDs        [][]uint64
	Filters    []influxql.Expr
	SeriesKeys [][]byte           // encoded series key
	TagsVec    []influx.PointTags // tags of all series

	RowFilters *clv.RowFilters // uesed in full-text index for row filtering
	// contains filtered or unexported fields
}

func ExtendMergeTagSetInfos added in v1.4.0

func ExtendMergeTagSetInfos(ts []*TagSetMergeInfo, shardId uint64) []*TagSetMergeInfo

func SortMergeTagSetInfos added in v1.4.0

func SortMergeTagSetInfos(t1 []*TagSetMergeInfo, t2 []TagSetEx, shardId uint64, shardNum int) []*TagSetMergeInfo

func TransTagSet2Merged added in v1.4.0

func TransTagSet2Merged(t1 TagSetEx, shardId uint64, shardNum int) *TagSetMergeInfo

func (*TagSetMergeInfo) GetFilters added in v1.4.0

func (t *TagSetMergeInfo) GetFilters(sidIdx int) influxql.Expr

func (*TagSetMergeInfo) GetKey added in v1.4.0

func (t *TagSetMergeInfo) GetKey() []byte

func (*TagSetMergeInfo) GetRowFilter added in v1.4.0

func (t *TagSetMergeInfo) GetRowFilter(idx int) *[]clv.RowFilter

func (*TagSetMergeInfo) GetSeriesKeys added in v1.4.0

func (t *TagSetMergeInfo) GetSeriesKeys(sidIdx int) []byte

func (*TagSetMergeInfo) GetShardId added in v1.4.0

func (t *TagSetMergeInfo) GetShardId(sidIdx, shardIdx int) uint64

func (*TagSetMergeInfo) GetShardNum added in v1.4.0

func (t *TagSetMergeInfo) GetShardNum(sidIdx int) int

func (*TagSetMergeInfo) GetSid added in v1.4.0

func (t *TagSetMergeInfo) GetSid(sidIdx, shardIdx int) uint64

func (*TagSetMergeInfo) GetTagsVec added in v1.4.0

func (t *TagSetMergeInfo) GetTagsVec(sidIdx int) *influx.PointTags

func (*TagSetMergeInfo) Len added in v1.4.0

func (t *TagSetMergeInfo) Len() int

func (*TagSetMergeInfo) Less added in v1.4.0

func (t *TagSetMergeInfo) Less(i, j int) bool

func (*TagSetMergeInfo) Ref added in v1.4.0

func (t *TagSetMergeInfo) Ref()

func (*TagSetMergeInfo) Swap added in v1.4.0

func (t *TagSetMergeInfo) Swap(i, j int)

func (*TagSetMergeInfo) Unref added in v1.4.0

func (t *TagSetMergeInfo) Unref()

type TagSetsPool added in v1.0.0

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

func (*TagSetsPool) Get added in v1.0.0

func (pool *TagSetsPool) Get() *tagSets

func (*TagSetsPool) Put added in v1.0.0

func (pool *TagSetsPool) Put(tags *tagSets)

type TextIndex

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

func NewTextIndex

func NewTextIndex(opts *Options) (*TextIndex, error)

func (*TextIndex) Close

func (idx *TextIndex) Close() error

func (*TextIndex) CreateIndexIfNotExists

func (idx *TextIndex) CreateIndexIfNotExists(primaryIndex PrimaryIndex, row *influx.Row) (uint64, error)

func (*TextIndex) Delete

func (idx *TextIndex) Delete(primaryIndex PrimaryIndex, name []byte, condition influxql.Expr, tr TimeRange) error

func (*TextIndex) Flush added in v1.1.0

func (idx *TextIndex) Flush()

func (*TextIndex) NewTokenIndex added in v1.1.0

func (idx *TextIndex) NewTokenIndex(idxPath, measurement, field string) error

func (*TextIndex) Open

func (idx *TextIndex) Open() error

func (*TextIndex) Search

func (idx *TextIndex) Search(primaryIndex PrimaryIndex, span *tracing.Span, name []byte, opt *query.ProcessorOptions, groups interface{}) (GroupSeries, error)

func (*TextIndex) SearchByTokenIndex added in v1.1.0

func (idx *TextIndex) SearchByTokenIndex(name string, sids []uint64, n *influxql.BinaryExpr) (*clv.InvertIndex, error)

func (*TextIndex) SearchTextIndex added in v1.1.0

func (idx *TextIndex) SearchTextIndex(name []byte, srcSet TagSetEx, ids []uint64) (TagSetEx, error)

The Filter for each ID of the srcSet is the same.

func (*TextIndex) SearchTextIndexByExpr added in v1.1.0

func (idx *TextIndex) SearchTextIndexByExpr(name string, sids []uint64, expr influxql.Expr) (*clv.InvertIndex, error)

type TimeRange

type TimeRange util.TimeRange

TimeRange is time range.

Jump to

Keyboard shortcuts

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