Documentation
¶
Overview ¶
Package state owns the process-wide mutable runtime state. Configuration is published as immutable snapshots so request and queue goroutines never race with an administrator-triggered reinitialization.
Index ¶
- type State
- func (s *State) Config() config.Config
- func (s *State) NodeMultiplierManager() *network.MultiplierManager
- func (s *State) Reinitialize(subsystem string) error
- func (s *State) Restart() error
- func (s *State) SetNodeMultiplierManager(manager *network.MultiplierManager)
- func (s *State) SetReinitialize(handler func(string) error)
- func (s *State) SetRestart(handler func() error)
- func (s *State) SetTelegramBot(bot *tgbot.Bot)
- func (s *State) TelegramBot() *tgbot.Bot
- func (s *State) UpdateRuntime(update func(*config.Runtime))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is the runtime state the composition root shares with the services: the configuration snapshot, the Telegram bot, the node traffic multiplier and the late-bound restart and reinitialize handlers.
func (*State) NodeMultiplierManager ¶
func (s *State) NodeMultiplierManager() *network.MultiplierManager
NodeMultiplierManager returns the node traffic multiplier periods, nil before the node settings were loaded.
func (*State) Reinitialize ¶
Reinitialize reloads a subsystem's runtime configuration and reports a failure; before the server installed its handler there is nothing to reload.
func (*State) Restart ¶
Restart restarts the HTTP server; before the server installed its handler there is nothing to restart.
func (*State) SetNodeMultiplierManager ¶
func (s *State) SetNodeMultiplierManager(manager *network.MultiplierManager)
SetNodeMultiplierManager publishes the multiplier periods the node settings define.
func (*State) SetReinitialize ¶
SetReinitialize installs the subsystem reload the HTTP server runs the bootstrap with.
func (*State) SetRestart ¶
SetRestart installs the HTTP server's restart; the server installs it once it started.
func (*State) SetTelegramBot ¶
SetTelegramBot publishes the bot client the bootstrap (re)initialized.
func (*State) TelegramBot ¶
TelegramBot returns the running bot client, nil while none is configured.
func (*State) UpdateRuntime ¶ added in v1.21.0
UpdateRuntime serializes partial updates of the runtime settings and atomically publishes the result; the boot settings cannot change while the process runs. Callers must replace nested slices/maps instead of mutating values retained from an older snapshot.