Documentation
¶
Overview ¶
Package db implements an in‐memory embedded database for Apache Arrow records.
Index ¶
- type CompressionConfig
- type DB
- func (db *DB) AsyncIngest(record arrow.Record)
- func (db *DB) Backup(path string) error
- func (db *DB) Close()
- func (db *DB) Export(format string, writer io.Writer) error
- func (db *DB) GetRecords() []arrow.Record
- func (db *DB) GetRecordsSince(since time.Time) []arrow.Record
- func (db *DB) GetSchema() *arrow.Schema
- func (db *DB) Import(format string, reader io.Reader) error
- func (db *DB) PruneOldRecords()
- func (db *DB) Query(plan *Query) ([]arrow.Record, error)
- func (db *DB) QueryByUser(userID int64) []arrow.Record
- func (db *DB) Restore(path string) error
- func (db *DB) WaitForBatch()
- type DeadLetterQueue
- type Index
- type JoinCondition
- type Migration
- type Partition
- type PartitionStrategy
- type Query
- type QueryOptimizer
- type RecoveryManager
- type SchemaManager
- type Snapshot
- type Statistics
- type Storage
- type Task
- type WALJournal
- type WindowFunction
- type Worker
- type WorkerPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompressionConfig ¶
type CompressionConfig struct {
Enabled bool
Codec compress.Codec // e.g. arrow.CompressionLZ4Frame
Level int
}
CompressionConfig controls optional compression of Arrow records.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is an in-memory, embedded database for Arrow records with advanced query, ingestion, and recovery capabilities.
func (*DB) AsyncIngest ¶
AsyncIngest enqueues a record for asynchronous ingestion.
func (*DB) Close ¶
func (db *DB) Close()
Close shuts down the DB, releases all records, and stops background workers.
func (*DB) GetRecords ¶
GetRecords returns all stored records.
func (*DB) GetRecordsSince ¶
GetRecordsSince returns records with a timestamp after the specified time
func (*DB) PruneOldRecords ¶
func (db *DB) PruneOldRecords()
PruneOldRecords removes records older than the retention period.
func (*DB) QueryByUser ¶
QueryByUser returns all records for a given user.
func (*DB) WaitForBatch ¶
func (db *DB) WaitForBatch()
type DeadLetterQueue ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index is a bitmap-based index for efficient value lookups
func (*Index) Cardinality ¶
Cardinality returns the number of unique values in the index
type JoinCondition ¶
JoinCondition represents a join between two columns.
type PartitionStrategy ¶
type PartitionStrategy interface {
Partition(record arrow.Record) string
Merge(partitions []*Partition) arrow.Record
}
PartitionStrategy defines how to partition and later merge records.
type Query ¶
type Query struct {
SelectColumns []string
Aggregates map[string]string // e.g. "purchase_amount" -> "SUM"
GroupBy []string
Window time.Duration
// Additional query capabilities:
Joins []JoinCondition
Subqueries []*Query
Unions []*Query
WindowFuncs []WindowFunction
}
Query represents a structured query against the database.
type QueryOptimizer ¶
type QueryOptimizer struct {
// contains filtered or unexported fields
}
QueryOptimizer caches query results and collects statistics.
type RecoveryManager ¶
type RecoveryManager struct {
// contains filtered or unexported fields
}
RecoveryManager handles snapshots and write-ahead logging.
type SchemaManager ¶
type SchemaManager struct {
Versions map[int]*arrow.Schema
Migrations []Migration
CurrentVersion int
}
SchemaManager maintains multiple schema versions and migrations.
type Statistics ¶
type Statistics struct {
Cardinality map[string]int64
Min map[string]interface{}
Max map[string]interface{}
}
Statistics holds cardinality, min, and max information for columns.
type Storage ¶
type Storage interface {
Export(format string, writer io.Writer) error
Import(format string, reader io.Reader) error
Backup(path string) error
Restore(path string) error
}
Storage defines import/export and backup/restore methods.
type WALJournal ¶
type WALJournal struct {
// contains filtered or unexported fields
}
WALJournal is a simple write-ahead log.
type WindowFunction ¶
WindowFunction represents a windowed aggregation.
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker executes tasks from the WorkerPool.
type WorkerPool ¶
type WorkerPool struct {
// contains filtered or unexported fields
}
WorkerPool manages a fixed set of workers.
func NewWorkerPool ¶
func NewWorkerPool(numWorkers int) *WorkerPool
NewWorkerPool creates a new pool with the given number of workers.
func (*WorkerPool) Submit ¶
func (wp *WorkerPool) Submit(task Task)
Submit schedules a task for execution.