engine

package
v0.0.0-...-61862c7 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Package engine is the workhorse of the exercise engine. It receives incoming events and takes the appropriate actions on them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BBSConnection

type BBSConnection interface {
	Read(msgnum int) (string, error)
	Kill(msgnums ...int) error
	Send(subject, body string, to ...string) error
	Close() error
}

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

func (e *Engine) ClockTick(tick time.Time)

ClockTick handles a tick of the clock, performing all time-based actions.

func (*Engine) ManualTrigger

func (e *Engine) ManualTrigger(mt server.ManualTrigger)

func (*Engine) Run

func (e *Engine) Run()

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

func (e *Engine) SetTicker(tickch <-chan time.Time)

SetTicker sets the channel that supplies ticks to the engine. If called at all, it must be called before Run.

func (*Engine) StartTicker

func (e *Engine) StartTicker() <-chan time.Time

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.

func (*Engine) Variable

func (e *Engine) Variable(name, station string) (value string, ok bool)

type EngineEvent

type EngineEvent struct {
	Tick          time.Time
	ManualTrigger *server.ManualTrigger
}

Jump to

Keyboard shortcuts

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