DynamicSupervisor that starts and supervises RiskEngine.Portfolio
processes on demand — one per portfolio id.
Portfolios aren't started up front, since the set of portfolio ids isn't
known ahead of time. Instead, ensure_started/1 is called whenever a
trade arrives for a portfolio id (see RiskEngine.TradeIngestion.submit/1),
lazily starting the process the first time it's needed.
Summary
Functions
Returns a specification to start this module under a supervisor.
Starts a RiskEngine.Portfolio for portfolio_id if one isn't already
running.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec ensure_started(RiskEngine.Portfolio.portfolio_id()) :: {:ok, pid()} | {:error, term()}
Starts a RiskEngine.Portfolio for portfolio_id if one isn't already
running.
Returns {:ok, pid} whether the process was newly started or already
existed, so callers don't need to handle the "already started" case
themselves.