Documentation
¶
Overview ¶
Package lake is a simple realtime analytics engine running on s3 with parquet.
Index ¶
- Variables
- func Avg[T int64 | float64](rows iter.Seq[T], count int) (result T)
- func Count[T int64 | float64](_ iter.Seq[T], count int) (result T)
- func Max[T int64 | float64](rows iter.Seq[T], count int) (result T)
- func Min[T int64 | float64](rows iter.Seq[T], count int) (result T)
- func Sum[T int64 | float64](rows iter.Seq[T], _ int) (result T)
- func When[T any](check bool, input T) (output T)
- type Aggregator
- type Bucket
- type BucketOption
- type Compactor
- type CompactorOption
- type DateRange
- type Filter
- func After(operand time.Time) Filter[int64]
- func Before(operand time.Time) Filter[int64]
- func Eq[T ~float64 | ~int64 | ~string](operand T) Filter[T]
- func Gt[T ~float64 | ~int64 | ~string](operand T) Filter[T]
- func Gte[T ~float64 | ~int64 | ~string](operand T) Filter[T]
- func In[T ~float64 | ~int64 | ~string](operands ...T) Filter[T]
- func Lt[T ~float64 | ~int64 | ~string](operand T) Filter[T]
- func Lte[T ~float64 | ~int64 | ~string](operand T) Filter[T]
- type Float
- type Grouper
- type Ingestor
- type IngestorOption
- type Int
- type QueryBuilder
- func (b *QueryBuilder[T]) Aggregate(aggregates T) *QueryBuilder[T]
- func (b *QueryBuilder[T]) GroupBy(grouping T) *QueryBuilder[T]
- func (b *QueryBuilder[T]) Limit(limit int) *QueryBuilder[T]
- func (b *QueryBuilder[T]) Scan(ctx context.Context, bucket *Bucket) ([]T, error)
- func (b *QueryBuilder[T]) Where(filter T) *QueryBuilder[T]
- type String
- type Table
Constants ¶
This section is empty.
Variables ¶
var ErrOptimisticLock = errors.New("optimistic lock failure")
Functions ¶
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
func New ¶
New constructs a lakedb bucket pointing to the provided s3 url / bucket. Credentials are loaded with aws sdk (e.g. from env AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY).
func NewFromClient ¶
func NewFromClient(ctx context.Context, client *s3.Client, bucket string, opts ...BucketOption) (*Bucket, error)
NewFromClient initializes a dynamitedb bucket from an existing aws s3 sdk client.
type BucketOption ¶
func WithCredentials ¶
func WithCredentials(accessKey, secretKey string) BucketOption
WithCredentials specifies a static access and secret key. This disables the default AWS SDK credential process.
func WithMaxGroups ¶
func WithMaxGroups(groups int) BucketOption
WithMaxGroups specifies the maximum number of dynamically aggregated groups before the engine cancels. This limit exists because lakedbs engine starts consuming excessive amounts of memory on high cardinality groups.
func WithRegion ¶
func WithRegion(region string) BucketOption
WithRegion specifies a static bucket region. This disables the default AWS SDK region process.
type Compactor ¶
type Compactor[T any] struct { // contains filtered or unexported fields }
func NewCompactor ¶
func NewCompactor[T any](bucket *Bucket, opts ...CompactorOption[T]) *Compactor[T]
type CompactorOption ¶
func WithCompactionSize ¶
func WithCompactionSize[T any](minimum int) CompactorOption[T]
WithCompactionSize defines the minimum size in bytes that compacted shards must be. Shards that are smaller than this are processed and compacted.
type Filter ¶
func After ¶
After only works for time.UnixNano (nanoseconds) data, it checks if the row value is AFTER the operand.
func Before ¶
Before only works for time.UnixNano (nanoseconds) data, it checks if the row value is BEFORE the operand.
type Float ¶
type Float struct {
Data float64 `parquet:"data"`
// contains filtered or unexported fields
}
func AggrFloat ¶
func AggrFloat(aggregation Aggregator[float64]) Float
func FilterFloat ¶
func GroupFloat ¶
type Grouper ¶
func Date ¶
Date is only for lake.Int values that represent a time.Time in Unix (nanoseconds). It removes everything from the date after the range to group values to "day", "hour", etc. buckets.
func Exact ¶
func Exact() Grouper
Exact performs an exact distinct grouping on the column. Every unique value creates a new column group.
func Floor ¶
Floor is only for numerical values (lake.Int / lake.Float). It floors the value to the bucket size to retrieve the group value.
func Fold ¶
func Fold() Grouper
Fold is only for string values (lake.String). It folds the value into lowercase to retrieve the group value.
func Prefix ¶
Prefix is only for string values (lake.String). It trims everything before :length from the value and uses this as group value.
type Ingestor ¶
type Ingestor[T any] struct { // contains filtered or unexported fields }
Ingestor provides a processor for one batch of input data.
func NewIngestor ¶
func NewIngestor[T any](bucket *Bucket, opts ...IngestorOption[T]) *Ingestor[T]
type IngestorOption ¶
func WithAutoCommit ¶
func WithAutoCommit[T any](interval time.Duration) IngestorOption[T]
WithAutoCommit ensures that inserts automatically commit data after the specified interval.
func WithMaxBacklogSize ¶ added in v0.5.0
func WithMaxBacklogSize[T any](size int) IngestorOption[T]
WithMaxBacklogSize defines a custom maximum queue size of failing writes that are kept in backlog.
type Int ¶
type Int struct {
Data int64 `parquet:"data"`
// contains filtered or unexported fields
}
func AggrInt ¶
func AggrInt(aggregation Aggregator[int64]) Int
type QueryBuilder ¶
type QueryBuilder[T any] struct { // contains filtered or unexported fields }
QueryBuilder wraps the query structure with api exposed methods to construct it. Generics are not strictly required here but make the api more userfriendly for autocompletion.
func Query ¶
func Query[T any]() *QueryBuilder[T]
func (*QueryBuilder[T]) Aggregate ¶
func (b *QueryBuilder[T]) Aggregate(aggregates T) *QueryBuilder[T]
func (*QueryBuilder[T]) GroupBy ¶
func (b *QueryBuilder[T]) GroupBy(grouping T) *QueryBuilder[T]
func (*QueryBuilder[T]) Limit ¶
func (b *QueryBuilder[T]) Limit(limit int) *QueryBuilder[T]
func (*QueryBuilder[T]) Scan ¶
func (b *QueryBuilder[T]) Scan(ctx context.Context, bucket *Bucket) ([]T, error)
func (*QueryBuilder[T]) Where ¶
func (b *QueryBuilder[T]) Where(filter T) *QueryBuilder[T]
type String ¶
type String struct {
Data string `parquet:"data"`
// contains filtered or unexported fields
}