-
Notifications
You must be signed in to change notification settings - Fork 89
feat(clp-s): Add get_metadata_for_log_event function to clp_s::ArchiveReader (resolves #2012).
#2033
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
base: main
Are you sure you want to change the base?
feat(clp-s): Add get_metadata_for_log_event function to clp_s::ArchiveReader (resolves #2012).
#2033
Changes from all commits
44b49f9
e69656f
7ee7cb5
53041d4
376d3d7
7eba757
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -168,6 +168,9 @@ auto ArchiveReaderAdaptor::try_read_range_index(ZstdDecompressor& decompressor, | |
| end_index, | ||
| std::move(range_index_entry.at(RangeIndexWriter::cMetadataFieldsName)) | ||
| ); | ||
| if (start_index != end_index) { | ||
| m_non_empty_range_metadata_map.emplace(end_index, m_range_index.back().fields); | ||
| } | ||
gibber9809 marked this conversation as resolved.
Show resolved
Hide resolved
Comment on lines
+171
to
+173
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess I've always had the question if the range index accepts files with empty ranges, or gaps between adjacent ranges. |
||
| } | ||
| return ErrorCodeSuccess; | ||
| } | ||
|
|
@@ -362,4 +365,13 @@ void ArchiveReaderAdaptor::checkin_reader_for_section(std::string_view section) | |
|
|
||
| m_current_reader_holder.reset(); | ||
| } | ||
|
|
||
| auto ArchiveReaderAdaptor::get_metadata_for_log_event(int64_t log_event_idx) | ||
| -> nlohmann::json const& { | ||
| auto const it{m_non_empty_range_metadata_map.upper_bound(log_event_idx)}; | ||
| if (m_non_empty_range_metadata_map.end() == it || log_event_idx < 0) { | ||
|
Comment on lines
+371
to
+372
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Logic seems like you don't really need to look up anything if the log even idx is negative, which makes me feel more strongly about using |
||
| throw OperationFailed(ErrorCodeBadParam, __FILENAME__, __LINE__); | ||
| } | ||
| return it->second; | ||
| } | ||
gibber9809 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } // namespace clp_s | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should log event simply take an unsigned type like
uint64_t?