utils

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const BadgerRecommendedMaxFileDescr = 65535

Variables

This section is empty.

Functions

func AbsInt64

func AbsInt64(n int64) int64

AbsInt64 takes an int64 and returns the absolute value Source: http://cavaliercoder.com/blog/optimized-abs-for-int64-in-go.html

func CheckFileDescriptorLimit

func CheckFileDescriptorLimit(limit uint64)

CheckFileDescriptorLimit checks if the OS limit for open file descriptors is high enough and if not, tries to increase it.

func Contains

func Contains(s []string, e string) bool

Contains searches string array s from string e

func CropString

func CropString(s string, size int) string

CropString crops a given string if it is bigger than size

func DiskFree

func DiskFree(path string) (free int64)

func ParseSizeInBytes

func ParseSizeInBytes(sizeStr string) int64

ParseSizeInBytes converts strings like 1GB or 12 mb into an unsigned integer number of bytes

func StdoutIsTerminal added in v1.0.0

func StdoutIsTerminal() bool

Types

type OutOfSpaceError

type OutOfSpaceError string

func NewOutOfSpaceError

func NewOutOfSpaceError(format string, a ...any) OutOfSpaceError

func (OutOfSpaceError) Error

func (o OutOfSpaceError) Error() string

Jump to

Keyboard shortcuts

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