Documentation
¶
Overview ¶
Package drivers provides the driver interface and shared infrastructure for search backends.
Index ¶
- func Register(name string, config DriverConfig)
- type CLILoader
- func (l *CLILoader) Close() error
- func (l *CLILoader) Drop(ctx context.Context, schema *Schema) error
- func (l *CLILoader) Load(ctx context.Context, schema *Schema, dataPath string, batchSize int, ...) (int, error)
- func (l *CLILoader) Name() string
- func (l *CLILoader) RunPost(ctx context.Context, dir string, schema *Schema) error
- func (l *CLILoader) RunPre(ctx context.Context, dir string, schema *Schema) error
- func (l *CLILoader) ValidateSchema(schema *Schema) error
- type Driver
- type DriverConfig
- type DriverFactory
- type K6Client
- func (c *K6Client) Close()
- func (c *K6Client) Insert(table string, doc map[string]interface{}) map[string]interface{}
- func (c *K6Client) InsertBatch(table string, docs []map[string]interface{}) map[string]interface{}
- func (c *K6Client) Query(query string, args ...any) map[string]interface{}
- func (c *K6Client) SetTimeout(seconds int)
- func (c *K6Client) Update(table string, doc map[string]interface{}) map[string]interface{}
- func (c *K6Client) UpdateBatch(table string, docs []map[string]interface{}) map[string]interface{}
- type LoadWorkerFactory
- type RowSource
- type Schema
- type TelemetryProvider
- type TypeReloader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(name string, config DriverConfig)
Register registers a driver and its protocol capabilities.
Types ¶
type CLILoader ¶
type CLILoader struct {
// contains filtered or unexported fields
}
CLILoader wraps a Driver for CLI bulk loading.
func NewBackendCLILoader ¶
func NewBackendCLILoader(name, driverType, fileType, connString string, factory DriverFactory) *CLILoader
NewBackendCLILoader separates dataset directory/label from driver identity.
func NewCLILoader ¶
func NewCLILoader(name, fileType, connString string, factory DriverFactory) *CLILoader
NewCLILoader creates a CLI loader that wraps a driver.
func (*CLILoader) ValidateSchema ¶
ValidateSchema checks whether this backend can load every schema column type, covering each table of a multi-table schema.
type Driver ¶
type Driver interface {
Close() error
Exec(ctx context.Context, statements string) error
Query(ctx context.Context, query string, args ...any) (hitCount int, err error)
Insert(ctx context.Context, table string, cols []string, rows [][]any) (int, error)
Update(ctx context.Context, table string, keyCols []string, cols []string, rows [][]any) (int, error)
CaptureConfig(ctx context.Context, backendName string)
}
Driver is the minimal interface each backend must implement.
type DriverConfig ¶
type DriverConfig struct {
Factory DriverFactory
FileType string // "sql" or "json"
// OptionalConnection allows drivers to obtain an endpoint from other settings.
OptionalConnection bool
}
DriverConfig registers protocol capabilities. Backend defaults live in manifests.
func GetConfig ¶
func GetConfig(name string) (DriverConfig, bool)
GetConfig returns the configuration for a driver.
type DriverFactory ¶
DriverFactory creates a driver from a connection string.
type K6Client ¶
type K6Client struct {
// contains filtered or unexported fields
}
K6Client wraps a Driver with k6 metrics emission.
func NewK6Client ¶
NewK6Client creates a k6 client that wraps a driver.
func (*K6Client) InsertBatch ¶
InsertBatch inserts documents and emits metrics.
func (*K6Client) SetTimeout ¶
SetTimeout sets the query timeout duration. Use 0 to disable timeout (default).
type LoadWorkerFactory ¶
LoadWorkerFactory preserves driver-local setup when creating loader workers. Workers must not replay pre scripts, which can delete existing data.
type RowSource ¶
type RowSource interface {
// Columns returns the schema columns present in the file, in file order.
Columns() []string
// Next returns the values for the next row, aligned with Columns().
// It returns io.EOF when the source is exhausted.
Next() ([]any, error)
Close() error
}
RowSource streams schema-converted rows from a dataset file.
type Schema ¶
type Schema struct {
Table string `yaml:"table"`
Columns map[string]string `yaml:"columns"`
Tables []Schema `yaml:"tables"`
}
Schema defines the dataset schema from schema.yaml. A dataset is either single-table (top-level table and columns) or multi-table (a tables list with one entry per table); the two forms cannot be mixed.
func (*Schema) TableSchemas ¶
TableSchemas returns one single-table schema per table to load: the schema itself for single-table datasets, or each tables entry for multi-table ones.
type TelemetryProvider ¶
type TelemetryProvider interface {
TelemetryEnabled() bool
ReadTelemetry(ctx context.Context) ([]metrics.TelemetryPoint, error)
}
TelemetryProvider is an optional backend capability consumed by the dedicated metrics collector. Implementations own their database-specific queries and return generic counter/gauge series.
type TypeReloader ¶
TypeReloader is implemented by drivers whose connections cache database type information that can be invalidated by pre scripts (e.g. CREATE EXTENSION).
Directories
¶
| Path | Synopsis |
|---|---|
|
Package clickhouse provides the ClickHouse driver implementation.
|
Package clickhouse provides the ClickHouse driver implementation. |
|
Package elasticsearch registers the Elasticsearch driver.
|
Package elasticsearch registers the Elasticsearch driver. |
|
Package mongodb provides the MongoDB driver implementation.
|
Package mongodb provides the MongoDB driver implementation. |
|
Package opensearch registers the OpenSearch driver.
|
Package opensearch registers the OpenSearch driver. |
|
Package postgres registers the PostgreSQL driver.
|
Package postgres registers the PostgreSQL driver. |
|
shared
|
|
|
elasticsearch
Package elasticsearch provides the shared Elasticsearch/OpenSearch driver implementation.
|
Package elasticsearch provides the shared Elasticsearch/OpenSearch driver implementation. |
|
postgres
Package postgres provides the shared PostgreSQL driver implementation.
|
Package postgres provides the shared PostgreSQL driver implementation. |
|
Package turbopuffer implements the cloud-only Turbopuffer HTTP backend.
|
Package turbopuffer implements the cloud-only Turbopuffer HTTP backend. |