engine

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// Type returns the engine type identifier
	Type() common.EngineType

	// Lifecycle methods
	Start()
	Stop()

	// Execute methods
	Execute(cmd msgbus.Command, bus *msgbus.MsgBus)

	// State notification methods
	NotifyReady()
	NotifyStop()
	NotifyFinished()
	NotifyAbnormal(errorCode int)
}

Engine is the common interface for all engines in the system. It defines lifecycle methods and state notification capabilities.

type EngineBase

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

EngineBase provides common functionality for all engines. Embed this in concrete engine implementations to get state notification support.

func NewEngineBase

func NewEngineBase(engineType common.EngineType) EngineBase

NewEngineBase creates a new EngineBase with the given engine type. The notifier should be set via SetNotifier before calling notification methods.

func (*EngineBase) Execute

func (e *EngineBase) Execute(cmd msgbus.Command, bus *msgbus.MsgBus)

Process a command by dispatching to typed callbacks. Override the specific typed callbacks (ProcessOrderSubmitCmd, ProcessOrderCancelCmd, etc.) in your engine implementation.

func (*EngineBase) Notifier

func (e *EngineBase) Notifier() *msgbus.StateNotifier

Notifier returns the StateNotifier for this engine.

func (*EngineBase) NotifyAbnormal

func (e *EngineBase) NotifyAbnormal(errorCode int)

NotifyAbnormal publishes an AbnormalEvent indicating this engine encountered an error.

func (*EngineBase) NotifyFinished

func (e *EngineBase) NotifyFinished()

NotifyFinished publishes a FinishedEvent indicating this engine has finished.

func (*EngineBase) NotifyReady

func (e *EngineBase) NotifyReady()

NotifyReady publishes a ReadyEvent indicating this engine is ready.

func (*EngineBase) NotifyStop

func (e *EngineBase) NotifyStop()

NotifyStop publishes a StopEvent indicating this engine is stopping.

func (*EngineBase) SetNotifier

func (e *EngineBase) SetNotifier(notifier *msgbus.StateNotifier)

SetNotifier sets the StateNotifier for this engine. This must be called before any notification methods are used.

func (*EngineBase) Type

func (e *EngineBase) Type() common.EngineType

Type returns the engine type identifier.

Jump to

Keyboard shortcuts

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