Documentation
¶
Index ¶
- Variables
- func RunTask()
- type DownServer
- type GenStatusRequestFailureError
- type SDownServer
- type TDownServerList
- func (p *TDownServerList) Add(data ...types.DownServerData)
- func (p *TDownServerList) Diff(list []database.APIRecord)
- func (p *TDownServerList) Exist(id string) bool
- func (p *TDownServerList) Find(id string) (*types.DownServerData, bool)
- func (p *TDownServerList) Merge(newCollection SDownServer) []types.DownServerData
- func (p *TDownServerList) Recover()
- func (p *TDownServerList) Remove(id string)
- func (p *TDownServerList) Save()
- func (p *TDownServerList) Unique()
Constants ¶
This section is empty.
Variables ¶
View Source
var DownServerList = &TDownServerList{}
DownServerList 是用于外部调用的保存宕机记录的变量
View Source
var LimitedHost = []string{
"v1.hitokoto.cn",
"international.v1.hitokoto.cn",
"api.a632079.me",
}
LimitedHost 以编码模式定义了应统计的 API 主机地址
Functions ¶
Types ¶
type DownServer ¶
type DownServer struct {
ID string
StartTS int64
Cause string
Error error
IsGenStatusRequestFailureError bool
}
DownServer 定义了请求中出现异常时应递交给合并器的类型
type GenStatusRequestFailureError ¶
type GenStatusRequestFailureError struct {
Code int // HTTP Response Code, or API Error code
Detail string // Error Message
ResponseData *resty.Response // Response Data
Stack []byte // Call Stack
}
GenStatusRequestFailureError 定义了统计请求时产生异常的错误类型
func (*GenStatusRequestFailureError) Error ¶
func (e *GenStatusRequestFailureError) Error() string
type SDownServer ¶
type SDownServer []DownServer
SDownServer 是 []DownServer(请求异常产生的类型) 的抽象方法,提供了一系列的便捷操作
func (*SDownServer) Convert ¶
func (p *SDownServer) Convert() []types.DownServerData
Convert 可快捷转换类型为 []types.DownServerData
func (*SDownServer) Exist ¶
func (p *SDownServer) Exist(key string) bool
Exist 用于检索切片中是否存在指定 key 的内容
type TDownServerList ¶
type TDownServerList []types.DownServerData
TDownServerList 是 []types.DownServerData 的操作类型
func (*TDownServerList) Add ¶
func (p *TDownServerList) Add(data ...types.DownServerData)
Add 向集合添加记录
func (*TDownServerList) Diff ¶
func (p *TDownServerList) Diff(list []database.APIRecord)
Diff 与数据库中的接口记录对比,筛除失效 ID
func (*TDownServerList) Exist ¶
func (p *TDownServerList) Exist(id string) bool
Exist 查询切片中是否存在给定 id 的记录
func (*TDownServerList) Find ¶
func (p *TDownServerList) Find(id string) (*types.DownServerData, bool)
Find 取得给定 ID 的记录
func (*TDownServerList) Merge ¶
func (p *TDownServerList) Merge(newCollection SDownServer) []types.DownServerData
Merge 用于和新宕机集合对比,更新现有记录,返回新记录
Click to show internal directories.
Click to hide internal directories.