utils

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: AGPL-3.0 Imports: 15 Imported by: 34

Documentation

Index

Constants

View Source
const ZSTD_LEVEL = 1 // fastest

Variables

This section is empty.

Functions

func Alloc

func Alloc(size int) []byte

func CopyFile added in v0.9.0

func CopyFile(dst, src string) error

func Exists

func Exists(path string) bool

func Free

func Free(buf []byte)

func GetLogger

func GetLogger(name string) *logHandle

func GetStdLogger added in v0.9.0

func GetStdLogger(l *logHandle, lvl logrus.Level) *glog.Logger

func InitLoggers

func InitLoggers(logToSyslog bool)

func Min

func Min(a, b int) int

func NewLogger added in v0.9.0

func NewLogger(name string) *logHandle

func SetLogLevel

func SetLogLevel(lvl logrus.Level)

func UsedMemory added in v0.9.0

func UsedMemory() int64

Types

type Buffer

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

func FromBuffer

func FromBuffer(buf []byte) *Buffer

func NewBuffer

func NewBuffer(sz uint32) *Buffer

func NewNativeBuffer

func NewNativeBuffer(buf []byte) *Buffer

func ReadBuffer

func ReadBuffer(buf []byte) *Buffer

func (*Buffer) Buffer

func (b *Buffer) Buffer() []byte

func (*Buffer) Bytes

func (b *Buffer) Bytes() []byte

func (*Buffer) Get

func (b *Buffer) Get(l int) []byte

func (*Buffer) Get16

func (b *Buffer) Get16() uint16

func (*Buffer) Get32

func (b *Buffer) Get32() uint32

func (*Buffer) Get64

func (b *Buffer) Get64() uint64

func (*Buffer) Get8

func (b *Buffer) Get8() uint8

func (*Buffer) HasMore

func (b *Buffer) HasMore() bool

func (*Buffer) Left

func (b *Buffer) Left() int

func (*Buffer) Len

func (b *Buffer) Len() int

func (*Buffer) Put

func (b *Buffer) Put(v []byte)

func (*Buffer) Put16

func (b *Buffer) Put16(v uint16)

func (*Buffer) Put32

func (b *Buffer) Put32(v uint32)

func (*Buffer) Put64

func (b *Buffer) Put64(v uint64)

func (*Buffer) Put8

func (b *Buffer) Put8(v uint8)

func (*Buffer) Seek

func (b *Buffer) Seek(p int)

func (*Buffer) SetBytes

func (b *Buffer) SetBytes(buf []byte)

type Compressor added in v0.9.0

type Compressor interface {
	Name() string
	CompressBound(int) int
	Compress(dst, src []byte) (int, error)
	Decompress(dst, src []byte) (int, error)
}

func NewCompressor added in v0.9.0

func NewCompressor(algr string) Compressor

type Cond

type Cond struct {
	L sync.Locker
	// contains filtered or unexported fields
}

func NewCond

func NewCond(lock sync.Locker) *Cond

func (*Cond) Broadcast

func (c *Cond) Broadcast()

func (*Cond) Signal

func (c *Cond) Signal()

func (*Cond) Wait added in v0.9.0

func (c *Cond) Wait()

func (*Cond) WaitWithTimeout

func (c *Cond) WaitWithTimeout(d time.Duration) bool

type LZ4 added in v0.9.0

type LZ4 struct{}

func (LZ4) Compress added in v0.9.0

func (l LZ4) Compress(dst, src []byte) (int, error)

func (LZ4) CompressBound added in v0.9.0

func (l LZ4) CompressBound(size int) int

func (LZ4) Decompress added in v0.9.0

func (l LZ4) Decompress(dst, src []byte) (int, error)

func (LZ4) Name added in v0.9.0

func (l LZ4) Name() string

type SyslogHook

type SyslogHook struct {
	*logrus_syslog.SyslogHook
}

func (*SyslogHook) Fire

func (hook *SyslogHook) Fire(entry *logrus.Entry) error

type ZStandard added in v0.9.0

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

func (ZStandard) Compress added in v0.9.0

func (n ZStandard) Compress(dst, src []byte) (int, error)

func (ZStandard) CompressBound added in v0.9.0

func (n ZStandard) CompressBound(l int) int

func (ZStandard) Decompress added in v0.9.0

func (n ZStandard) Decompress(dst, src []byte) (int, error)

func (ZStandard) Name added in v0.9.0

func (n ZStandard) Name() string

Jump to

Keyboard shortcuts

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