Lines
100.00%
13 / 13
Methods
100.00%
2 / 2
Classes
100.00%
1 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| applyReload | 100.00% | 12 / 12 | 100.00% | 1 / 1 | 2 | ||
| 22 | final readonly class ReloadApplier | |
| 23 | { | |
| 24 | public function __construct( | |
| 25 | private AppTopology $topology, | |
| 26 | private AppPauseService $pauses, | |
| 27 | private AppMetrics $metrics, | |
| 28 | private ExposureLink $exposures, | |
| 29 | private ExposureReconciler $reconciler, | |
| 30 | private WorkerPool $pool, | |
| 31 | private WorkerPoolListener $workerEvents, | |
| 32 | private CatalogWarnings $catalogWarnings, | |
| 33 | private ConfigLoader $configs, | |
| 34 | private DaemonLaunchOptions $launch, | |
| 35 | private LogVerbosityPolicy $verbosity, | |
| 36 | private GeneratedCodeDrift $drift, | |
| 37 | private LoggerInterface $logger, | |
| 38 | ) {} | |
| 39 | ||
| 40 | public function applyReload(ReloadPlan $plan): void | |
| 41 | { | |
| 42 | $previous = $this->topology->getCatalog(); | |
| 43 | $this->topology->replaceTopology($plan->catalog, $plan->workerSlots); | |
| 44 | $this->pauses->followReloadedCatalog($previous); | |
| 45 | $this->metrics->replaceAppTotals($plan->workerSlots); | |
| 46 | $this->verbosity->replaceAppVerbosities($plan->catalog->enabled->listVerbositiesByAppId()); | |
| 47 | $this->drift->replaceGeneratedManifest($plan->generated); | |
| 48 | $this->drift->recheckGeneratedCode(); | |
| 49 | ||
| 50 | foreach ($previous->enabled->filter(static fn(AppDefinition $app): bool => $plan->catalog->enabled->find($app->id) === null) as $removed) { | |
| 51 | $this->exposures->forgetExposuresOfApp($removed->id); | |
| 52 | } | |
| 53 | ||
| 54 | $this->reconciler->restartAfterReload(); | |
| 55 | $this->catalogWarnings->logCatalogWarnings($plan->discovered, $plan->catalog, $this->configs->locateConfigFile($this->launch->configFile), $this->logger); | |
| 56 | $this->pool->applyWorkerSlots($plan->workerSlots, $this->workerEvents); | |
| 57 | } | |
| 58 | } |