core

package
v0.0.0-...-3cf5444 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConcurrenceMap

type ConcurrenceMap interface {
	Get(key string) (value interface{}, exists bool)
	GetString(key string) string
	GetInt(key string) int
	GetUInt64(key string) uint64
	Exists(key string) bool
	GetCurrentMap() map[string]interface{}
	Len() int
	Set(key string, value interface{}) error
	Remove(key string)
	Once(key string) (value interface{}, exists bool)
}

ReadonlyMap support concurrence for map

func NewConcurrenceMap

func NewConcurrenceMap() ConcurrenceMap

NewConcurrenceMap create new ConcurrenceMap

type ErrorInfo

type ErrorInfo struct {
	URL    string
	ErrMsg string
	Num    uint64
}

error count info

type HideReaddirFS

type HideReaddirFS struct {
	FileSystem http.FileSystem
}

FileSystem with hide Readdir

func (HideReaddirFS) Open

func (fs HideReaddirFS) Open(name string) (http.File, error)

Conforms to http.Filesystem

type HttpCodeInfo

type HttpCodeInfo struct {
	URL  string
	Code int
	Num  uint64
}

httpcode count info

type ItemMap

type ItemMap struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

ItemMap concurrence map

func NewItemMap

func NewItemMap() *ItemMap

NewItemMap create new ItemMap

func (*ItemMap) Exists

func (ctx *ItemMap) Exists(key string) bool

Exists check exists key

func (*ItemMap) Get

func (ctx *ItemMap) Get(key string) (value interface{}, exists bool)

Get 读取指定key在ItemMap中的内容

func (*ItemMap) GetCurrentMap

func (ctx *ItemMap) GetCurrentMap() map[string]interface{}

GetCurrentMap get current map, returns map[string]interface{}

func (*ItemMap) GetInt

func (ctx *ItemMap) GetInt(key string) int

GetInt 读取指定key在AppContext中的内容,以int格式输出

func (*ItemMap) GetString

func (ctx *ItemMap) GetString(key string) string

GetString 读取指定key在AppContext中的内容,以string格式输出

func (*ItemMap) GetUInt64

func (ctx *ItemMap) GetUInt64(key string) uint64

GetUInt64 读取指定key在AppContext中的内容,以int格式输出

func (*ItemMap) Len

func (ctx *ItemMap) Len() int

Len get context length

func (*ItemMap) Once

func (ctx *ItemMap) Once(key string) (value interface{}, exists bool)

Once get item by gived key, and remove it only can be read once, it will be locked

func (*ItemMap) Remove

func (ctx *ItemMap) Remove(key string)

Remove remove item by gived key if not exists key, do nothing...

func (*ItemMap) Set

func (ctx *ItemMap) Set(key string, value interface{}) error

Set 以key、value置入ItemMap

type ReadonlyMap

type ReadonlyMap interface {
	Get(key string) (value interface{}, exists bool)
	GetString(key string) string
	GetInt(key string) int
	GetUInt64(key string) uint64
	Exists(key string) bool
	Len() int
}

ReadonlyMap only support readonly method for map

func NewReadonlyMap

func NewReadonlyMap() ReadonlyMap

NewReadonlyMap create new ReadonlyMap

type RequestInfo

type RequestInfo struct {
	URL  string
	Code int
	Num  uint64
}

http request count info

type ServerStateInfo

type ServerStateInfo struct {
	//服务启动时间
	ServerStartTime time.Time
	//是否启用详细请求数据统计 fixed #63 状态数据,当url较多时,导致内存占用过大
	EnabledDetailRequestData bool
	//该运行期间总访问次数
	TotalRequestCount uint64
	//单位时间内请求数据 - 按分钟为单位
	IntervalRequestData *ItemMap
	//明细请求页面数据 - 以不带参数的访问url为key
	DetailRequestURLData *ItemMap
	//该运行期间异常次数
	TotalErrorCount uint64
	//单位时间内异常次数 - 按分钟为单位
	IntervalErrorData *ItemMap
	//明细异常页面数据 - 以不带参数的访问url为key
	DetailErrorPageData *ItemMap
	//明细异常数据 - 以不带参数的访问url为key
	DetailErrorData *ItemMap
	//明细Http状态码数据 - 以HttpCode为key,例如200、500等
	DetailHTTPCodeData *ItemMap
	// contains filtered or unexported fields
}

服务器状态信息

var GlobalState *ServerStateInfo

func (*ServerStateInfo) AddErrorCount

func (state *ServerStateInfo) AddErrorCount(page string, err error, num uint64) uint64

AddErrorCount 增加错误数

func (*ServerStateInfo) AddRequestCount

func (state *ServerStateInfo) AddRequestCount(page string, code int, num uint64) uint64

AddRequestCount 增加请求数

func (*ServerStateInfo) QueryIntervalErrorData

func (state *ServerStateInfo) QueryIntervalErrorData(queryKey string) uint64

QueryIntervalErrorData query error count by query time

func (*ServerStateInfo) QueryIntervalRequestData

func (state *ServerStateInfo) QueryIntervalRequestData(queryKey string) uint64

QueryIntervalRequestData query request count by query time

func (*ServerStateInfo) ShowHtmlData

func (state *ServerStateInfo) ShowHtmlData() string

ShowHtmlData show server state data html-string format

Jump to

Keyboard shortcuts

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