Documentation
¶
Index ¶
- Constants
- Variables
- type ActionSignal
- type RunState
- type State
- func (s *State) Delete() (err error)
- func (s *State) GetLastWill() string
- func (s *State) GetMetrics() ([]string, []any)
- func (s *State) GetStartTimestamp() time.Time
- func (s *State) GetState() RunState
- func (s *State) GetStatusMap() map[string]any
- func (s *State) GetStatusMessage() string
- func (s *State) GetStreams() []string
- func (s *State) GetTopoGraph() *def.PrintableTopo
- func (s *State) HasTopo() bool
- func (s *State) IsTraceEnabled() bool
- func (s *State) ResetStreamOffset(name string, input map[string]any) error
- func (s *State) ScheduleStart() error
- func (s *State) ScheduleStop()
- func (s *State) SetIsTraceEnabled(isEnabled bool, stra kctx.TraceStrategy) error
- func (s *State) Start() error
- func (s *State) Stop()
- func (s *State) StopWithLastWill(msg string)
- func (s *State) Validate() (*topo.Topo, error)
- func (s *State) WithTopo(topo *topo.Topo) *State
Constants ¶
const EOFMessage = "done"
Variables ¶
var StateName = map[RunState]string{ Stopped: "stopped", Starting: "starting", Running: "running", Stopping: "stopping", ScheduledStop: "stopped: waiting for next schedule.", StoppedByErr: "stopped by error", }
Functions ¶
This section is empty.
Types ¶
type ActionSignal ¶
type ActionSignal int
const ( ActionSignalStart ActionSignal = iota ActionSignalStop ActionSignalScheduledStart ActionSignalScheduledStop )
type State ¶
type State struct { sync.RWMutex // Nearly constant, only change when update the Rule // It is used to construct topo Rule *def.Rule // contains filtered or unexported fields }
State control the Rule RunState Created when loading from DB or creating. Deleted when Rule deleting May be accessed by multiple go routines, receiving concurrent request to change the RunState
func NewState ¶
NewState provision a state instance only. Do not plan or run as before. If the Rule is not triggered, do not plan or run. When called by recover Rule, expect
func (*State) GetLastWill ¶
func (*State) GetMetrics ¶
func (*State) GetStartTimestamp ¶ added in v2.2.0
func (*State) GetStatusMap ¶
func (*State) GetStatusMessage ¶
GetStatusMessage return the current RunState of the Rule No set is provided, RunState are changed according to the action (start, stop)
func (*State) GetStreams ¶
func (*State) GetTopoGraph ¶
func (s *State) GetTopoGraph() *def.PrintableTopo
func (*State) IsTraceEnabled ¶
func (*State) ResetStreamOffset ¶
func (*State) ScheduleStart ¶
func (*State) ScheduleStop ¶
func (s *State) ScheduleStop()
func (*State) SetIsTraceEnabled ¶
func (s *State) SetIsTraceEnabled(isEnabled bool, stra kctx.TraceStrategy) error
func (*State) Start ¶
Start run start or add the start action to queue By check state, it assures only one Start function is running at any time. (thread safe) regSchedule: whether need to handle scheduler. If call externally, set it to true
func (*State) Stop ¶
func (s *State) Stop()
Stop run stop action or add the stop action to queue regSchedule: whether need to handle scheduler. If call externally, set it to true