util

package
v2.4.3 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: AGPL-3.0 Imports: 19 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 CompressFile

func CompressFile(src, dest string, sync bool) error

func DoParallelQueries

func DoParallelQueries(ctx context.Context, tableQuerier TableQuerier, queries []chunk.IndexQuery, callback chunk.QueryPagesCallback) error

func DownloadFileFromStorage

func DownloadFileFromStorage(destination string, decompressFile bool, sync bool, logger log.Logger, getFileFunc GetFileFunc) error

DownloadFileFromStorage downloads a file from storage to given location.

func GetUnsafeBytes

func GetUnsafeBytes(s string) []byte

func GetUnsafeString

func GetUnsafeString(buf []byte) string

func IsCompressedFile

func IsCompressedFile(filename string) bool

func LoggerWithFilename

func LoggerWithFilename(logger log.Logger, filename string) log.Logger

func QueriesByTable

func QueriesByTable(queries []chunk.IndexQuery) map[string][]chunk.IndexQuery

QueriesByTable groups and returns queries by tables.

func QueryKey

func QueryKey(q chunk.IndexQuery) 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.

func ValidateSharedStoreKeyPrefix

func ValidateSharedStoreKeyPrefix(prefix string) error

Types

type GetFileFunc

type GetFileFunc func() (io.ReadCloser, error)

type IndexDeduper

type IndexDeduper struct {
	// contains filtered or unexported fields
}

IndexDeduper 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 Cortex anyways dedupes entries across tables

func NewIndexDeduper

func NewIndexDeduper(callback chunk.QueryPagesCallback) *IndexDeduper

func (*IndexDeduper) Callback

func (i *IndexDeduper) Callback(query chunk.IndexQuery, batch chunk.ReadBatch) bool

type IndexStorageClient

type IndexStorageClient interface {
	GetFile(ctx context.Context, tableName, fileName string) (io.ReadCloser, error)
	GetUserFile(ctx context.Context, tableName, userID, fileName string) (io.ReadCloser, error)
}

type TableQuerier

type TableQuerier interface {
	MultiQueries(ctx context.Context, queries []chunk.IndexQuery, callback chunk.QueryPagesCallback) error
}

Jump to

Keyboard shortcuts

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