history

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SUCCESS_SUFFIX = config.HISTORY_TAG + "__y"
	FAILURE_SUFFIX = config.HISTORY_TAG + "__n"
	SUCCESS_FILE   = config.HISTORY_DIR + "/" + SUCCESS_SUFFIX
	FAILURE_FILE   = config.HISTORY_DIR + "/" + FAILURE_SUFFIX
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Failure

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

func (*Failure) DeleteFailure

func (self *Failure) DeleteFailure(req *request.Request)

删除失败记录

func (*Failure) PullFailure

func (self *Failure) PullFailure() map[string]*request.Request

func (*Failure) UpsertFailure

func (self *Failure) UpsertFailure(req *request.Request) bool

更新或加入失败记录, 对比是否已存在,不存在就记录, 返回值表示是否有插入操作。

type Historier

type Historier interface {
	ReadSuccess(provider string, inherit bool) // 读取成功记录
	UpsertSuccess(string) bool                 // 更新或加入成功记录
	HasSuccess(string) bool                    // 检查是否存在某条成功记录
	FlushSuccess(provider string)              // I/O输出成功记录,但不清缓存

	ReadFailure(provider string, inherit bool) // 取出失败记录
	PullFailure() map[string]*request.Request  // 拉取失败记录并清空
	UpsertFailure(*request.Request) bool       // 更新或加入失败记录
	DeleteFailure(*request.Request)            // 删除失败记录
	FlushFailure(provider string)              // I/O输出失败记录,但不清缓存

	Empty() // 清空缓存,但不输出
}

func New

func New(name string, subName string) Historier

type History

type History struct {
	*Success
	*Failure

	sync.RWMutex
	// contains filtered or unexported fields
}

func (*History) Empty

func (self *History) Empty()

清空缓存,但不输出

func (*History) FlushFailure

func (self *History) FlushFailure(provider string)

I/O输出失败记录,但不清缓存

func (*History) FlushSuccess

func (self *History) FlushSuccess(provider string)

I/O输出成功记录,但不清缓存

func (*History) ReadFailure

func (self *History) ReadFailure(provider string, inherit bool)

取出失败记录

func (*History) ReadSuccess

func (self *History) ReadSuccess(provider string, inherit bool)

读取成功记录

type Success

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

func (*Success) HasSuccess

func (self *Success) HasSuccess(reqUnique string) bool

func (*Success) UpsertSuccess

func (self *Success) UpsertSuccess(reqUnique string) bool

更新或加入成功记录, 对比是否已存在,不存在就记录, 返回值表示是否有插入操作。

Jump to

Keyboard shortcuts

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