base

package module
v0.0.0-...-411c52e Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 19 Imported by: 5

Documentation

Index

Constants

View Source
const (
	LogLevelVerbose = iota
	LogLevelInfo
	LogLevelWarn
	LogLevelError
)

Variables

View Source
var LogLevelTags = []string{"V", "I", "W", "E"}

Functions

func AbsForInt32

func AbsForInt32(n int) int

func AbsForInt64

func AbsForInt64(n int64) int64

func CombineBytes

func CombineBytes(bs ...[]byte) []byte

func Daemon

func Daemon()

func GeneratePID

func GeneratePID(pidFile string)

func GetGoroutineId

func GetGoroutineId() int

Get the ID of the current Goroutine

func LogError

func LogError(format string, v ...interface{})

func LogInfo

func LogInfo(format string, v ...interface{})

func LogInit

func LogInit(level int, prefix string) error

func LogPanic

func LogPanic(ierr interface{})

func LogRaw

func LogRaw(s string)

func LogVerbose

func LogVerbose(format string, v ...interface{})

func LogWarn

func LogWarn(format string, v ...interface{})

func MaskBytes

func MaskBytes(raw []byte, mask byte, bitSize byte) []byte

func ReadAsciiCode

func ReadAsciiCode(raw []byte) byte

func ReadPIDs

func ReadPIDs(pidFile string) (error, []int)

func RemovePID

func RemovePID(pidFile string)

func TestMask

func TestMask(n int, mask int) bool

func UnMaskBytes

func UnMaskBytes(raw []byte, bitSize byte) (byte, []byte)

func WaitExitSignal

func WaitExitSignal() os.Signal

Waiting for a signal for the process to exit or interrupt

Types

type Buffer

type Buffer interface {
	Read([]byte) (int, error)
	Next(int) ([]byte, int)
	Peek(int) ([]byte, int)
	Write([]byte) (int, error)
	Reset()
	Len() int
}

type ChannelQueue

type ChannelQueue chan interface{}

func (ChannelQueue) Close

func (c ChannelQueue) Close()

type CloveId

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

func (CloveId) Data

func (id CloveId) Data() []byte

func (CloveId) DataWithByteOrder

func (id CloveId) DataWithByteOrder(byteOrder binary.ByteOrder) []byte

func (CloveId) Integer

func (id CloveId) Integer() uint64

type CloveMap

type CloveMap interface {
	Set(key, value interface{})
	Get(key interface{}) interface{}

	Pop(key interface{}) interface{}
	Clear()

	HasKey(key interface{}) bool

	Count() int

	Keys() []interface{}
	Values() []interface{}
	Items() []KeyValue

	IterItems() <-chan KeyValue
}

Extended map interface

func NewAsyncCloveMap

func NewAsyncCloveMap() CloveMap

Create an async CloveMap object

func NewCloveMap

func NewCloveMap(block bool) CloveMap

Create a CloveMap object

func NewSyncCloveMap

func NewSyncCloveMap() CloveMap

Create a sync CloveMap object

type IdGenerator

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

func GetIdGenerator

func GetIdGenerator() *IdGenerator

func (*IdGenerator) NextId

func (idGen *IdGenerator) NextId() <-chan CloveId

func (*IdGenerator) NextIdWithSeed

func (idGen *IdGenerator) NextIdWithSeed(seed uint) <-chan CloveId

type KeyValue

type KeyValue struct {
	Key   interface{}
	Value interface{}
}

Dictionary key-value pair object

type MachineID

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

func GetMachineID

func GetMachineID() *MachineID

func (MachineID) GetCPUID

func (id MachineID) GetCPUID() []string

func (MachineID) GetHWADDR

func (id MachineID) GetHWADDR() []string

func (MachineID) GetHash

func (id MachineID) GetHash() []byte

func (MachineID) GetHashString

func (id MachineID) GetHashString() string

type StandardBuffer

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

func (*StandardBuffer) Len

func (b *StandardBuffer) Len() int

func (*StandardBuffer) Next

func (b *StandardBuffer) Next(n int) ([]byte, int)

func (*StandardBuffer) Peek

func (b *StandardBuffer) Peek(n int) ([]byte, int)

func (*StandardBuffer) Read

func (b *StandardBuffer) Read(p []byte) (int, error)

func (*StandardBuffer) Reset

func (b *StandardBuffer) Reset()

func (*StandardBuffer) Write

func (b *StandardBuffer) Write(p []byte) (int, error)

type SyncBuffer

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

func (*SyncBuffer) Len

func (b *SyncBuffer) Len() int

func (*SyncBuffer) Next

func (b *SyncBuffer) Next(n int) ([]byte, int)

func (*SyncBuffer) Peek

func (b *SyncBuffer) Peek(n int) ([]byte, int)

func (*SyncBuffer) Read

func (b *SyncBuffer) Read(p []byte) (int, error)

func (*SyncBuffer) Reset

func (b *SyncBuffer) Reset()

func (*SyncBuffer) Write

func (b *SyncBuffer) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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