util

package
v2.6.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2022 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildIndexFileName

func BuildIndexFileName(tableName, uploader, dbName string) string

func DoParallelQueries

func DoParallelQueries(ctx context.Context, queryIndex QueryIndexFunc, queries []index.Query, callback index.QueryPagesCallback) error

func GetUnsafeBytes

func GetUnsafeBytes(s string) []byte

func GetUnsafeString

func GetUnsafeString(buf []byte) string

func NewCallbackDeduper

func NewCallbackDeduper(callback index.QueryPagesCallback, queries int) index.QueryPagesCallback

NewCallbackDeduper should always be used on table level not the whole query level because it just looks at range values which can be repeated across tables NewCallbackDeduper is safe not to used by multiple goroutines Cortex anyways dedupes entries across tables

func NewSyncCallbackDeduper

func NewSyncCallbackDeduper(callback index.QueryPagesCallback, queries int) index.QueryPagesCallback

NewSyncCallbackDeduper should always be used on table level not the whole query level because it just looks at range values which can be repeated across tables NewSyncCallbackDeduper is safe to used by multiple goroutines Cortex anyways dedupes entries across tables

func QueriesByTable

func QueriesByTable(queries []index.Query) map[string][]index.Query

QueriesByTable groups and returns queries by tables.

func QueryKey

func QueryKey(q index.Query) string

func SafeOpenBoltdbFile

func SafeOpenBoltdbFile(path string) (*bbolt.DB, error)

SafeOpenBoltdbFile will recover from a panic opening a DB file, and return the panic message in the err return object.

Types

type QueryIndexFunc

type QueryIndexFunc func(ctx context.Context, queries []index.Query, callback index.QueryPagesCallback) error

Jump to

Keyboard shortcuts

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