pool

package
v0.0.0-...-fcd3143 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Executor

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

Executor executes SQL queries on warm pods

func NewExecutor

func NewExecutor(k8sClient kubernetes.Interface, config *rest.Config, logger *zerolog.Logger) *Executor

NewExecutor creates a new executor

func (*Executor) ExecuteQuery

func (e *Executor) ExecuteQuery(ctx context.Context, pod *WarmPod, sql string, timeout time.Duration) (string, error)

ExecuteQuery executes a SQL query on a warm pod

func (*Executor) ExecuteScript

func (e *Executor) ExecuteScript(ctx context.Context, pod *WarmPod, scriptPath string, timeout time.Duration) (string, error)

ExecuteScript executes a SQL script file on a warm pod

func (*Executor) HealthCheck

func (e *Executor) HealthCheck(ctx context.Context, pod *WarmPod) error

HealthCheck performs a health check on a warm pod

func (*Executor) StreamQuery

func (e *Executor) StreamQuery(ctx context.Context, pod *WarmPod, sql string, writer io.Writer) error

StreamQuery executes a query and streams the results

func (*Executor) UploadScript

func (e *Executor) UploadScript(ctx context.Context, pod *WarmPod, scriptContent string, scriptPath string) error

UploadScript uploads a SQL script to a warm pod

type Manager

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

Manager manages a pool of warm DuckDB pods

func NewManager

func NewManager(
	client client.Client,
	k8sClient kubernetes.Interface,
	scheme *runtime.Scheme,
	pool *ducklakev1alpha1.DuckLakePool,
	namespace string,
	config *rest.Config,
	recorder record.EventRecorder,
) *Manager

NewManager creates a new pool manager

func (*Manager) GetMaxQueryDuration

func (m *Manager) GetMaxQueryDuration() time.Duration

GetMaxQueryDuration returns the configured maximum query duration

func (*Manager) GetMaxRetries

func (m *Manager) GetMaxRetries() int

GetMaxRetries returns the configured retry count

func (*Manager) GetPoolStatus

func (m *Manager) GetPoolStatus() ducklakev1alpha1.DuckLakePoolStatus

GetPoolStatus returns the current pool status

func (*Manager) ReleasePod

func (m *Manager) ReleasePod(ctx context.Context, podName string) error

ReleasePod releases a pod back to the pool

func (*Manager) RequestPod

func (m *Manager) RequestPod(ctx context.Context, catalog string, resources corev1.ResourceRequirements, timeout time.Duration) (*WarmPod, error)

RequestPod requests a warm pod from the pool

func (*Manager) Shutdown

func (m *Manager) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the pool manager

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start starts the pool manager

type QueryResult

type QueryResult struct {
	Output   string
	Duration time.Duration
	Error    error
}

QueryResult represents the result of a query execution

type Request

type Request struct {
	ID        string
	Catalog   string
	Resources corev1.ResourceRequirements
	Timeout   time.Duration
	Response  chan Response
}

Request represents a request for a warm pod

type Response

type Response struct {
	Pod *WarmPod
	Err error
}

Response represents the response to a pod request

type WarmPod

type WarmPod struct {
	Name       string
	Namespace  string
	PoolName   string
	State      ducklakev1alpha1.PodState
	LastUsed   time.Time
	QueryCount int32
	CreatedAt  time.Time
	// contains filtered or unexported fields
}

WarmPod represents a warm DuckDB pod

func (*WarmPod) ExecuteQuery

func (p *WarmPod) ExecuteQuery(ctx context.Context, sql string, timeout time.Duration) (string, error)

ExecuteQuery executes a SQL query on this warm pod

func (*WarmPod) ExecuteQueryWithRetry

func (p *WarmPod) ExecuteQueryWithRetry(ctx context.Context, sql string, timeout time.Duration, retries int, recorder record.EventRecorder) (string, error)

ExecuteQueryWithRetry executes a query with retries and records metrics

Jump to

Keyboard shortcuts

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