utils

package
v0.0.0-...-276f339 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

*

  • 2018-02-12, create by mous
  • 内存映射文件 读 写 封装

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BKRDHash

func BKRDHash(_src string) uint32

func Decode

func Decode(_src []byte, _prex byte, _map *[][2]byte, _dst *[]byte)

*

  • 解码 7D02 => 7E, 7D01 => 7D
  • @param _prex 前缀
  • @param _maps byte[][2] 映射表 [ {src, dst} ]

func Encode

func Encode(_src []byte, _prex byte, _map *[][2]byte, _dst *[]byte)

*

  • 转义 0x7E <-----> 0x7D 0x02,
  • 0x7D <-----> 0x7D 0x01, *
  • 头尾不动
  • @param _data 数据
  • @param _prex 前缀
  • @param _maps 映射列表

func ExtractAddr

func ExtractAddr(_ip_port string) (string, int, bool)

func GoExecute

func GoExecute(f func(), name string)

func GoRunAdd

func GoRunAdd(_fun func(_arg interface{}), _name string, _arg ...interface{})

给外部调用的接口 对内直接调用 调度器的 launch 方法即可

func GoRunTerm

func GoRunTerm()

终止任务调度器

func HexToInt

func HexToInt(_s string) int

func IndexOf

func IndexOf(_buf *[]byte, _offset, _len int, _key byte) int

func IsFileExists

func IsFileExists(_file_name string) bool

func NewIniLoader

func NewIniLoader() *tIniLoader

func StrToByte

func StrToByte(_s string) byte

func TestAtack

func TestAtack()

func TestCode

func TestCode()

func TestDirMonitor

func TestDirMonitor()

func TestRW

func TestRW()

func TestRunner

func TestRunner()

func TestStack

func TestStack()

Types

type Atack

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

func NewAtack

func NewAtack(_size int32) *Atack

func (*Atack) Pop

func (s *Atack) Pop() (interface{}, bool)

func (*Atack) Push

func (s *Atack) Push(_val interface{})

数据入栈

type IIniLoader

type IIniLoader interface {
	Load(_ini_path string)
	GetIntVal(_sec string, _key string) (val int, ok bool)
	GetIntAry(_sec string, _key string) (val []int, ok bool)
	GetStrVal(_sec string, _key string) (val string, ok bool)
	GetSection(_sec string) map[string]string
}

type ILineFileBase

type ILineFileBase interface {
	Start()
	Stop()
	IsActive() bool
	String() string
}

公共定义部分

type ILineFileReader

type ILineFileReader interface {
	ILineFileBase
	Pause()
	Resume()
}

数据读取接口

func NewLineFileReader

func NewLineFileReader(fpath string, listener func(string)) ILineFileReader

读部分

type ILineFileWriter

type ILineFileWriter interface {
	ILineFileBase
	Write(string)
}

数据写入接口

func NewLineFileW

func NewLineFileW(fpath string, kbs int) ILineFileWriter

写部分

type IRingIter

type IRingIter interface {
	HasMore() bool
	Next() interface{}
}

type TBufObj

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

func NewBufObj

func NewBufObj(_size int) *TBufObj

func (*TBufObj) ByteAt

func (this *TBufObj) ByteAt(_index int) byte

func (*TBufObj) Clear

func (this *TBufObj) Clear()

func (*TBufObj) Data

func (this *TBufObj) Data() []byte

func (*TBufObj) GetMem

func (this *TBufObj) GetMem(_size int) []byte

func (*TBufObj) IndexOf

func (this *TBufObj) IndexOf(_who byte, _offset int) int

func (*TBufObj) Read

func (this *TBufObj) Read(_size int, _dst *[]byte)

func (*TBufObj) Size

func (this *TBufObj) Size() int

func (*TBufObj) Slice

func (this *TBufObj) Slice() []byte

func (*TBufObj) String

func (this *TBufObj) String() string

func (*TBufObj) ToHex

func (this *TBufObj) ToHex() string

func (*TBufObj) Write

func (this *TBufObj) Write(_buf ...byte)

func (*TBufObj) WriteBuf

func (this *TBufObj) WriteBuf(_buf *TBufObj)

func (*TBufObj) WriteString

func (this *TBufObj) WriteString(_str string)

type TBufPool

type TBufPool struct {
	TStack
	// contains filtered or unexported fields
}

func NewBufPool

func NewBufPool(_pool_size, _buf_size int) (pool *TBufPool)

func (*TBufPool) Pop

func (this *TBufPool) Pop() (buf *TBufObj)

func (*TBufPool) Push

func (this *TBufPool) Push(_buf *TBufObj)

type TDirMonitor

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

func NewDirMonitor

func NewDirMonitor() *TDirMonitor

func (*TDirMonitor) Register

func (this *TDirMonitor) Register(_path string, _file_ext string, _listener tOnFileEvent, _level int, _user_data interface{})

func (*TDirMonitor) SetErrorLogger

func (this *TDirMonitor) SetErrorLogger(_on_err tOnDirMonErrLogger)

func (*TDirMonitor) Start

func (this *TDirMonitor) Start()

func (*TDirMonitor) Stop

func (this *TDirMonitor) Stop()

type TFileEventType

type TFileEventType int

*

  • 文件事件类型
const (
	FET_EXISTS TFileEventType = iota
	FET_CREATE
	FET_MODIFY
	FET_DELETE
)

func (TFileEventType) String

func (this TFileEventType) String() string

type TQueue

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

func NewQueue

func NewQueue() *TQueue

func (*TQueue) IsEmpty

func (this *TQueue) IsEmpty() bool

func (*TQueue) Len

func (this *TQueue) Len() int64

func (*TQueue) Offer

func (this *TQueue) Offer(_val interface{}) int64

func (*TQueue) Poll

func (this *TQueue) Poll(_timeout time.Duration) (val interface{}, ok bool)

type TRingList

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

func NewRingList

func NewRingList() *TRingList

func (*TRingList) Add

func (this *TRingList) Add(_val interface{})

func (*TRingList) Del

func (this *TRingList) Del(_val interface{})

func (*TRingList) Len

func (this *TRingList) Len() int32

func (*TRingList) NewIter

func (this *TRingList) NewIter() IRingIter

type TStack

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

func NewStack

func NewStack() (stack *TStack)

func (*TStack) Len

func (this *TStack) Len() int32

返回堆栈高度

func (*TStack) Pop

func (this *TStack) Pop() (interface{}, bool)

func (*TStack) Push

func (this *TStack) Push(_val interface{})

数据入栈

Jump to

Keyboard shortcuts

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