container

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder 使用 Container 构建各种组件

func NewBuilder

func NewBuilder(container Container) *Builder

NewBuilder 创建新的构建器

func (*Builder) BuildEnhancedOptimizer

func (b *Builder) BuildEnhancedOptimizer(parallelism int) *optimizer.EnhancedOptimizer

BuildEnhancedOptimizer 构建增强优化器

func (*Builder) BuildExecutor

func (b *Builder) BuildExecutor() executor.Executor

BuildExecutor 构建执行器

func (*Builder) BuildExpressionEvaluator

func (b *Builder) BuildExpressionEvaluator() *optimizer.ExpressionEvaluator

BuildExpressionEvaluator 构建表达式求值器

func (*Builder) BuildOptimizedExecutor

func (b *Builder) BuildOptimizedExecutor(useOptimizer bool) *optimizer.OptimizedExecutor

BuildOptimizedExecutor 构建优化执行器

func (*Builder) BuildOptimizedExecutorWithDSManager

func (b *Builder) BuildOptimizedExecutorWithDSManager(dsManager *application.DataSourceManager, useOptimizer bool) *optimizer.OptimizedExecutor

BuildOptimizedExecutorWithDSManager 构建带数据源管理器的优化执行器

func (*Builder) BuildOptimizer

func (b *Builder) BuildOptimizer() *optimizer.Optimizer

BuildOptimizer 构建基础优化器

func (*Builder) BuildShowProcessor

func (b *Builder) BuildShowProcessor() *optimizer.DefaultShowProcessor

BuildShowProcessor 构建 SHOW 处理器

func (*Builder) BuildVariableManager

func (b *Builder) BuildVariableManager() *optimizer.DefaultVariableManager

BuildVariableManager 构建变量管理器

func (*Builder) GetCostModel

func (b *Builder) GetCostModel() cost.CostModel

GetCostModel 从容器获取成本模型

func (*Builder) GetIndexSelector

func (b *Builder) GetIndexSelector() *index.IndexSelector

GetIndexSelector 从容器获取索引选择器

func (*Builder) GetStatisticsCache

func (b *Builder) GetStatisticsCache() *statistics.AutoRefreshStatisticsCache

GetStatisticsCache 从容器获取统计缓存

type Container

type Container interface {
	// Register registers a service with the given name.
	// name: unique name for the service
	// service: the service instance
	// If a service with the same name already exists, it will be overwritten.
	Register(name string, service interface{})

	// Get retrieves a service by name.
	// name: name of the service
	// Returns the service and true if found, or nil and false if not found.
	Get(name string) (interface{}, bool)

	// MustGet retrieves a service by name.
	// name: name of the service
	// Returns the service, or panics if not found.
	// This is a convenience method when you're certain the service exists.
	MustGet(name string) interface{}

	// Has checks if a service with the given name exists.
	// name: name of the service
	// Returns true if the service exists, false otherwise.
	Has(name string) bool

	// BuildOptimizer builds a basic optimizer using services from the container.
	// Returns an Optimizer instance.
	BuildOptimizer() interface{}

	// BuildEnhancedOptimizer builds an enhanced optimizer with advanced features.
	// parallelism: degree of parallelism for optimization
	// Returns an Optimizer instance with enhanced capabilities.
	BuildEnhancedOptimizer(parallelism int) interface{}

	// BuildExecutor builds a plan executor using services from the container.
	// Returns a PlanExecutor instance.
	BuildExecutor() interface{}

	// BuildShowProcessor builds a SHOW statement processor.
	// Returns a ShowProcessor instance.
	BuildShowProcessor() interface{}

	// BuildVariableManager builds a variable manager.
	// Returns a VariableManager instance.
	BuildVariableManager() interface{}

	// BuildExpressionEvaluator builds an expression evaluator.
	// Returns an ExpressionEvaluator instance.
	BuildExpressionEvaluator() interface{}

	// GetDataSource returns the data source used by the container.
	GetDataSource() domain.DataSource
}

Container is a dependency injection container that manages services. It provides methods to register and retrieve services by name.

func NewContainer

func NewContainer(dataSource domain.DataSource) Container

NewContainer creates a new DI container with the given data source. It automatically registers default services like statistics cache, cardinality estimator, cost model, etc.

type EnhancedOptimizerConfig

type EnhancedOptimizerConfig struct {
	DataSource    domain.DataSource
	Parallelism   int
	CostModel     interface{}
	IndexSelector interface{}
	StatsCache    interface{}
	Estimator     interface{}
	DPJoinReorder interface{}
	BushyTree     interface{}
	HintsParser   interface{}
}

EnhancedOptimizerConfig holds the configuration for building an EnhancedOptimizer This is used to pass dependencies from the container to the optimizer package

type Executor

type Executor = executor.Executor

Executor 是 executor.Executor 的别名,用于避免返回指针到接口类型

Jump to

Keyboard shortcuts

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