Documentation
¶
Index ¶
- Variables
- func BuildLocalFilter(criteria *model_v1.Criteria, schema Schema, entityDict map[string]int, ...) (index.Filter, []tsdb.Entity, error)
- func ExecuteForShard(series tsdb.SeriesList, timeRange timestamp.TimeRange, ...) ([]tsdb.Iterator, []io.Closer, error)
- func Format(p Plan) string
- func FormatTagRefs(sep string, exprGroup ...[]*TagRef) string
- func ProjectItem(ec executor.ExecutionContext, item tsdb.Item, projectionFieldRefs [][]*TagRef) ([]*modelv1.TagFamily, error)
- func SortedByIndex(elements []*streamv1.Element, tagFamilyIdx, tagIdx int, ...) bool
- func SortedByTimestamp(elements []*streamv1.Element, sortDirection modelv1.Sort) bool
- func StringSlicesEqual(a, b []string) bool
- type CommonSchema
- func (cs *CommonSchema) CreateRef(tags ...[]*Tag) ([][]*TagRef, error)
- func (cs *CommonSchema) IndexDefined(tagName string) (bool, *databasev1.IndexRule)
- func (cs *CommonSchema) IndexRuleDefined(indexRuleName string) (bool, *databasev1.IndexRule)
- func (cs *CommonSchema) ProjTags(refs ...[]*TagRef) *CommonSchema
- func (cs *CommonSchema) RegisterTag(tagFamilyIdx, tagIdx int, spec *databasev1.TagSpec)
- func (cs *CommonSchema) ShardNumber() uint32
- type ComparableExpr
- type Comparator
- type Expr
- type Field
- type FieldKey
- type FieldRef
- type FieldSpec
- type GlobalIndexError
- type ItemIterator
- type Limit
- type LiteralExpr
- type Offset
- type OrderBy
- type Parent
- type Plan
- type RangeOpts
- type ResolvableExpr
- type Schema
- type SeekerBuilder
- type Tag
- type TagFilter
- type TagRef
- type TagSpec
- type UnresolvedOrderBy
- type UnresolvedPlan
Constants ¶
This section is empty.
Variables ¶
var ( ErrTagNotDefined = errors.New("tag is not defined") ErrFieldNotDefined = errors.New("field is not defined") ErrUnsupportedConditionOp = errors.New("unsupported condition operation") ErrUnsupportedConditionValue = errors.New("unsupported condition value type") ErrInvalidCriteriaType = errors.New("invalid criteria type") ErrIncompatibleQueryCondition = errors.New("incompatible query condition type") ErrIndexNotDefined = errors.New("index is not define for the tag") ErrMultipleGlobalIndexes = errors.New("multiple global indexes are not supported") ErrInvalidData = errors.New("data is invalid") )
var ( ErrNotRangeOperation = errors.New("this is not an range operation") ErrEmptyTree = errors.New("tree is empty") ErrInvalidLogicalExpression = errors.New("invalid logical expression") )
var BypassFilter = new(emptyFilter)
var DefaultLimit uint32 = 20
var ErrUnsupportedLogicalOperation = errors.New("unsupported logical operation")
Functions ¶
func BuildLocalFilter ¶ added in v0.2.0
func ExecuteForShard ¶ added in v0.2.0
func ExecuteForShard(series tsdb.SeriesList, timeRange timestamp.TimeRange, builders ...SeekerBuilder, ) ([]tsdb.Iterator, []io.Closer, error)
ExecuteForShard fetches elements from series within a single shard. A list of series must be prepared in advanced with the help of Entity. The result is a list of element set, where the order of inner list is kept as what the users specify in the seekerBuilder. This method is used by the underlying tableScan and localIndexScan plans.
func FormatTagRefs ¶ added in v0.2.0
func ProjectItem ¶ added in v0.2.0
func ProjectItem(ec executor.ExecutionContext, item tsdb.Item, projectionFieldRefs [][]*TagRef) ([]*modelv1.TagFamily, error)
ProjectItem parses the item within the StreamExecutionContext. projectionFieldRefs must be prepared before calling this method, projectionFieldRefs should be a list of tag list where the inner list must exist in the same tag family. Strict order can be guaranteed in the result.
func SortedByIndex ¶
func SortedByIndex(elements []*streamv1.Element, tagFamilyIdx, tagIdx int, sortDirection modelv1.Sort) bool
SortedByIndex is used to test whether the given entities are sorted by the sortDirection The given entities MUST satisfy both the positive check and the negative check for the reversed direction
func SortedByTimestamp ¶
func StringSlicesEqual ¶ added in v0.2.0
Types ¶
type CommonSchema ¶ added in v0.2.0
type CommonSchema struct {
Group *commonv1.Group
IndexRules []*databasev1.IndexRule
TagMap map[string]*TagSpec
EntityList []string
}
func (*CommonSchema) CreateRef ¶ added in v0.2.0
func (cs *CommonSchema) CreateRef(tags ...[]*Tag) ([][]*TagRef, error)
CreateRef create TagRef to the given tags. The family name of the tag is actually not used since the uniqueness of the tag names can be guaranteed across families.
func (*CommonSchema) IndexDefined ¶ added in v0.2.0
func (cs *CommonSchema) IndexDefined(tagName string) (bool, *databasev1.IndexRule)
IndexDefined checks whether the field given is indexed
func (*CommonSchema) IndexRuleDefined ¶ added in v0.2.0
func (cs *CommonSchema) IndexRuleDefined(indexRuleName string) (bool, *databasev1.IndexRule)
func (*CommonSchema) ProjTags ¶ added in v0.2.0
func (cs *CommonSchema) ProjTags(refs ...[]*TagRef) *CommonSchema
func (*CommonSchema) RegisterTag ¶ added in v0.2.0
func (cs *CommonSchema) RegisterTag(tagFamilyIdx, tagIdx int, spec *databasev1.TagSpec)
registerTag registers the tag spec with given tagFamilyName, tagName and indexes.
func (*CommonSchema) ShardNumber ¶ added in v0.2.0
func (cs *CommonSchema) ShardNumber() uint32
type ComparableExpr ¶
type ComparableExpr interface {
LiteralExpr
Compare(LiteralExpr) (int, bool)
BelongTo(LiteralExpr) bool
Contains(LiteralExpr) bool
}
type Comparator ¶ added in v0.2.0
func CreateComparator ¶ added in v0.2.0
func CreateComparator(sortDirection modelv1.Sort) Comparator
type FieldKey ¶ added in v0.2.0
type FieldKey struct {
*database_v1.IndexRule
}
type FieldRef ¶
type FieldRef struct {
// Field defines the name of the Field
Field *Field
// spec contains the index of the key in the measureSchema, as well as the underlying FieldSpec
Spec *FieldSpec
}
FieldRef is the reference to the field also it holds the definition (derived from measureSchema) of the field
type FieldSpec ¶ added in v0.2.0
type FieldSpec struct {
FieldIdx int
Spec *databasev1.FieldSpec
}
type GlobalIndexError ¶ added in v0.2.0
type GlobalIndexError struct {
IndexRule *database_v1.IndexRule
Expr LiteralExpr
}
func (*GlobalIndexError) Error ¶ added in v0.2.0
func (g *GlobalIndexError) Error() string
type ItemIterator ¶
func NewItemIter ¶
func NewItemIter(iters []tsdb.Iterator, c Comparator) ItemIterator
type LiteralExpr ¶
func ID ¶
func ID(id string) LiteralExpr
func Str ¶
func Str(str string) LiteralExpr
type Offset ¶
type Offset struct {
*Parent
// contains filtered or unexported fields
}
type OrderBy ¶
type OrderBy struct {
// orderByIndex describes the indexRule used to sort the elements/
// It can be null since by default we may sort by created-time.
Index *databasev1.IndexRule
// while orderBySort describes the Sort direction
Sort modelv1.Sort
// contains filtered or unexported fields
}
type Parent ¶ added in v0.2.0
type Parent struct {
UnresolvedInput UnresolvedPlan
Input Plan
}
type RangeOpts ¶ added in v0.2.0
type RangeOpts struct {
Upper ComparableExpr
Lower ComparableExpr
IncludesUpper bool
IncludesLower bool
}
type ResolvableExpr ¶
type Schema ¶
type Schema interface {
Scope() tsdb.Entry
EntityList() []string
IndexDefined(tagName string) (bool, *databasev1.IndexRule)
IndexRuleDefined(string) (bool, *databasev1.IndexRule)
CreateTagRef(tags ...[]*Tag) ([][]*TagRef, error)
CreateFieldRef(fields ...*Field) ([]*FieldRef, error)
ProjTags(refs ...[]*TagRef) Schema
ProjFields(refs ...*FieldRef) Schema
Equal(Schema) bool
ShardNumber() uint32
TraceIDFieldName() string
}
type SeekerBuilder ¶ added in v0.2.0
type SeekerBuilder func(builder tsdb.SeekerBuilder)
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
func (*Tag) GetCompoundName ¶
GetCompoundName is only used for error message
func (*Tag) GetFamilyName ¶
func (*Tag) GetTagName ¶
type TagRef ¶
type TagRef struct {
// Tag defines the family name and name of the Tag
Tag *Tag
// spec contains the index of the key in the streamSchema/measureSchema, as well as the underlying tagSpec
Spec *TagSpec
}
TagRef is the reference to the field also it holds the definition (derived from the streamSchema, measureSchema) of the tag
func NewSearchableTagRef ¶
NewSearchableTagRef is a short-handed method for creating a TagRef to the tag in the searchable family
type TagSpec ¶ added in v0.2.0
type TagSpec struct {
// Idx is defined as
// 1) the field index based on the (stream/measure) schema for the underlying plans which
// directly interact with the database and index modules,
// 2) the projection index given by the users for those plans which can only access the data from parent plans,
// e.g. orderBy plan uses this projection index to access the data entities (normally a projection view)
// from the parent plan.
TagFamilyIdx int
TagIdx int
Spec *databasev1.TagSpec
}
type UnresolvedOrderBy ¶
type UnresolvedOrderBy struct {
// contains filtered or unexported fields
}
func NewOrderBy ¶ added in v0.2.0
func NewOrderBy(indexRuleName string, sort modelv1.Sort) *UnresolvedOrderBy
type UnresolvedPlan ¶
func NewLimit ¶ added in v0.2.0
func NewLimit(input UnresolvedPlan, num uint32) UnresolvedPlan
func NewOffset ¶ added in v0.2.0
func NewOffset(input UnresolvedPlan, num uint32) UnresolvedPlan