rule

package
v1.14.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuleStarted    = "Running"
	RuleStopped    = "Stopped: canceled manually."
	RuleTerminated = "Stopped: schedule terminated."
	RuleWait       = "Stopped: waiting for next schedule."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionSignal

type ActionSignal int
const (
	ActionSignalStart ActionSignal = iota
	ActionSignalStop
)

type MockCron

type MockCron struct {
	// contains filtered or unexported fields
}

func (*MockCron) AddFunc

func (m *MockCron) AddFunc(_ string, cmd func()) (cron.EntryID, error)

AddFunc MockCron execute function immediately at once

func (*MockCron) Remove

func (m *MockCron) Remove(id cron.EntryID)

func (*MockCron) Start

func (m *MockCron) Start()

type RuleState

type RuleState struct {
	// Constant, never change. Channel to send signals to manage connection retry. When deleting the rule, close it.
	RuleId   string
	ActionCh chan ActionSignal
	// Nearly constant, only change when update the rule
	Rule *api.Rule
	// States, create through rule in each rule start
	Topology *topo.Topo

	sync.RWMutex
	// contains filtered or unexported fields
}

func NewRuleState

func NewRuleState(rule *api.Rule) (rs *RuleState, err error)

NewRuleState Create and initialize a rule state. Errors are possible during plan the topo. If error happens return immediately without add it to the registry

func (*RuleState) Close

func (rs *RuleState) Close() (err error)

func (*RuleState) GetNextScheduleStartTime

func (rs *RuleState) GetNextScheduleStartTime() int64

func (*RuleState) GetScheduleTimestamp

func (rs *RuleState) GetScheduleTimestamp() (int64, int64, int64)

func (*RuleState) GetState

func (rs *RuleState) GetState() (s string, err error)

func (*RuleState) GetTopoGraph

func (rs *RuleState) GetTopoGraph() *api.PrintableTopo

func (*RuleState) InternalStop

func (rs *RuleState) InternalStop() (err error)

func (*RuleState) Start

func (rs *RuleState) Start() (err error)

func (*RuleState) Stop

func (rs *RuleState) Stop() (err error)

Stop remove the Topology

func (*RuleState) UpdateTopo

func (rs *RuleState) UpdateTopo(rule *api.Rule) (err error)

Jump to

Keyboard shortcuts

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