ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
publication_service Class Reference

Service for publishing datasets to production tables. More...

#include <publication_service.hpp>

Collaboration diagram for publication_service:
Collaboration graph

Public Types

using context = ores::database::context
 

Public Member Functions

 publication_service (context ctx)
 Constructs a publication_service.
 
std::vector< domain::publication_resultpublish (const std::vector< boost::uuids::uuid > &dataset_ids, domain::publication_mode mode, const std::string &published_by, bool resolve_dependencies=true)
 Publishes one or more datasets to production tables.
 
messaging::publish_bundle_response publish_bundle (const std::string &bundle_code, domain::publication_mode mode, const std::string &published_by, bool atomic=true)
 Publishes all datasets in a bundle.
 
std::vector< domain::datasetresolve_publication_order (const std::vector< boost::uuids::uuid > &dataset_ids)
 Resolves the publication order for datasets.
 
std::vector< domain::publicationget_publication_history (const boost::uuids::uuid &dataset_id)
 Gets the publication history for a dataset.
 
std::vector< domain::publicationget_recent_publications (std::uint32_t limit=100)
 Gets recent publication history across all datasets.
 

Detailed Description

Service for publishing datasets to production tables.

This service handles the publication workflow:

  1. Resolves dataset dependencies using a directed graph
  2. Determines publication order (dependencies first)
  3. Calls appropriate population functions for each dataset
  4. Records publication history for auditing

The service can be used from both the binary protocol handler and HTTP endpoints.

Constructor & Destructor Documentation

◆ publication_service()

publication_service ( context  ctx)
explicit

Constructs a publication_service.

Parameters
ctxThe database context for executing queries.

Member Function Documentation

◆ publish()

std::vector< domain::publication_result > publish ( const std::vector< boost::uuids::uuid > &  dataset_ids,
domain::publication_mode  mode,
const std::string &  published_by,
bool  resolve_dependencies = true 
)

Publishes one or more datasets to production tables.

This is the main entry point for dataset publication. It:

  1. Validates that all dataset IDs exist
  2. Resolves dependencies and determines publication order
  3. Publishes each dataset in dependency order
  4. Records publication history for auditing
Parameters
dataset_idsThe IDs of the datasets to publish.
modeHow to handle conflicts with existing data.
published_byUsername of the person initiating publication.
resolve_dependenciesIf true, automatically include dependencies.
Returns
Results for each dataset published.

◆ publish_bundle()

messaging::publish_bundle_response publish_bundle ( const std::string &  bundle_code,
domain::publication_mode  mode,
const std::string &  published_by,
bool  atomic = true 
)

Publishes all datasets in a bundle.

Calls the SQL dq_bundles_publish_fn() which:

  1. Processes datasets in display_order to respect dependencies
  2. Publishes each dataset individually
  3. Records publication history for auditing
Parameters
bundle_codeThe bundle to publish (e.g., 'base', 'solvaris')
modeHow to handle conflicts with existing data.
published_byUsername of the person initiating publication.
atomicIf true, first failure causes entire bundle to rollback.
Returns
Publication result with per-dataset details.

◆ resolve_publication_order()

std::vector< domain::dataset > resolve_publication_order ( const std::vector< boost::uuids::uuid > &  dataset_ids)

Resolves the publication order for datasets.

Uses boost.graph to build a dependency graph and performs topological sort to determine the correct order. Dependencies are placed before the datasets that depend on them.

Parameters
dataset_idsThe IDs of the datasets to order.
Returns
Ordered list of datasets (dependencies first).
Here is the caller graph for this function:

◆ get_publication_history()

std::vector< domain::publication > get_publication_history ( const boost::uuids::uuid &  dataset_id)

Gets the publication history for a dataset.

Parameters
dataset_idThe ID of the dataset.
Returns
All publication records for this dataset, newest first.

◆ get_recent_publications()

std::vector< domain::publication > get_recent_publications ( std::uint32_t  limit = 100)

Gets recent publication history across all datasets.

Parameters
limitMaximum number of records to return.
Returns
Recent publication records, newest first.