Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( LabelFilterEqual = "=" LabelFilterNotEqual = "!=" NewLabelFilter = func(key, value string, eq bool) string { if eq { return fmt.Sprintf("%s%s%s", key, LabelFilterEqual, value) } return fmt.Sprintf("%s%s%s", key, LabelFilterNotEqual, value) } ParseLabelFilter = func(filter string) (LabelFilter, error) { eq := false parts := strings.Split(filter, LabelFilterNotEqual) if len(parts) != 2 { parts = strings.Split(filter, LabelFilterEqual) eq = true } if len(parts) != 2 { return LabelFilter{}, errors.New("invalid label filter") } return LabelFilter{Label: parts[0], Value: parts[1], Equal: eq}, nil } )
Functions ¶
Types ¶
type Block ¶
type Block interface {
component.Component
Reload(c *Config) error
Start() time.Time
End() time.Time
State() State
TransformToCold() error
ClearOnDisk() error
Append(ctx context.Context, feeds ...*model.Feed) error
Query(ctx context.Context, query QueryOptions) ([]*FeedVO, error)
Exists(ctx context.Context, id uint64) (bool, error)
}
--- Interface code block ---
type Config ¶
type Config struct {
Dir string
FlushInterval time.Duration
ForCreate *ForCreateConfig
// contains filtered or unexported fields
}
type Dependencies ¶
type Factory ¶
type Factory component.Factory[Block, Config, Dependencies]
--- Factory code block ---
func NewFactory ¶
func NewFactory(mockOn ...component.MockOption) Factory
type FeedVO ¶
type FeedVO struct {
*model.Feed `json:",inline"`
Vectors [][]float32 `json:"-"`
Score float32 `json:"score,omitempty"` // Only exists when SemanticFilter is set.
}
FeedVO is the feed view for query result.
type ForCreateConfig ¶
type LabelFilter ¶
LabelFilter defines the matcher for an item.
type QueryOptions ¶
type QueryOptions struct {
Query string
Threshold float32
LabelFilters []string
Limit int
Start, End time.Time
// contains filtered or unexported fields
}
func (*QueryOptions) HitTimeRangeCondition ¶
func (q *QueryOptions) HitTimeRangeCondition(b Block) bool
func (*QueryOptions) Validate ¶
func (q *QueryOptions) Validate() error
Click to show internal directories.
Click to hide internal directories.