status

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

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

func RunTask

func RunTask()

RunTask 用于运行统计流程

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

type SDownServer

type SDownServer []DownServer

SDownServer 是 []DownServer(请求异常产生的类型) 的抽象方法,提供了一系列的便捷操作

func (*SDownServer) Convert

func (p *SDownServer) Convert() []types.DownServerData

Convert 可快捷转换类型为 []types.DownServerData

func (*SDownServer) Exclude

func (p *SDownServer) Exclude(keys []string)

Exclude 用于去除提供 keys 的元素

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

Find 取得给定 ID 的记录

func (*TDownServerList) Merge

func (p *TDownServerList) Merge(newCollection SDownServer) []types.DownServerData

Merge 用于和新宕机集合对比,更新现有记录,返回新记录

func (*TDownServerList) Recover

func (p *TDownServerList) Recover()

Recover 函数用于从缓存种恢复

func (*TDownServerList) Remove

func (p *TDownServerList) Remove(id string)

Remove 移除给定 ID 的记录

func (*TDownServerList) Save

func (p *TDownServerList) Save()

Save 用于保存到缓存

func (*TDownServerList) Unique

func (p *TDownServerList) Unique()

Unique 集合去重

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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