Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions components/core/src/clp_s/CommandLineArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ CommandLineArguments::parse_arguments(int argc, char const** argv) {
"disable-log-order",
po::bool_switch(&m_disable_log_order),
"Do not record log order at ingestion time."
)(
"file-type",
po::value<std::string>(&m_file_type)->value_name("FILE_TYPE")->
default_value(m_file_type),
"The type of file that is to be compressed to archive (e.g Json or IR)"
);
// clang-format on

Expand Down Expand Up @@ -809,4 +814,5 @@ void CommandLineArguments::print_search_usage() const {
" [OUTPUT_HANDLER [OUTPUT_HANDLER_OPTIONS]]"
<< std::endl;
}

} // namespace clp_s
3 changes: 3 additions & 0 deletions components/core/src/clp_s/CommandLineArguments.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ class CommandLineArguments {

bool get_record_log_order() const { return false == m_disable_log_order; }

[[nodiscard]] auto get_file_type() const -> std::string { return m_file_type; }

private:
// Methods
/**
Expand Down Expand Up @@ -184,6 +186,7 @@ class CommandLineArguments {
size_t m_target_ordered_chunk_size{};
size_t m_minimum_table_size{1ULL * 1024 * 1024}; // 1 MB
bool m_disable_log_order{false};
std::string m_file_type{"Json"};

// Metadata db variables
std::optional<clp::GlobalMetadataDBConfig> m_metadata_db_config;
Expand Down
22 changes: 19 additions & 3 deletions components/core/src/clp_s/clp-s.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,16 @@ bool search_archive(
);

bool compress(CommandLineArguments const& command_line_arguments) {
auto file_type = command_line_arguments.get_file_type();
if ("IR" != file_type && "Json" != file_type) {
SPDLOG_ERROR("File Type specified is Invalid");
return false;
}
if ("IR" == file_type && command_line_arguments.get_structurize_arrays()) {
SPDLOG_ERROR("ERROR: structurized arrays are not supported for IR files");
return false;
}

auto archives_dir = std::filesystem::path(command_line_arguments.get_archives_dir());

// Create output directory in case it doesn't exist
Expand Down Expand Up @@ -113,9 +123,15 @@ bool compress(CommandLineArguments const& command_line_arguments) {
}

clp_s::JsonParser parser(option);
if (false == parser.parse()) {
SPDLOG_ERROR("Encountered error while parsing input");
return false;
if ("IR" == file_type) {
// Functionality Coming in later PR
// -->Call new parsing function in Json Parser to parse IRv2 to archive
// -->Check for error from parsing function
} else {
if (false == parser.parse()) {
SPDLOG_ERROR("Encountered error while parsing input");
return false;
}
}
parser.store();
return true;
Expand Down
Loading