mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-10-15 01:54:43 +00:00
Formatted includes
This commit is contained in:
@@ -24,98 +24,98 @@
|
|||||||
* Handles location loading, city enrichment, and brewery/user generation.
|
* Handles location loading, city enrichment, and brewery/user generation.
|
||||||
*/
|
*/
|
||||||
class BiergartenPipelineOrchestrator {
|
class BiergartenPipelineOrchestrator {
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* @brief Constructs the orchestrator with injected pipeline dependencies.
|
* @brief Constructs the orchestrator with injected pipeline dependencies.
|
||||||
*
|
*
|
||||||
* @param logger Sink for pipeline diagnostics.
|
* @param logger Sink for pipeline diagnostics.
|
||||||
* @param context_service Provides regional context for locations.
|
* @param context_service Provides regional context for locations.
|
||||||
* @param generator Implementation (Llama or Mock) for brewery/user
|
* @param generator Implementation (Llama or Mock) for brewery/user
|
||||||
* generation.
|
* generation.
|
||||||
* @param exporter Database backend for persisting generated records.
|
* @param exporter Database backend for persisting generated records.
|
||||||
* @param curated_data_service Loads curated location, persona, and name
|
* @param curated_data_service Loads curated location, persona, and name
|
||||||
* data used to seed generation.
|
* data used to seed generation.
|
||||||
* @param postal_code_service Resolves a postal code for a city from its
|
* @param postal_code_service Resolves a postal code for a city from its
|
||||||
* curated postal-code data.
|
* curated postal-code data.
|
||||||
* @param application_options CLI configuration and paths.
|
* @param application_options CLI configuration and paths.
|
||||||
*/
|
*/
|
||||||
BiergartenPipelineOrchestrator(
|
BiergartenPipelineOrchestrator(
|
||||||
std::shared_ptr<ILogger> logger,
|
std::shared_ptr<ILogger> logger,
|
||||||
std::unique_ptr<IEnrichmentService> context_service,
|
std::unique_ptr<IEnrichmentService> context_service,
|
||||||
std::unique_ptr<DataGenerator> generator,
|
std::unique_ptr<DataGenerator> generator,
|
||||||
std::unique_ptr<IExportService> exporter,
|
std::unique_ptr<IExportService> exporter,
|
||||||
std::unique_ptr<ICuratedDataService> curated_data_service,
|
std::unique_ptr<ICuratedDataService> curated_data_service,
|
||||||
std::unique_ptr<IPostalCodeService> postal_code_service,
|
std::unique_ptr<IPostalCodeService> postal_code_service,
|
||||||
const ApplicationOptions& application_options);
|
const ApplicationOptions& application_options);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Run the data generation pipeline.
|
* @brief Run the data generation pipeline.
|
||||||
*
|
*
|
||||||
* Performs the following steps:
|
* Performs the following steps:
|
||||||
* 1. Load curated locations from JSON
|
* 1. Load curated locations from JSON
|
||||||
* 2. Resolve context for each city using the injected context service
|
* 2. Resolve context for each city using the injected context service
|
||||||
* 3. Generate brewery and user data for sampled cities
|
* 3. Generate brewery and user data for sampled cities
|
||||||
*
|
*
|
||||||
* @note STRUCTURAL CONCURRENCY REQUIREMENT:
|
* @note STRUCTURAL CONCURRENCY REQUIREMENT:
|
||||||
* When transitioned to a multithreaded design, this method MUST
|
* When transitioned to a multithreaded design, this method MUST
|
||||||
* structurally enforce that all deployed worker threads are joined before
|
* structurally enforce that all deployed worker threads are joined before
|
||||||
* returning (e.g. by using std::jthread or a structured concurrency
|
* returning (e.g. by using std::jthread or a structured concurrency
|
||||||
* primitive). This ensures workers do not attempt to log to a closed
|
* primitive). This ensures workers do not attempt to log to a closed
|
||||||
* channel during application teardown.
|
* channel during application teardown.
|
||||||
*
|
*
|
||||||
* @return true if successful, false if not
|
* @return true if successful, false if not
|
||||||
*/
|
*/
|
||||||
bool Run();
|
bool Run();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<ILogger> logger_;
|
std::shared_ptr<ILogger> logger_;
|
||||||
std::unique_ptr<IEnrichmentService> context_service_;
|
std::unique_ptr<IEnrichmentService> context_service_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generator implementation selected at the composition root (Llama
|
* @brief Generator implementation selected at the composition root (Llama
|
||||||
* or Mock).
|
* or Mock).
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<DataGenerator> generator_;
|
std::unique_ptr<DataGenerator> generator_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Storage backend for generated brewery and user records.
|
* @brief Storage backend for generated brewery and user records.
|
||||||
*/
|
*/
|
||||||
std::unique_ptr<IExportService> exporter_;
|
std::unique_ptr<IExportService> exporter_;
|
||||||
std::unique_ptr<ICuratedDataService> curated_data_service_;
|
std::unique_ptr<ICuratedDataService> curated_data_service_;
|
||||||
std::unique_ptr<IPostalCodeService> postal_code_service_;
|
std::unique_ptr<IPostalCodeService> postal_code_service_;
|
||||||
|
|
||||||
ApplicationOptions application_options_;
|
ApplicationOptions application_options_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Load locations from JSON and sample cities.
|
* @brief Load locations from JSON and sample cities.
|
||||||
*
|
*
|
||||||
* @return Vector of locations randomly sampled per
|
* @return Vector of locations randomly sampled per
|
||||||
* PipelineOptions::location_count.
|
* PipelineOptions::location_count.
|
||||||
*/
|
*/
|
||||||
std::vector<City> QueryLocations();
|
std::vector<City> QueryLocations();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generate breweries for enriched cities.
|
* @brief Generate breweries for enriched cities.
|
||||||
*
|
*
|
||||||
* @param cities Span of enriched city data.
|
* @param cities Span of enriched city data.
|
||||||
*/
|
*/
|
||||||
void GenerateBreweries(std::span<const EnrichedCity> cities);
|
void GenerateBreweries(std::span<const EnrichedCity> cities);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Generate users grounded in sampled names and personas for
|
* @brief Generate users grounded in sampled names and personas for
|
||||||
* enriched cities.
|
* enriched cities.
|
||||||
*
|
*
|
||||||
* @param cities Span of enriched city data.
|
* @param cities Span of enriched city data.
|
||||||
*/
|
*/
|
||||||
void GenerateUsers(std::span<const EnrichedCity> cities);
|
void GenerateUsers(std::span<const EnrichedCity> cities);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Log the generated brewery and user results.
|
* @brief Log the generated brewery and user results.
|
||||||
*/
|
*/
|
||||||
void LogResults() const;
|
void LogResults() const;
|
||||||
|
|
||||||
std::vector<BreweryRecord> generated_breweries_;
|
std::vector<BreweryRecord> generated_breweries_;
|
||||||
std::vector<UserRecord> generated_users_;
|
std::vector<UserRecord> generated_users_;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_BIERGARTEN_PIPELINE_ORCHESTRATOR_H_
|
#endif // BIERGARTEN_PIPELINE_INCLUDES_BIERGARTEN_PIPELINE_ORCHESTRATOR_H_
|
||||||
|
|||||||
@@ -15,12 +15,12 @@
|
|||||||
* it alive for application lifetime.
|
* it alive for application lifetime.
|
||||||
*/
|
*/
|
||||||
class LlamaBackendState {
|
class LlamaBackendState {
|
||||||
public:
|
public:
|
||||||
LlamaBackendState() { llama_backend_init(); }
|
LlamaBackendState() { llama_backend_init(); }
|
||||||
~LlamaBackendState() { llama_backend_free(); }
|
~LlamaBackendState() { llama_backend_free(); }
|
||||||
|
|
||||||
LlamaBackendState(const LlamaBackendState&) = delete;
|
LlamaBackendState(const LlamaBackendState&) = delete;
|
||||||
LlamaBackendState& operator=(const LlamaBackendState&) = delete;
|
LlamaBackendState& operator=(const LlamaBackendState&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BIERGARTEN_PIPELINE_INCLUDES_LLAMA_BACKEND_STATE_H_
|
#endif // BIERGARTEN_PIPELINE_INCLUDES_LLAMA_BACKEND_STATE_H_
|
||||||
|
|||||||
Reference in New Issue
Block a user