Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime owns all per-network state. Each network swap builds a fresh Runtime (new DB, new engines, new mux); the old Runtime is canceled + closed after its handlers drain.
type Server ¶
type Server struct {
Enforcer *service.Service[validatorrpc.ValidatorServiceClient]
Bitcoind *service.Service[corerpc.BitcoinServiceClient]
Wallet *service.Service[validatorrpc.WalletServiceClient]
Crypto *service.Service[cryptorpc.CryptoServiceClient]
Thunder *service.Service[*thunder.Client]
BitNames *service.Service[*bitnames.Client]
BitAssets *service.Service[*bitassets.Client]
Truthcoin *service.Service[*truthcoin.Client]
Photon *service.Service[*photon.Client]
CoinShift *service.Service[*coinshift.Client]
// contains filtered or unexported fields
}
Server hosts bitwindowd's HTTP/Connect surface. Long-lived service connectors and the listener live here; per-network state (db, engines, sub-handlers) lives in Runtime, which is recycled in-process on network swap via Recycle.
func New ¶
func New( ctx context.Context, svcs Services, conf config.Config, onShutdown func(ctx context.Context), ) (*Server, error)
New creates a Server with long-lived connectors started, builds the initial Runtime for the configured network, and starts that runtime's engines. The HTTP listener is not opened until Serve.
func (*Server) Recycle ¶
Recycle swaps to a fresh Runtime for the given network: opens a new network-scoped DB, builds new engines, registers new sub-handlers on a new mux, atomically points the listener at the new mux, and tears down the old runtime asynchronously. The HTTP server keeps running across the swap on the same port; the bitwindowd process never exits.
type Services ¶
type Services struct {
BitcoindConnector service.Connector[corerpc.BitcoinServiceClient]
WalletConnector service.Connector[validatorrpc.WalletServiceClient]
EnforcerConnector service.Connector[validatorrpc.ValidatorServiceClient]
CryptoConnector service.Connector[cryptorpc.CryptoServiceClient]
// Sidechain connectors
ThunderConnector service.Connector[*thunder.Client]
BitNamesConnector service.Connector[*bitnames.Client]
BitAssetsConnector service.Connector[*bitassets.Client]
TruthcoinConnector service.Connector[*truthcoin.Client]
PhotonConnector service.Connector[*photon.Client]
CoinShiftConnector service.Connector[*coinshift.Client]
OrchestratorAddr string // e.g. "http://localhost:30400"
// Test overrides: when set, buildRuntime uses these instead of opening
// fresh from disk. Production callers leave these zero.
Database *sql.DB
ChainParams *chaincfg.Params
WalletDir string
DataDir string
}