block

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2025 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFeedVOHeap

func NewFeedVOHeap(feeds []*FeedVO) *heap.Heap[*FeedVO]

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
}

func (*Config) Validate

func (c *Config) Validate() error

type Dependencies

type Dependencies struct {
	ChunkFactory    chunk.Factory
	PrimaryFactory  primary.Factory
	InvertedFactory inverted.Factory
	VectorFactory   vector.Factory
	LLMFactory      llm.Factory
}

type Factory

--- 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 FeedVOs

type FeedVOs []*FeedVO

type ForCreateConfig

type ForCreateConfig struct {
	Start        time.Time
	Duration     time.Duration
	EmbeddingLLM string
}

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

type State

type State string

State is the state of the block.

const (
	// StateHot means the block is writable.
	// ALL data is in memory.
	// It is the head of the block chain.
	StateHot State = "hot"
	// StateCold for read only.
	// It has indexs on disk.
	StateCold State = "cold"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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