Documentation ¶
Overview ¶
Package engine is the workhorse of the exercise engine. It receives incoming events and takes the appropriate actions on them.
Index ¶
- type BBSConnection
- type BBSConnector
- type Engine
- func (e *Engine) ClockTick(tick time.Time)
- func (e *Engine) ManualTrigger(mt server.ManualTrigger)
- func (e *Engine) Run()
- func (e *Engine) SetBBSConnector(conn BBSConnector)
- func (e *Engine) SetManualTriggerChannel(mtch chan server.ManualTrigger)
- func (e *Engine) SetNoInject()
- func (e *Engine) SetTicker(tickch <-chan time.Time)
- func (e *Engine) StartTicker() <-chan time.Time
- func (e *Engine) Variable(name, station string) (value string, ok bool)
- type EngineEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BBSConnection ¶
type BBSConnector ¶
type BBSConnector func(*definition.Exercise) (BBSConnection, error)
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func New ¶
func New(def *definition.Definition, st *state.State) (e *Engine, err error)
func (*Engine) ClockTick ¶
ClockTick handles a tick of the clock, performing all time-based actions.
func (*Engine) ManualTrigger ¶
func (e *Engine) ManualTrigger(mt server.ManualTrigger)
func (*Engine) SetBBSConnector ¶
func (e *Engine) SetBBSConnector(conn BBSConnector)
SetBBSConnector sets the BBS connector to use for connecting to the BBS. This is typically called before Run.
func (*Engine) SetManualTriggerChannel ¶
func (e *Engine) SetManualTriggerChannel(mtch chan server.ManualTrigger)
SetManualTriggerChannel sets the channel that supplies manual event triggers to the engine. If called at all, it must be called before Run.
func (*Engine) SetNoInject ¶
func (e *Engine) SetNoInject()
SetNoInject sets the flag that inhibits printing and emailing injects.
func (*Engine) SetTicker ¶
SetTicker sets the channel that supplies ticks to the engine. If called at all, it must be called before Run.
func (*Engine) StartTicker ¶
StartTicker computes the time at which the ticker should start, creates it, and returns its output channel. If the ticker won't start for a while, it emits a notice to that effect.
type EngineEvent ¶
type EngineEvent struct { Tick time.Time ManualTrigger *server.ManualTrigger }