ark::config::ConfigPackage

Defined in header “ark/config/config_package.hh”.


A config package can reference many different configuration files/classes. These are typically read from a YAML which defines them all, but can also be constructed at runtime.

Config packages provide mechanisms to allow overriding individual parameters from a particular base type/file, allowing you to customize parts of a configuration for a specific pipeline.

Methods

  • ConfigPackage(core::Guid identifier)
    Constructor taking in an identifier.

  • void register_config_structure(const std::string & name, const Type & config)
    Registeres a configuration from the specified serializable structure. This is particularly useful during testing, where you may want to register a configuration from a concrete structure.

  • void register_config_structure(const std::string & config_name, const ConfigType & config, const std::string & metadata_name, const MetadataType & metadata)
    Registeres a configuration from the specified serializable structure. This is particularly useful during testing, where you may want to register a configuration from a concrete structure.

    This also registers the given metadata structure, under the specified name.

  • void register_config_content(const std::string & config_name, const std::string & raw_yaml)
    Registers configuration from the specified file. This can be used to register the contents of a YAML file directly, without first translating to a C++ structure. Useful for when you have YAML contents, but not a concrete structure.

    The type information here is used purely for tracking purposes.

  • void register_config_metadata(const std::string & config_name, const std::string & metadata_name, const MetadataType & metadata)
    Adds metadata to the given configuration name. If the configuration doesn’t exist, an empty configuration will be created.

  • void register_config_file(const std::string & config_name, const std::filesystem::path & path)
    Adds the configuration file at the given path to the config package, using the given name to register it.

  • void ensure_config_registered(const std::string & config_name)
    Ensures that the configuration with the given name has a configuration registered. If not, a default configuration is registered for it.

  • Type get_config(const std::string & name)
    Retrieves the configuration under the given name, parsing it into the specified type.

  • serialization::JsonBlob get_config_json(const std::string & name, const std::string & type_name, const std::string & schema)
    Retrieves configuration under the given name, with the selected option, and provides it as a JSON blob.

  • Type get_metadata(const std::string & config_name, const std::string & metadata_name)
    Retrieves the named metadata for the specified configuration, deserializing it into the templated type. If the metadata doesn’t exist, this will return a default structure.

  • void append_overrides(const std::string & config_name, const std::string & override_yaml)
    Append the (fully formed YAML) to the existing configuration. This YAML will be appended to whatever option is used for the configuration (in other words, it applies to all options).

  • void set_config_option(const std::string & config_name, const std::string & option_name)
    Adjust the given configurations option to the specified value. This will throw if the configuration doesn’t exist.

  • bool has_config(const std::string & config_name)
    Returns true if this package has the given configuration, or false otherwise.

  • const core::Guid & identifier()
    Returns the identifier of this package.

  • std::vector< std::filesystem::path > dependency_paths()
    Returns all of the dependencies (file-based) that were loaded for this config package.

  • void copy_config(const ConfigPackage & source, const std::string & key_name)
    Copies configuration from another config package to this config package.

  • ConfigPackageWireData to_wire()
    Serializes this configuration package for storage.

  • bool empty()
    Returns true if this config package has no configs registered, or false otherwise.

  • bool operator==(const ConfigPackage & rhs)
    Default equality operator.