util

package
v0.0.0-...-c120cdd Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetChecksumString

func GetChecksumString(checksum []byte) string

GetChecksumString returns string from checksum bytes

func GetSHA1Sum

func GetSHA1Sum(str string) (string, error)

GetSHA1Sum returns sha1 check sum string

func ParseTime

func ParseTime(s string) (time.Time, error)

ParseTime parses RFC3339 formatted time string to time.Time

func StackTraceFromPanic

func StackTraceFromPanic(logger *log.Entry)

func TimeString

func TimeString(t time.Time) string

TimeString formats time.Time as RFC3339 string

Types

type FileBlockHelper

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

FileBlockHelper helps block/offset related calculation

func NewFileBlockHelper

func NewFileBlockHelper(blockSize int) *FileBlockHelper

func (*FileBlockHelper) GetAllBlockIDs

func (helper *FileBlockHelper) GetAllBlockIDs(offset int64, length int) []int64

GetAllBlockIDs returns all block ids for the given range

func (*FileBlockHelper) GetBlockID

func (helper *FileBlockHelper) GetBlockID(offset int64) int64

GetBlockID returns block index for a given offset

func (*FileBlockHelper) GetBlockIDs

func (helper *FileBlockHelper) GetBlockIDs(offset int64, length int) (int64, int64)

GetBlockIDs returns first and last block id for the given range

func (*FileBlockHelper) GetBlockOffset

func (helper *FileBlockHelper) GetBlockOffset(offset int64) int64

GetBlockOffset returns offset within a block for a given absolute offset

func (*FileBlockHelper) GetBlockRange

func (helper *FileBlockHelper) GetBlockRange(offset int64, length int, blockID int64) (int64, int)

GetBlockRange returns offset and length for given block, within given offset and length

func (*FileBlockHelper) GetBlockSize

func (helper *FileBlockHelper) GetBlockSize() int

GetBlockSize returns block size

func (*FileBlockHelper) GetBlockStart

func (helper *FileBlockHelper) GetBlockStart(blockID int64) int64

GetBlockStart returns block start offset for a given block ID

func (*FileBlockHelper) GetLastBlockID

func (helper *FileBlockHelper) GetLastBlockID(size int64) int64

GetLastBlockID returns the last block of the file

func (*FileBlockHelper) IsAligned

func (helper *FileBlockHelper) IsAligned(offset int64) bool

IsAligned checks if offset is aligned to block start

type StacktraceTextFormatter

type StacktraceTextFormatter struct {
	TextFormatter log.TextFormatter
}

func (*StacktraceTextFormatter) Format

func (f *StacktraceTextFormatter) Format(entry *log.Entry) ([]byte, error)

Jump to

Keyboard shortcuts

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