subsystem-summary-of-main
Main Subsystem — Technical Summary
Overview
The main subsystem is the central orchestration layer of stellar-core. It defines the Application interface and its concrete ApplicationImpl, which owns all other subsystem managers and coordinates the application lifecycle: construction, initialization, startup, the main event loop, graceful shutdown, and thread management. It also provides configuration parsing (Config), persistent state management (PersistentState), HTTP command handling (CommandHandler), query serving (QueryServer), CLI entry point and command routing (CommandLine, main.cpp), and various utilities (XDR dumping, diagnostics, settings upgrade helpers, maintenance).
Key Files
- Application.h / Application.cpp — Abstract
Applicationinterface; factory methodApplication::create(). - ApplicationImpl.h / ApplicationImpl.cpp — Concrete implementation; owns all subsystem managers, threads, io_contexts.
- AppConnector.h / AppConnector.cpp — Thread-safe accessor facade isolating subsystems from direct
Applicationaccess. - Config.h / Config.cpp —
Configclass; TOML-based configuration parsing, defaults, validation. - PersistentState.h / PersistentState.cpp — Key-value persistence of node-critical state (LCL, SCP data, upgrades) across two SQL tables.
- CommandHandler.h / CommandHandler.cpp — HTTP admin command server routing and handler implementations.
- QueryServer.h / QueryServer.cpp — Multi-threaded HTTP query server for BucketListDB reads.
- CommandLine.h / CommandLine.cpp — CLI argument parsing via Clara; dispatches to run functions for each subcommand.
- main.cpp — Entry point; initializes crypto, checks XDR/version identity, delegates to
handleCommandLine(). - Maintainer.h / Maintainer.cpp — Periodic maintenance (prunes old SCP history, ledger data).
- ApplicationUtils.h / ApplicationUtils.cpp — Higher-level application utilities (setupApp, runApp, catchup, selfCheck, dumpLedger, etc.).
More from stellar/stellar-core
running-tests
running tests at various levels from smoke tests to full suite to randomized tests
1subsystem-summary-of-test
read this skill for a token-efficient summary of the test subsystem
1subsystem-summary-of-scp
read this skill for a token-efficient summary of the scp subsystem
1running-make-to-build
how to run make correctly to get a good build, and otherwise understand the build system
1subsystem-summary-of-history
read this skill for a token-efficient summary of the history subsystem
1subsystem-summary-of-invariant
read this skill for a token-efficient summary of the invariant subsystem
1