common

package
v0.0.0-...-81473b2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlogVerbose = 10
)

Variables

This section is empty.

Functions

func BoolToFloat

func BoolToFloat(value bool) float64

func Contains

func Contains(stringList []string, elem string) bool

func DeleteKeysWithPrefix

func DeleteKeysWithPrefix(keyPrefix string, db badgerwrap.DB, deletionBatchSize int, numOfKeysToDelete uint64) (error, uint64, uint64)

deletes the keys with a given prefix

func GetFilePath

func GetFilePath(filePath string, fileName string) string

func GetKeysForPrefix

func GetKeysForPrefix(db badgerwrap.DB, keyPrefix string) []string

Return all keys within a partition with the given keyPrefix

func GetPartitionsInfo

func GetPartitionsInfo(db badgerwrap.DB) (map[string]*PartitionInfo, uint64)

Gets the Information for partitions to key Count Map Returns Partitions to KeyCount Map, Partitions TableName to Key Count and total key count

func GetSortedPartitionIDs

func GetSortedPartitionIDs(partitionsInfoMap map[string]*PartitionInfo) []string

Returns the sorted list of partitionIDs from the given partitions Info map

func GetTotalKeyCount

func GetTotalKeyCount(db badgerwrap.DB, keyPrefix string) uint64

returns the number of keys in DB with given prefix. If prefix is not provided it gives count of all keys

func Max

func Max(x int, y int) int

func ParseKey

func ParseKey(key string) (error, []string)

func PrintKeyHistogram

func PrintKeyHistogram(db badgerwrap.DB)

prints all the keys histogram. It can help debugging when needed.

func Truncate

func Truncate(text string, width int, delimiter ...string) (string, error)

Types

type PartitionInfo

type PartitionInfo struct {
	TotalKeyCount          uint64
	TableNameToKeyCountMap map[string]uint64
}

type SloopKey

type SloopKey struct {
	TableName   string
	PartitionID string
}

func GetSloopKey

func GetSloopKey(item badgerwrap.Item) (SloopKey, error)

returns TableName, PartitionId, error.

Jump to

Keyboard shortcuts

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