utils

package
v0.0.0-...-8bd0779 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Apache-2.0 Imports: 6 Imported by: 6

Documentation

Index

Constants

View Source
const (
	BatchOpTypeUnkonw byte = iota
	BatchOpTypePut
	BatchOpTypeDel
)

Variables

This section is empty.

Functions

func AsyncNoBlockSend

func AsyncNoBlockSend(ch chan<- struct{})

AsyncNoBlockSend async no block send notify channel.

func AsyncNoBlockSendUint64

func AsyncNoBlockSendUint64(ch chan uint64, v uint64)

AsyncNoBlockSendUint64 async no block send Uint64 channel.

func BuildMatchRegexp

func BuildMatchRegexp(match string) (*regexp.Regexp, error)

func Bytes2String

func Bytes2String(b []byte) (s string)

no copy to change slice to string use your own risk

func ConcatBytes

func ConcatBytes(slices [][]byte) []byte

func GetProto

func GetProto(addr string) string

GetProto get proto by addr

func IsNil

func IsNil(i interface{}) bool

func MinInt

func MinInt(a int, b int) int

MinInt

func StrInt32

func StrInt32(v []byte, err error) (int32, error)

StrInt32 gets the 32 integer with string format.

func StrInt64

func StrInt64(v []byte, err error) (int64, error)

StrInt64 gets the 64 integer with string format.

func StrInt8

func StrInt8(v []byte, err error) (int8, error)

StrInt8 ets the 8 integer with string format.

func StrUint64

func StrUint64(v []byte, err error) (uint64, error)

StrUint64 gets the unsigned 64 integer with string format.

func String2Bytes

func String2Bytes(s string) (b []byte)

no copy to change string to slice use your own risk

Types

type BatchOp

type BatchOp struct {
	Type       byte
	Key, Value []byte
}

type BatchOpBuffer

type BatchOpBuffer struct {
	// use list to batch once commit batch put one i/o syscall
	// async --> system buff - flush ->disk
	// sync - flush -> disk
	OpList list.List
}

func NewBatchOpBuffer

func NewBatchOpBuffer() *BatchOpBuffer

func (*BatchOpBuffer) Del

func (bt *BatchOpBuffer) Del(key []byte)

func (*BatchOpBuffer) FrontElement

func (bt *BatchOpBuffer) FrontElement() *list.Element

func (*BatchOpBuffer) Len

func (bt *BatchOpBuffer) Len() int

func (*BatchOpBuffer) Put

func (bt *BatchOpBuffer) Put(key, value []byte)

func (*BatchOpBuffer) Reset

func (bt *BatchOpBuffer) Reset()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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