Documentation ¶
Index ¶
- type BigIndexWriter
- type Cache
- type CacheMetrics
- type CounterMetric
- type ExprAnd
- type ExprEqual
- type ExprNot
- type ExprOr
- type Expression
- type HistogramMetric
- type Index
- type IndexMetrics
- type IndexOption
- type IndexWriter
- type LRUCache
- type LRUCacheOption
- type Query
- type Result
- type ResultField
- type ResultGroup
- type Schema
- type SchemaColumn
- type SchemaColumnValue
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BigIndexWriter ¶
type BigIndexWriter struct {
// contains filtered or unexported fields
}
func NewBigIndexWriter ¶
func (*BigIndexWriter) AddRow ¶
func (idx *BigIndexWriter) AddRow(values map[string]string) (uint32, error)
func (*BigIndexWriter) Flush ¶
func (idx *BigIndexWriter) Flush() error
type Cache ¶
type Cache interface { Get(key uint64) (bm *roaring.Bitmap, found bool) Put(key uint64, bm *roaring.Bitmap) }
Cache is the interface that needs to be fulfilled for a cache implementation.
type CacheMetrics ¶
type CacheMetrics struct { CacheHit CounterMetric CacheMiss CounterMetric GetCall CounterMetric PutCall CounterMetric }
CacheMetrics contains the counter metrics relating to a cache. It is currently mainly used in the LRUCache implementation.
type CounterMetric ¶
type CounterMetric interface {
Inc()
}
type ExprAnd ¶
type ExprAnd struct {
Exprs []Expression
}
type ExprNot ¶
type ExprNot struct {
Expr Expression
}
type ExprOr ¶
type ExprOr struct {
Exprs []Expression
}
type Expression ¶
type Expression interface { String() string // contains filtered or unexported methods }
type HistogramMetric ¶
type HistogramMetric interface {
Observe(float64)
}
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index represents an index to run queries on. You have to create objects using the OpenIndex or OpenIndexFromBoltDatabase constructor functions.
func OpenIndex ¶
func OpenIndex(file string, opts ...IndexOption) (*Index, error)
OpenIndex opens an index file previously created using the IndexWriter.
func OpenIndexFromBoltDatabase ¶
func OpenIndexFromBoltDatabase(db *bbolt.DB, opts ...IndexOption) (*Index, error)
OpenIndexFromBoltDatabase opens an index directly from a bbolt database. For this to work correctly, the index should be created using the IndexWriter.
type IndexMetrics ¶
type IndexMetrics struct {
ExecuteDuration HistogramMetric
}
type IndexOption ¶
func WithCache ¶
func WithCache(cache Cache) IndexOption
WithCache is an option for OpenIndex and OpenIndexFromBoltDatabase to set a cache for caching queries, including partial queries.
func WithIndexMetrics ¶
func WithIndexMetrics(metrics *IndexMetrics) IndexOption
WithIndexMetrics is an option for OpenIndex and OpenIndexFromBoltDatabase to set an IndexMetrics object.
func WithPreloadedData ¶
func WithPreloadedData() IndexOption
WithPreloadedData is an option for OpenIndex and OpenIndexFromBoltDatabase to preload all data into memory to allow for faster queries. Only use this if all data from the index file will fit into the available memory.
type IndexWriter ¶
type IndexWriter struct {
// contains filtered or unexported fields
}
IndexWriter is a helper type to create a columnar index by adding row data. It needs to be created using the NewIndexWriter constructor function.
func NewIndexWriter ¶
func NewIndexWriter(filename string) *IndexWriter
NewIndexWriter creates a new IndexWriter object. IndexWriter is used to add row data and to write the corresponding index data to a persistent store.
func (*IndexWriter) AddRow ¶
func (idx *IndexWriter) AddRow(values map[string]string) (uint32, error)
AddRow adds a row of data and returns its row ID. The row data must be provided as map, where the keys contain the column names, and the values the corresponding column values.
func (*IndexWriter) Flush ¶
func (idx *IndexWriter) Flush() error
WriteToFile writes the index data to the provided file.
func (*IndexWriter) WriteToBoltDatabase ¶
func (idx *IndexWriter) WriteToBoltDatabase(db *bbolt.DB) error
WriteToBoltDatabase writes the index data directly to a badger database.
type LRUCache ¶
type LRUCache struct {
// contains filtered or unexported fields
}
LRUCache is a size-bounded cache with a LRU cache replacement policy. You have to use the NewLRUCache constructor function to create an instance of it.
func NewLRUCache ¶
func NewLRUCache(maxSizeBytes uint64, opts ...LRUCacheOption) *LRUCache
NewLRUCache returns a new LRUCache object.
type LRUCacheOption ¶
type LRUCacheOption func(c *LRUCache)
func WithCacheMetrics ¶
func WithCacheMetrics(metrics *CacheMetrics) LRUCacheOption
WithCacheMetrics is an option for LRUCache to set a CacheMetrics object.
type Query ¶
type Query struct { // Expr is the expression you want to limit your query on. You can use the types ExprEqual, ExprNot, // ExprAnd and ExprOr to construct your expression. Expr Expression // GroupBy is a list of column names you want to group by. The result will then contain the // results for all available values of all the listed columns for which a non-zero count result // was determined. GroupBy []string // contains filtered or unexported fields }
Query describes a count query to execute on an index. updog allows you to run the equivalent of SQL queries like `SELECT x, y, z, COUNT(*) WHERE ... GROUP BY x, y, z`.
type Result ¶
type Result struct { // Count is the total count of rows that matched the query expression. Count uint64 // Groups contains a list of grouped results. If no GroupBy list was provided // in the query, this list will be empty. Groups []ResultGroup }
Result contains the query result.
type ResultField ¶
ResultField contains a single column name and value. It is used in ResultGroup objects.
type ResultGroup ¶
type ResultGroup struct { // Fields contains a list of result fields for that group, each field consisting of the // column name and value. Fields []ResultField // Count contains the determined count for the list of result fields. Count uint64 }
ResultGroup contains a single grouped result.
type Schema ¶
type Schema struct {
Columns []SchemaColumn
}
type SchemaColumn ¶
type SchemaColumn struct { Name string Values []SchemaColumnValue }
type SchemaColumnValue ¶
type SchemaColumnValue struct {
Value string
}