Skip to content

Commit

Permalink
Validate new YAML options
Browse files Browse the repository at this point in the history
Signed-off-by: tempate <[email protected]>
  • Loading branch information
Tempate committed Apr 11, 2024
1 parent 35cebcf commit 6dd9484
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions ddsrecorder_yaml/src/cpp/recorder/YamlReaderConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,16 @@ void RecorderConfiguration::load_recorder_configuration_(
{
auto output_yml = YamlReader::get_value_in_tag(yml, RECORDER_OUTPUT_TAG);

const std::set<TagType> output_tags{
RECORDER_OUTPUT_PATH_FILE_TAG,
RECORDER_OUTPUT_FILE_NAME_TAG,
RECORDER_OUTPUT_TIMESTAMP_FORMAT_TAG,
RECORDER_OUTPUT_LOCAL_TIMESTAMP_TAG,
RECORDER_OUTPUT_SAFETY_MARGIN_TAG,
RECORDER_OUTPUT_RESOURCE_LIMITS_TAG};

YamlValidator::validate_tags(output_yml, output_tags);

/////
// Get optional file path
if (YamlReader::is_tag_present(output_yml, RECORDER_OUTPUT_PATH_FILE_TAG))
Expand Down Expand Up @@ -277,6 +287,13 @@ void RecorderConfiguration::load_recorder_configuration_(
{
auto resource_limits_yml = YamlReader::get_value_in_tag(output_yml, RECORDER_OUTPUT_RESOURCE_LIMITS_TAG);

const std::set<TagType> resource_limits_tags{
RECORDER_OUTPUT_RESOURCE_LIMITS_FILE_ROTATION_TAG,
RECORDER_OUTPUT_RESOURCE_LIMITS_MAX_FILE_SIZE_TAG,
RECORDER_OUTPUT_RESOURCE_LIMITS_MAX_SIZE_TAG};

YamlValidator::validate_tags(resource_limits_yml, resource_limits_tags);

/////
// Get optional file rotation
if (YamlReader::is_tag_present(resource_limits_yml, RECORDER_OUTPUT_RESOURCE_LIMITS_FILE_ROTATION_TAG))
Expand Down Expand Up @@ -358,8 +375,8 @@ void RecorderConfiguration::load_recorder_configuration_(
}

void RecorderConfiguration::load_output_configuration_(
const Yaml& yml,
const YamlReaderVersion& version)
const Yaml& yml,
const YamlReaderVersion& version)
{
const std::set<TagType> tags{
RECORDER_OUTPUT_PATH_FILE_TAG,
Expand Down Expand Up @@ -428,8 +445,7 @@ void RecorderConfiguration::load_controller_configuration_(
if (YamlReader::is_tag_present(yml, RECORDER_REMOTE_CONTROLLER_INITIAL_STATE_TAG))
{
// Convert to enum and check valid wherever used to avoid mcap library dependency in YAML module
initial_state = YamlReader::get<std::string>(yml,
RECORDER_REMOTE_CONTROLLER_INITIAL_STATE_TAG, version);
initial_state = YamlReader::get<std::string>(yml, RECORDER_REMOTE_CONTROLLER_INITIAL_STATE_TAG, version);
// Case insensitive
eprosima::utils::to_uppercase(initial_state);
}
Expand Down Expand Up @@ -457,7 +473,9 @@ void RecorderConfiguration::load_specs_configuration_(
NUMBER_THREADS_TAG,
SPECS_QOS_TAG,
RECORDER_SPECS_MAX_PENDING_SAMPLES_TAG,
RECORDER_SPECS_CLEANUP_PERIOD_TAG};
RECORDER_SPECS_CLEANUP_PERIOD_TAG,
LOG_CONFIGURATION_TAG,
MONITOR_TAG};

YamlValidator::validate_tags(yml, tags);

Expand Down

0 comments on commit 6dd9484

Please sign in to comment.