Documentation
¶
Index ¶
- Constants
- type Config
- type DispatchConfig
- type EngineConfig
- type Node
- func (n *Node) Cache() *cache.Cache
- func (n *Node) DataEngine() *data.Engine
- func (n *Node) ExecutionEngine() *execution.Engine
- func (n *Node) ExecutionRouter() *adapter.ExecutionRouter
- func (n *Node) Init(config Config, execRouter []adapter.ExecRouterEntry, ...)
- func (n *Node) LedgerEngine() *ledger.Engine
- func (n *Node) MsgBus() *msgbus.MsgBus
- func (n *Node) Run(ctx context.Context)
- func (n *Node) Start(ctx context.Context)
Constants ¶
const ( // IdleStrategyGosched yields to the Go scheduler on every idle iteration. IdleStrategyGosched = "gosched" // IdleStrategySpin busy-spins a bounded number of idle iterations // before yielding. IdleStrategySpin = "spin" // DefaultSpinBudget bounds a spin-strategy busy loop. At ~ns-scale ring // probes this is a few microseconds of spinning per yield. DefaultSpinBudget = 4096 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Engine EngineConfig `yaml:"engine"`
Dispatch DispatchConfig `yaml:"dispatch"`
}
Config contains node-level configuration.
type DispatchConfig ¶
type DispatchConfig struct {
// IdleStrategy is "gosched" (default) or "spin".
// gosched: yield to the Go scheduler whenever the loop finds no work.
// Cooperative; correct on shared cores.
// spin: busy-spin SpinBudget idle iterations before yielding once.
// Minimizes wake-up latency; requires a dedicated core
// (see docs/DEPLOYMENT.md).
IdleStrategy string `yaml:"idle_strategy"`
// SpinBudget is the number of consecutive idle iterations a spin-strategy
// loop performs before it yields to the scheduler. 0 selects
// DefaultSpinBudget. Ignored for the gosched strategy.
SpinBudget int `yaml:"spin_budget"`
}
DispatchConfig controls the dispatch-loop goroutine (P2-4). The loop is always pinned to one OS thread (runtime.LockOSThread); this selects what it does when idle.
type EngineConfig ¶
type EngineConfig struct {
Data data.Config `yaml:"data"`
Execution execution.Config `yaml:"execution"`
Ledger ledger.Config `yaml:"ledger"`
Risk risk.Config `yaml:"risk"`
Strategy strategy.Config `yaml:"strategy"`
}
EngineConfig composes all engine configurations.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node orchestrates all engines and the event loop.
func (*Node) DataEngine ¶
DataEngine returns the data engine.
func (*Node) ExecutionEngine ¶
ExecutionEngine returns the execution engine.
func (*Node) ExecutionRouter ¶
func (n *Node) ExecutionRouter() *adapter.ExecutionRouter
ExecutionRouter returns the execution router.
func (*Node) Init ¶
func (n *Node) Init(config Config, execRouter []adapter.ExecRouterEntry, dataRouter []adapter.DataRouterEntry, tradingMode tradingmode.Mode)
Init initializes the node and all engines from config. execRouter and dataRouter are the top-level adapter configs parsed from YAML. tradingMode gates venue order mutations on the execution router (default paper).
func (*Node) LedgerEngine ¶
LedgerEngine returns the ledger engine.
func (*Node) Run ¶
Run starts the event loop and blocks until context is cancelled, then performs graceful shutdown.
The dispatch goroutine is pinned to its OS thread (P2-4) so the Go scheduler cannot migrate it across cores; combined with the taskset / isolcpus recipe in docs/DEPLOYMENT.md this gives the loop a stable, cache-warm core. The idle strategy is configurable: cooperative Gosched (default) or a bounded busy-spin for latency-critical deployments on a dedicated core.