Documentation
¶
Index ¶
- Constants
- Variables
- func AssertOp(expr string) ograph.ElementOption
- func ChooseOp(expr string, candidates ...*ograph.Element) ograph.ElementOption
- func ConditionOp(expr string) ograph.ElementOption
- func DelayOp(wait time.Duration) ograph.ElementOption
- func LoopOp(n int) ograph.ElementOption
- func LoopWhileOp(expr string) ograph.ElementOption
- func NewAssertNodeFactory(assertFn func(ctx context.Context, state ogcore.State) (bool, error)) func() ogcore.Node
- func NewChooseClusterFactory(chooseFn func(ctx context.Context, state ogcore.State) int) func() ogcore.Node
- func NewConditionWrapperFactory(cond func(ctx context.Context, state ogcore.State) bool) func() ogcore.Node
- func NewRetryWrapper(times int) ogcore.Node
- func NewSilentWrapper() ogcore.Node
- func NewTimeoutWrapper(timeout time.Duration) ogcore.Node
- func RetryOp(n int) ograph.ElementOption
- func SetTraceId(state ogcore.State, id string)
- func TimeoutOp(dur time.Duration) ograph.ElementOption
- type AssertNode
- type AsyncWrapper
- type ChooseCluster
- type CmdNode
- type ConditionWrapper
- type DebugWrapper
- type DelayWrapper
- type FastState
- type GuardState
- type HookState
- type HttpReqNode
- type LoopWrapper
- type OverlayState
- type ParallelCluster
- type RaceCluster
- type RetryWrapper
- type SilentWrapper
- type StateHookFn
- type TimeoutWrapper
- type TraceWrapper
- type Visitor
Constants ¶
View Source
const ( Assert = "Assert" CMD = "CMD" HttpReq = "HttpReq" Queue = "Queue" Choose = "Choose" Parallel = "Parallel" Race = "Race" Async = "Async" Condition = "Condition" Loop = "Loop" Retry = "Retry" Silent = "Silent" Timeout = "Timeout" Trace = "Trace" Delay = "Delay" Debug = "Debug" )
View Source
const ( AllowRead = 1 << iota AllowWrite )
Variables ¶
View Source
var AssertNodeFactory = func() ogcore.Node { return &AssertNode{} }
View Source
var AsyncWrapperFactory = func() ogcore.Node { return &AsyncWrapper{} }
View Source
var ChooseClusterFactory = func() ogcore.Node { return &ChooseCluster{} }
View Source
var CmdNodeFactory = func() ogcore.Node { return &CmdNode{} }
View Source
var ConditionWrapperFactory = func() ogcore.Node { return &ConditionWrapper{} }
View Source
var DebugWrapperFactory = func() ogcore.Node { return &DebugWrapper{} }
View Source
var DelayWrapperFactory = func() ogcore.Node { return &DelayWrapper{} }
View Source
var ErrTimeout = errors.New("the running time exceeds the limit")
View Source
var HttpReqNodeFactory = func() ogcore.Node { return &HttpReqNode{} }
View Source
var LoopWrapperFactory = func() ogcore.Node { return &LoopWrapper{LoopTimes: 1} }
View Source
var ParallelClusterFactory = func() ogcore.Node { return &ParallelCluster{} }
View Source
var QueueClusterFactory = func() ogcore.Node { return &ograph.BaseCluster{} }
View Source
var RaceClusterFactory = func() ogcore.Node { return &RaceCluster{} }
View Source
var RetryWrapperFactory = func() ogcore.Node { return &RetryWrapper{MaxRetryTimes: 1} }
View Source
var SilentWrapperFactory = NewSilentWrapper
View Source
var TimeoutWrapperFactory = func() ogcore.Node { return &TimeoutWrapper{} }
View Source
var TraceWrapperFactory = func() ogcore.Node { return &TraceWrapper{} }
Functions ¶
func AssertOp ¶ added in v0.8.0
func AssertOp(expr string) ograph.ElementOption
func ChooseOp ¶ added in v0.8.0
func ChooseOp(expr string, candidates ...*ograph.Element) ograph.ElementOption
func ConditionOp ¶ added in v0.7.0
func ConditionOp(expr string) ograph.ElementOption
func LoopOp ¶
func LoopOp(n int) ograph.ElementOption
func LoopWhileOp ¶ added in v0.7.0
func LoopWhileOp(expr string) ograph.ElementOption
func NewAssertNodeFactory ¶ added in v0.8.0
func NewChooseClusterFactory ¶
func NewRetryWrapper ¶
func NewSilentWrapper ¶
func RetryOp ¶
func RetryOp(n int) ograph.ElementOption
func SetTraceId ¶
Types ¶
type AssertNode ¶ added in v0.8.0
type AsyncWrapper ¶
type AsyncWrapper struct {
ograph.BaseWrapper
*slog.Logger
}
type ChooseCluster ¶
type ChooseCluster struct {
ograph.BaseCluster
*slog.Logger
ChooseExpr string
ChooseFn func(ctx context.Context, state ogcore.State) int
}
type CmdNode ¶
type CmdNode struct {
ograph.BaseNode
*slog.Logger
Cmd []string
Env []string
Dir string
Path string
}
func (*CmdNode) CmdIsAllowed ¶
type ConditionWrapper ¶
type ConditionWrapper struct {
ograph.BaseWrapper
ConditionExpr string
Condition func(ctx context.Context, state ogcore.State) bool
}
type DebugWrapper ¶
type DebugWrapper struct {
ograph.BaseWrapper
*slog.Logger
}
type DelayWrapper ¶
type FastState ¶
type FastState struct {
// contains filtered or unexported fields
}
func NewFastState ¶
func NewFastState() *FastState
type GuardState ¶
type GuardState struct {
// contains filtered or unexported fields
}
func NewGuardState ¶
func NewGuardState(state ogcore.State, guard func(key any) (flag int)) *GuardState
func (*GuardState) Set ¶
func (state *GuardState) Set(key any, val any)
type HookState ¶
type HookState struct {
Base ogcore.State
Hooks []StateHookFn
}
func NewHookState ¶
func NewHookState(base ogcore.State, hooks ...StateHookFn) *HookState
type HttpReqNode ¶
type LoopWrapper ¶
type LoopWrapper struct {
ograph.BaseWrapper
LoopTimes int
LoopInterval time.Duration
ConditionExpr string
Condition func(ctx context.Context, state ogcore.State) bool
}
type OverlayState ¶
func NewOverlayState ¶
func NewOverlayState(state ogcore.State) *OverlayState
func (*OverlayState) Set ¶
func (state *OverlayState) Set(key any, val any)
func (*OverlayState) Sync ¶
func (state *OverlayState) Sync()
type ParallelCluster ¶
type ParallelCluster struct {
ograph.BaseCluster
}
type RaceCluster ¶
type RaceCluster struct {
ograph.BaseCluster
*slog.Logger
StateIsolation bool
}
type RetryWrapper ¶
type SilentWrapper ¶
type SilentWrapper struct {
ograph.BaseWrapper
*slog.Logger
}
type TimeoutWrapper ¶
type TimeoutWrapper struct {
ograph.BaseWrapper
Timeout time.Duration
}
type TraceWrapper ¶
type TraceWrapper struct {
ograph.BaseWrapper
*slog.Logger
}
Source Files
¶
- cluster_choose.go
- cluster_parallel.go
- cluster_queue.go
- cluster_race.go
- constants.go
- element_option.go
- node_assert.go
- node_cmd.go
- node_http_req.go
- register.go
- state_fast.go
- state_guard.go
- state_hook.go
- state_overlay.go
- wrapper_async.go
- wrapper_condition.go
- wrapper_debug.go
- wrapper_delay.go
- wrapper_loop.go
- wrapper_retry.go
- wrapper_silent.go
- wrapper_timeout.go
- wrapper_trace.go
Click to show internal directories.
Click to hide internal directories.