utils

package
v0.0.0-...-2487acb Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2017 License: Apache-2.0 Imports: 15 Imported by: 5

Documentation

Index

Constants

View Source
const (
	CR = '\r'
	LF = '\n'
)
View Source
const (
	FIELDS_BUFFER = 8
)

Variables

This section is empty.

Functions

func BlankString

func BlankString(str string) bool

func BytesToString

func BytesToString(data []byte) string

String force casts a []byte to a string. Used as hack for string() when str is used as temp val

func BytesToUint64

func BytesToUint64(bytes []byte) uint64

func ClearPidFile

func ClearPidFile() error

func Fields

func Fields(data []byte) [][]byte

Fields split data into fields by space ' '.

func GenTestMessage

func GenTestMessage(length int) string

func GetIntFromArgs

func GetIntFromArgs(args map[string]interface{}, arg string, defaultVar int) (int, error)

func GetPid

func GetPid() (int, error)

func LocateLineIdx

func LocateLineIdx(prefix, data []byte) int

locate the "\r\n" index out of data. be carefull the '\r' may be in prefix, and '\n' be in data

func StringToBytes

func StringToBytes(str string) []byte

func Uint64ToBytes

func Uint64ToBytes(u uint64) []byte

func ValidParam

func ValidParam(str string) bool

func WritePid

func WritePid() error

func WritePidWithVal

func WritePidWithVal(pid int) error

Types

type BenchmarkTester

type BenchmarkTester struct {
	Count int64
	// contains filtered or unexported fields
}

func NewBenchmarkTester

func NewBenchmarkTester(concurrentLevel int, duration int, task TesterTask, clean TesterClean) *BenchmarkTester

func (*BenchmarkTester) Run

func (bt *BenchmarkTester) Run() error

type BufferedLineReader

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

func NewBufferedLineReader

func NewBufferedLineReader(r io.Reader, size int) *BufferedLineReader

func (*BufferedLineReader) ReadLine

func (b *BufferedLineReader) ReadLine() ([]byte, error)

func (*BufferedLineReader) Reset

func (b *BufferedLineReader) Reset()

type Conn

type Conn struct {
	net.Conn
	// contains filtered or unexported fields
}

func (*Conn) Close

func (c *Conn) Close() error

type Int32Slice

type Int32Slice []int32

func (Int32Slice) Len

func (slice Int32Slice) Len() int

func (Int32Slice) Less

func (slice Int32Slice) Less(i, j int) bool

func (Int32Slice) Swap

func (slice Int32Slice) Swap(i, j int)

type LineReader

type LineReader interface {
	ReadLine() ([]byte, error)
}

type Listener

type Listener struct {
	net.Listener
	// contains filtered or unexported fields
}

func Listen

func Listen(netType, laddr string) (*Listener, error)

func (*Listener) Accept

func (l *Listener) Accept() (net.Conn, error)

func (*Listener) GetRemain

func (l *Listener) GetRemain() int64

type TesterClean

type TesterClean func(bt *BenchmarkTester)

type TesterTask

type TesterTask func(bt *BenchmarkTester, index int) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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