Documentation
¶
Index ¶
- Variables
- func InitializeDuplicateChecker(config *settings.Config) error
- func SetDuplicateChecker(checker DuplicateChecker)
- type DuplicateChecker
- type DuplicateCheckerContainer
- func (c *DuplicateCheckerContainer) GetFailureCount(failureKey string) uint32
- func (c *DuplicateCheckerContainer) GetOrSetCronJobRunningInfo(jobName string, runningInfo string, runningInterval time.Duration) (bool, string)
- func (c *DuplicateCheckerContainer) GetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string) (bool, string)
- func (c *DuplicateCheckerContainer) IncreaseFailureCount(failureKey string) uint32
- func (c *DuplicateCheckerContainer) IsEnabled() bool
- func (c *DuplicateCheckerContainer) RemoveCronJobRunningInfo(jobName string)
- func (c *DuplicateCheckerContainer) RemoveSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string)
- func (c *DuplicateCheckerContainer) SetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string, ...)
- type DuplicateCheckerType
- type InMemoryDuplicateChecker
- func (c *InMemoryDuplicateChecker) GetFailureCount(failureKey string) uint32
- func (c *InMemoryDuplicateChecker) GetOrSetCronJobRunningInfo(jobName string, runningInfo string, runningInterval time.Duration) (bool, string)
- func (c *InMemoryDuplicateChecker) GetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string) (bool, string)
- func (c *InMemoryDuplicateChecker) IncreaseFailureCount(failureKey string) uint32
- func (c *InMemoryDuplicateChecker) RemoveCronJobRunningInfo(jobName string)
- func (c *InMemoryDuplicateChecker) RemoveSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string)
- func (c *InMemoryDuplicateChecker) SetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string, ...)
Constants ¶
This section is empty.
Variables ¶
var (
Container = &DuplicateCheckerContainer{}
)
Initialize a duplicate checker container singleton instance
Functions ¶
func InitializeDuplicateChecker ¶
InitializeDuplicateChecker initializes the current duplicate checker according to the config
func SetDuplicateChecker ¶ added in v1.0.0
func SetDuplicateChecker(checker DuplicateChecker)
SetDuplicateChecker sets the current duplicate checker
Types ¶
type DuplicateChecker ¶
type DuplicateChecker interface {
GetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string) (bool, string)
SetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string, remark string)
RemoveSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string)
GetOrSetCronJobRunningInfo(jobName string, runningInfo string, runningInterval time.Duration) (bool, string)
RemoveCronJobRunningInfo(jobName string)
GetFailureCount(failureKey string) uint32
IncreaseFailureCount(failureKey string) uint32
}
DuplicateChecker is common duplicate checker interface
type DuplicateCheckerContainer ¶
type DuplicateCheckerContainer struct {
// contains filtered or unexported fields
}
DuplicateCheckerContainer contains the current duplicate checker
func (*DuplicateCheckerContainer) GetFailureCount ¶ added in v0.8.0
func (c *DuplicateCheckerContainer) GetFailureCount(failureKey string) uint32
GetFailureCount returns the failure count of the specified failure key
func (*DuplicateCheckerContainer) GetOrSetCronJobRunningInfo ¶ added in v0.6.0
func (c *DuplicateCheckerContainer) GetOrSetCronJobRunningInfo(jobName string, runningInfo string, runningInterval time.Duration) (bool, string)
GetOrSetCronJobRunningInfo returns the running info when the cron job is running or saves the running info by the current duplicate checker
func (*DuplicateCheckerContainer) GetSubmissionRemark ¶ added in v0.6.0
func (c *DuplicateCheckerContainer) GetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string) (bool, string)
GetSubmissionRemark returns whether the same submission has been processed and related remark by the current duplicate checker
func (*DuplicateCheckerContainer) IncreaseFailureCount ¶ added in v0.8.0
func (c *DuplicateCheckerContainer) IncreaseFailureCount(failureKey string) uint32
IncreaseFailureCount increases the failure count of the specified failure key
func (*DuplicateCheckerContainer) IsEnabled ¶ added in v1.0.0
func (c *DuplicateCheckerContainer) IsEnabled() bool
IsEnabled returns whether the duplicate checker is enabled
func (*DuplicateCheckerContainer) RemoveCronJobRunningInfo ¶ added in v0.6.0
func (c *DuplicateCheckerContainer) RemoveCronJobRunningInfo(jobName string)
RemoveCronJobRunningInfo removes the running info of the cron job by the current duplicate checker
func (*DuplicateCheckerContainer) RemoveSubmissionRemark ¶ added in v0.9.0
func (c *DuplicateCheckerContainer) RemoveSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string)
RemoveSubmissionRemark removes the identification and remark by the current duplicate checker
func (*DuplicateCheckerContainer) SetSubmissionRemark ¶ added in v0.6.0
func (c *DuplicateCheckerContainer) SetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string, remark string)
SetSubmissionRemark saves the identification and remark by the current duplicate checker
type DuplicateCheckerType ¶
type DuplicateCheckerType uint8
DuplicateCheckerType represents duplicate checker type
const ( DUPLICATE_CHECKER_TYPE_BACKGROUND_CRON_JOB DuplicateCheckerType = 0 DUPLICATE_CHECKER_TYPE_NEW_ACCOUNT DuplicateCheckerType = 1 DUPLICATE_CHECKER_TYPE_NEW_SUBACCOUNT DuplicateCheckerType = 2 DUPLICATE_CHECKER_TYPE_NEW_CATEGORY DuplicateCheckerType = 3 DUPLICATE_CHECKER_TYPE_NEW_TRANSACTION DuplicateCheckerType = 4 DUPLICATE_CHECKER_TYPE_NEW_TEMPLATE DuplicateCheckerType = 5 DUPLICATE_CHECKER_TYPE_NEW_PICTURE DuplicateCheckerType = 6 DUPLICATE_CHECKER_TYPE_IMPORT_TRANSACTIONS DuplicateCheckerType = 7 DUPLICATE_CHECKER_TYPE_FAILURE_CHECK DuplicateCheckerType = 255 )
Types of uuid
type InMemoryDuplicateChecker ¶
type InMemoryDuplicateChecker struct {
// contains filtered or unexported fields
}
InMemoryDuplicateChecker represents in-memory duplicate checker
func NewInMemoryDuplicateChecker ¶
func NewInMemoryDuplicateChecker(config *settings.Config) (*InMemoryDuplicateChecker, error)
NewInMemoryDuplicateChecker returns a new in-memory duplicate checker
func (*InMemoryDuplicateChecker) GetFailureCount ¶ added in v0.8.0
func (c *InMemoryDuplicateChecker) GetFailureCount(failureKey string) uint32
GetFailureCount returns the failure count of the specified failure key
func (*InMemoryDuplicateChecker) GetOrSetCronJobRunningInfo ¶ added in v0.6.0
func (c *InMemoryDuplicateChecker) GetOrSetCronJobRunningInfo(jobName string, runningInfo string, runningInterval time.Duration) (bool, string)
GetOrSetCronJobRunningInfo returns the running info when the cron job is running or saves the running info by the current duplicate checker
func (*InMemoryDuplicateChecker) GetSubmissionRemark ¶ added in v0.6.0
func (c *InMemoryDuplicateChecker) GetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string) (bool, string)
GetSubmissionRemark returns whether the same submission has been processed and related remark
func (*InMemoryDuplicateChecker) IncreaseFailureCount ¶ added in v0.8.0
func (c *InMemoryDuplicateChecker) IncreaseFailureCount(failureKey string) uint32
IncreaseFailureCount increases the failure count of the specified failure key
func (*InMemoryDuplicateChecker) RemoveCronJobRunningInfo ¶ added in v0.6.0
func (c *InMemoryDuplicateChecker) RemoveCronJobRunningInfo(jobName string)
RemoveCronJobRunningInfo removes the running info of the cron job by the current duplicate checker
func (*InMemoryDuplicateChecker) RemoveSubmissionRemark ¶ added in v0.9.0
func (c *InMemoryDuplicateChecker) RemoveSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string)
RemoveSubmissionRemark removes the identification and remark in in-memory cache
func (*InMemoryDuplicateChecker) SetSubmissionRemark ¶ added in v0.6.0
func (c *InMemoryDuplicateChecker) SetSubmissionRemark(checkerType DuplicateCheckerType, uid int64, identification string, remark string)
SetSubmissionRemark saves the identification and remark to in-memory cache