Documentation
¶
Index ¶
- Constants
- Variables
- func ArgBind(c *xin.Context, a any) error
- func CleanOutdatedJobChains()
- func CleanOutdatedJobs()
- func JobAbortChain(tjc xjm.JobChainer, jc *xjm.JobChain, jid int64, reason string) (bool, error)
- func JobCancelChain(tjc xjm.JobChainer, jc *xjm.JobChain, jid int64, reason string) (bool, error)
- func JobChainAbort(tjc xjm.JobChainer, tjm xjm.JobManager, jc *xjm.JobChain, reason string) error
- func JobChainAppendJob(tt *tenant.Tenant, name, locale string, cid int64, csq int, cdt bool) error
- func JobChainCancel(tjc xjm.JobChainer, tjm xjm.JobManager, jc *xjm.JobChain, reason string) error
- func JobChainEncodeStates(states []*JobRunState) string
- func JobChainStart(tt *tenant.Tenant, chainName string, states []*JobRunState, ...) (cid int64, err error)
- func JobFindAndCancelChain(tt *tenant.Tenant, cid, jid int64, reason string) error
- func JobStatusText(js string) string
- func ReappendJobs()
- func RegisterJobArg(name string, jac JobArgCreater)
- func RegisterJobRun(name string, jrc JobRunCreator)
- func StartJobs(tt *tenant.Tenant) error
- func Starts()
- func Stats() string
- type ArgChain
- type ArgIDRange
- type ArgItems
- type ArgPeriod
- type FailedItem
- type IArg
- type IArgChain
- type IRun
- type JobArgCreater
- type JobRunCreator
- type JobRunState
- type JobRunner
- func (jr *JobRunner[T]) Abort(reason string)
- func (jr *JobRunner[T]) AddFailedItem(id int64, title, reason string)
- func (jr *JobRunner[T]) Checkout() error
- func (jr *JobRunner[T]) Done(err error)
- func (jr *JobRunner[T]) Finish()
- func (jr *JobRunner[T]) Running() (context.Context, context.CancelCauseFunc)
- func (jr *JobRunner[T]) SetState(state iState) error
- type JobState
- func (js *JobState) Counts() string
- func (js *JobState) IncFailure()
- func (js *JobState) IncSkipped()
- func (js *JobState) IncSuccess()
- func (js *JobState) IsStepLimited() bool
- func (js *JobState) Progress() string
- func (js *JobState) SetTotalLimit(total, limit int)
- func (js *JobState) State() JobState
- type JobStateEx
- type JobStateFsx
- type JobStateSx
Constants ¶
View Source
const ( JobNameUserCsvImport = "UserCsvImport" JobNamePetClear = "PetClear" JobNamePetCatCreate = "PetCatCreate" JobNamePetDogCreate = "PetDogCreate" )
View Source
const (
JobChainPetReset = "PetReset"
)
Variables ¶
View Source
var (
ErrItemSkip = errors.New("item skip")
)
View Source
var ErrJobOverflow = errors.New("Job Overflow")
-----------------------------
Functions ¶
func CleanOutdatedJobChains ¶
func CleanOutdatedJobChains()
CleanOutdatedJobChains iterate schemas to clean outdated job chains
func CleanOutdatedJobs ¶
func CleanOutdatedJobs()
------------------------------------ CleanOutdatedJobs iterate schemas to clean outdated jobs
func JobAbortChain ¶
func JobCancelChain ¶
func JobChainAbort ¶
func JobChainAbort(tjc xjm.JobChainer, tjm xjm.JobManager, jc *xjm.JobChain, reason string) error
func JobChainAppendJob ¶
func JobChainCancel ¶
func JobChainCancel(tjc xjm.JobChainer, tjm xjm.JobManager, jc *xjm.JobChain, reason string) error
func JobChainEncodeStates ¶
func JobChainEncodeStates(states []*JobRunState) string
func JobChainStart ¶
func JobFindAndCancelChain ¶
func JobStatusText ¶
func RegisterJobArg ¶
func RegisterJobArg(name string, jac JobArgCreater)
func RegisterJobRun ¶
func RegisterJobRun(name string, jrc JobRunCreator)
Types ¶
type ArgChain ¶
type ArgChain struct { ChainSeq int `json:"chain_seq,omitempty" form:"-"` ChainData bool `json:"chain_data,omitempty" form:"chain_data"` }
func (*ArgChain) ShouldChainData ¶
type ArgIDRange ¶
type ArgItems ¶
type ArgItems struct {
Items int `json:"items,omitempty" form:"items,strip" validate:"min=0"`
}
type ArgPeriod ¶
type FailedItem ¶
type FailedItem struct { ID int64 `json:"id"` Title string `json:"title"` Error string `json:"error"` }
func (*FailedItem) Quoted ¶
func (si *FailedItem) Quoted() string
func (*FailedItem) String ¶
func (si *FailedItem) String() string
type JobArgCreater ¶
type JobRunState ¶
type JobRunState struct { JID int64 `json:"jid"` Name string `json:"name"` Status string `json:"status"` Error string `json:"error"` State JobState `json:"state"` }
func JobChainDecodeStates ¶
func JobChainDecodeStates(state string) (states []*JobRunState)
func JobChainInitStates ¶
func JobChainInitStates(jns ...string) []*JobRunState
type JobRunner ¶
type JobRunner[T any] struct { *xjm.JobRunner ArgChain Tenant *tenant.Tenant Logger log.Logger Arg T }
func (*JobRunner[T]) AddFailedItem ¶
type JobState ¶
type JobState struct { Step int `json:"step,omitempty"` Count int `json:"count,omitempty"` Total int `json:"total,omitempty"` Limit int `json:"limit,omitempty"` Exists int `json:"exists,omitempty"` Skipped int `json:"skipped,omitempty"` Success int `json:"success,omitempty"` Failure int `json:"failure,omitempty"` }
func (*JobState) IncFailure ¶
func (js *JobState) IncFailure()
func (*JobState) IncSkipped ¶
func (js *JobState) IncSkipped()
func (*JobState) IncSuccess ¶
func (js *JobState) IncSuccess()
func (*JobState) IsStepLimited ¶
func (*JobState) SetTotalLimit ¶
type JobStateEx ¶
type JobStateFsx ¶
type JobStateFsx struct { JobStateSx LastID int64 `json:"last_id,omitempty"` LastUpdatedAt time.Time `json:"last_updated_at,omitempty"` }
type JobStateSx ¶
type JobStateSx struct {
JobState
}
func (*JobStateSx) IncFailure ¶
func (js *JobStateSx) IncFailure()
func (*JobStateSx) IncSkipped ¶
func (js *JobStateSx) IncSkipped()
func (*JobStateSx) IncSuccess ¶
func (js *JobStateSx) IncSuccess()
func (*JobStateSx) IsSuccessLimited ¶
func (js *JobStateSx) IsSuccessLimited() bool
func (*JobStateSx) Progress ¶
func (js *JobStateSx) Progress() string
Click to show internal directories.
Click to hide internal directories.