Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(clp-package): Unify the metadata schema for JSON and IR streams. #620

Merged
merged 3 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion components/core/src/clp/clo/OutputHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ ErrorCode ResultsCacheOutputHandler::flush() {
try {
m_results.emplace_back(std::move(bsoncxx::builder::basic::make_document(
bsoncxx::builder::basic::kvp(
cResultsCacheKeys::OrigFileId,
cResultsCacheKeys::SearchOutput::OrigFileId,
haiqi96 marked this conversation as resolved.
Show resolved Hide resolved
std::move(result.orig_file_id)
),
bsoncxx::builder::basic::kvp(
Expand Down
6 changes: 1 addition & 5 deletions components/core/src/clp/clo/clo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,9 @@ bool extract_ir(CommandLineArguments const& command_line_args) {
dest_ir_file_name
),
bsoncxx::builder::basic::kvp(
clp::clo::cResultsCacheKeys::OrigFileId,
clp::clo::cResultsCacheKeys::IrOutput::StreamId,
haiqi96 marked this conversation as resolved.
Show resolved Hide resolved
orig_file_id
),
bsoncxx::builder::basic::kvp(
clp::clo::cResultsCacheKeys::IrOutput::FileSplitId,
file_split_id
),
bsoncxx::builder::basic::kvp(
clp::clo::cResultsCacheKeys::IrOutput::BeginMsgIx,
static_cast<int64_t>(begin_message_ix)
Expand Down
5 changes: 2 additions & 3 deletions components/core/src/clp/clo/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@

// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays, readability-identifier-naming)
namespace clp::clo::cResultsCacheKeys {
constexpr char OrigFileId[]{"orig_file_id"};

namespace IrOutput {
constexpr char Path[]{"path"};
constexpr char FileSplitId[]{"file_split_id"};
constexpr char StreamId[]{"stream_id"};
constexpr char BeginMsgIx[]{"begin_msg_ix"};
constexpr char EndMsgIx[]{"end_msg_ix"};
constexpr char IsLastIrChunk[]{"is_last_ir_chunk"};
} // namespace IrOutput

namespace SearchOutput {
constexpr char OrigFileId[]{"orig_file_id"};
constexpr char OrigFilePath[]{"orig_file_path"};
constexpr char LogEventIx[]{"log_event_ix"};
constexpr char Timestamp[]{"timestamp"};
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp_s/JsonConstructor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ void JsonConstructor::construct_in_order() {
new_file_path.filename()
),
bsoncxx::builder::basic::kvp(
constants::results_cache::decompression::cOrigFileId,
constants::results_cache::decompression::cStreamId,
m_option.archive_id
),
bsoncxx::builder::basic::kvp(
Expand Down
2 changes: 1 addition & 1 deletion components/core/src/clp_s/archive_constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ constexpr char cLogEventIdxName[] = "log_event_idx";

namespace results_cache::decompression {
constexpr char cPath[]{"path"};
constexpr char cOrigFileId[]{"orig_file_id"};
constexpr char cStreamId[]{"stream_id"};
constexpr char cBeginMsgIx[]{"begin_msg_ix"};
constexpr char cEndMsgIx[]{"end_msg_ix"};
constexpr char cIsLastIrChunk[]{"is_last_ir_chunk"};
Expand Down
17 changes: 3 additions & 14 deletions components/log-viewer-webui/client/src/api/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,11 @@ import axios from "axios";


/**
* @typedef {object} ExtractIrResp
* @typedef {object} ExtractStreamResp
* @property {string} stream_id
* @property {number} begin_msg_ix
* @property {number} end_msg_ix
* @property {string} file_split_id
* @property {boolean} is_last_ir_chunk
* @property {string} orig_file_id
* @property {string} path
* @property {string} _id
*/

/**
* @typedef {object} ExtractJsonResp
* @property {number} begin_msg_ix
* @property {number} end_msg_ix
* @property {boolean} is_last_ir_chunk
* @property {string} orig_file_id
* @property {string} path
* @property {string} _id
*/
Expand All @@ -30,7 +19,7 @@ import axios from "axios";
* @param {string} streamId
* @param {number} logEventIdx
* @param {Function} onUploadProgress Callback to handle upload progress events.
* @return {Promise<axios.AxiosResponse<ExtractIrResp|ExtractJsonResp>>}
* @return {Promise<axios.AxiosResponse<ExtractStreamResp>>}
*/
const submitExtractStreamJob = async (extractJobType, streamId, logEventIdx, onUploadProgress) => {
return await axios.post(
Expand Down
2 changes: 1 addition & 1 deletion components/log-viewer-webui/server/src/DbManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class DbManager {
*/
async getExtractedStreamFileMetadata (streamId, logEventIdx) {
return await this.#streamFilesCollection.findOne({
orig_file_id: streamId,
stream_id: streamId,
begin_msg_ix: {$lte: logEventIdx},
end_msg_ix: {$gt: logEventIdx},
});
Expand Down
Loading