Skip to content

Commit 72bfe06

Browse files
committed
Address review comments.
1 parent 5a04728 commit 72bfe06

File tree

8 files changed

+52
-50
lines changed

8 files changed

+52
-50
lines changed

components/core/src/clp/GrepCore.hpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class GrepCore {
3131
*
3232
* @tparam LogTypeDictionaryReaderType
3333
* @tparam VariableDictionaryReaderType
34-
* @param log_dict
34+
* @param logtype_dict
3535
* @param var_dict
3636
* @param search_string
3737
* @param search_begin_ts
@@ -43,7 +43,7 @@ class GrepCore {
4343
*/
4444
template <typename LogTypeDictionaryReaderType, typename VariableDictionaryReaderType>
4545
static std::optional<Query> process_raw_query(
46-
LogTypeDictionaryReaderType const& log_dict,
46+
LogTypeDictionaryReaderType const& logtype_dict,
4747
VariableDictionaryReaderType const& var_dict,
4848
std::string const& search_string,
4949
epochtime_t search_begin_ts,
@@ -120,7 +120,7 @@ class GrepCore {
120120
* @tparam LogTypeDictionaryReaderType
121121
* @tparam VariableDictionaryReaderType
122122
* @tparam LogTypeDictionaryEntryType
123-
* @param log_dict
123+
* @param logtype_dict
124124
* @param var_dict
125125
* @param processed_search_string
126126
* @param query_tokens
@@ -135,7 +135,7 @@ class GrepCore {
135135
typename VariableDictionaryReaderType,
136136
typename LogTypeDictionaryEntryType = typename LogTypeDictionaryReaderType::entry_t>
137137
static SubQueryMatchabilityResult generate_logtypes_and_vars_for_subquery(
138-
LogTypeDictionaryReaderType const& log_dict,
138+
LogTypeDictionaryReaderType const& logtype_dict,
139139
VariableDictionaryReaderType const& var_dict,
140140
std::string& processed_search_string,
141141
std::vector<QueryToken>& query_tokens,
@@ -146,7 +146,7 @@ class GrepCore {
146146

147147
template <typename LogTypeDictionaryReaderType, typename VariableDictionaryReaderType>
148148
std::optional<Query> GrepCore::process_raw_query(
149-
LogTypeDictionaryReaderType const& log_dict,
149+
LogTypeDictionaryReaderType const& logtype_dict,
150150
VariableDictionaryReaderType const& var_dict,
151151
std::string const& search_string,
152152
epochtime_t search_begin_ts,
@@ -220,7 +220,7 @@ std::optional<Query> GrepCore::process_raw_query(
220220

221221
// Compute logtypes and variables for query
222222
auto matchability = generate_logtypes_and_vars_for_subquery(
223-
log_dict,
223+
logtype_dict,
224224
var_dict,
225225
search_string_for_sub_queries,
226226
query_tokens,
@@ -330,7 +330,7 @@ template <
330330
typename VariableDictionaryReaderType,
331331
typename LogTypeDictionaryEntryType>
332332
GrepCore::SubQueryMatchabilityResult GrepCore::generate_logtypes_and_vars_for_subquery(
333-
LogTypeDictionaryReaderType const& log_dict,
333+
LogTypeDictionaryReaderType const& logtype_dict,
334334
VariableDictionaryReaderType const& var_dict,
335335
std::string& processed_search_string,
336336
std::vector<QueryToken>& query_tokens,
@@ -406,7 +406,7 @@ GrepCore::SubQueryMatchabilityResult GrepCore::generate_logtypes_and_vars_for_su
406406

407407
// Find matching logtypes
408408
std::unordered_set<LogTypeDictionaryEntryType const*> possible_logtype_entries;
409-
log_dict.get_entries_matching_wildcard_string(logtype, ignore_case, possible_logtype_entries);
409+
logtype_dict.get_entries_matching_wildcard_string(logtype, ignore_case, possible_logtype_entries);
410410
if (possible_logtype_entries.empty()) {
411411
return SubQueryMatchabilityResult::WontMatch;
412412
}

components/core/src/clp/Query.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ bool QueryVar::matches(encoded_variable_t var) const {
7070

7171
void QueryVar::remove_segments_that_dont_contain_dict_var(
7272
set<segment_id_t>& segment_ids,
73-
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)>
73+
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)> const&
7474
get_segments_containing_var_dict_id
7575
) const {
7676
if (false == m_is_dict_var) {
@@ -84,8 +84,8 @@ void QueryVar::remove_segments_that_dont_contain_dict_var(
8484
inplace_set_intersection(ids_of_segments_containing_query_var, segment_ids);
8585
} else {
8686
set<segment_id_t> ids_of_segments_containing_query_var;
87-
for (auto entry : m_possible_var_dict_ids) {
88-
auto& ids_of_segments_containing_var = get_segments_containing_var_dict_id(entry);
87+
for (auto var_dict_id : m_possible_var_dict_ids) {
88+
auto& ids_of_segments_containing_var = get_segments_containing_var_dict_id(var_dict_id);
8989
ids_of_segments_containing_query_var.insert(
9090
ids_of_segments_containing_var.cbegin(),
9191
ids_of_segments_containing_var.cend()
@@ -112,24 +112,24 @@ void SubQuery::add_imprecise_dict_var(
112112
}
113113

114114
void SubQuery::set_possible_logtypes(unordered_set<logtype_dictionary_id_t> const& logtype_ids) {
115-
m_possible_logtype_ids = logtype_ids;
115+
m_possible_logtypes = logtype_ids;
116116
}
117117

118118
void SubQuery::mark_wildcard_match_required() {
119119
m_wildcard_match_required = true;
120120
}
121121

122122
void SubQuery::calculate_ids_of_matching_segments(
123-
std::function<std::set<segment_id_t> const&(logtype_dictionary_id_t)>
124-
get_segments_containing_log_dict_id,
125-
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)>
123+
std::function<std::set<segment_id_t> const&(logtype_dictionary_id_t)> const&
124+
get_segments_containing_logtype_dict_id,
125+
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)> const&
126126
get_segments_containing_var_dict_id
127127
) {
128128
// Get IDs of segments containing logtypes
129129
m_ids_of_matching_segments.clear();
130-
for (auto logtype_id : m_possible_logtype_ids) {
130+
for (auto logtype_id : m_possible_logtypes) {
131131
auto const& ids_of_segments_containing_logtype
132-
= get_segments_containing_log_dict_id(logtype_id);
132+
= get_segments_containing_logtype_dict_id(logtype_id);
133133
m_ids_of_matching_segments.insert(
134134
ids_of_segments_containing_logtype.cbegin(),
135135
ids_of_segments_containing_logtype.cend()
@@ -147,12 +147,12 @@ void SubQuery::calculate_ids_of_matching_segments(
147147

148148
void SubQuery::clear() {
149149
m_vars.clear();
150-
m_possible_logtype_ids.clear();
150+
m_possible_logtypes.clear();
151151
m_wildcard_match_required = false;
152152
}
153153

154154
bool SubQuery::matches_logtype(logtype_dictionary_id_t const logtype) const {
155-
return m_possible_logtype_ids.count(logtype) > 0;
155+
return m_possible_logtypes.count(logtype) > 0;
156156
}
157157

158158
Query::Query(
@@ -187,14 +187,14 @@ void Query::make_sub_queries_relevant_to_segment(segment_id_t segment_id) {
187187
}
188188

189189
void Query::calculate_ids_of_matching_segments(
190-
std::function<std::set<segment_id_t> const&(logtype_dictionary_id_t)>
191-
get_segments_containing_log_dict_id,
192-
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)>
190+
std::function<std::set<segment_id_t> const&(logtype_dictionary_id_t)> const&
191+
get_segments_containing_logtype_dict_id,
192+
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)> const&
193193
get_segments_containing_var_dict_id
194194
) {
195195
for (auto& sub_query : m_sub_queries) {
196196
sub_query.calculate_ids_of_matching_segments(
197-
get_segments_containing_log_dict_id,
197+
get_segments_containing_logtype_dict_id,
198198
get_segments_containing_var_dict_id
199199
);
200200
}

components/core/src/clp/Query.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class QueryVar {
3939
*/
4040
void remove_segments_that_dont_contain_dict_var(
4141
std::set<segment_id_t>& segment_ids,
42-
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)>
42+
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)> const&
4343
get_segments_containing_var_dict_id
4444
) const;
4545

@@ -106,24 +106,24 @@ class SubQuery {
106106
/**
107107
* Calculates the segment IDs that should contain a match for the subquery's current logtypes
108108
* and QueryVars.
109-
* @param get_segments_containing_log_dict_id
109+
* @param get_segments_containing_logtype_dict_id
110110
* @param get_segments_containing_var_dict_id
111111
*/
112112
void calculate_ids_of_matching_segments(
113-
std::function<std::set<segment_id_t> const&(logtype_dictionary_id_t)>
114-
get_segments_containing_log_dict_id,
115-
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)>
113+
std::function<std::set<segment_id_t> const&(logtype_dictionary_id_t)> const&
114+
get_segments_containing_logtype_dict_id,
115+
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)> const&
116116
get_segments_containing_var_dict_id
117117
);
118118

119119
void clear();
120120

121121
bool wildcard_match_required() const { return m_wildcard_match_required; }
122122

123-
size_t get_num_possible_logtypes() const { return m_possible_logtype_ids.size(); }
123+
size_t get_num_possible_logtypes() const { return m_possible_logtypes.size(); }
124124

125125
std::unordered_set<logtype_dictionary_id_t> const& get_possible_logtypes() const {
126-
return m_possible_logtype_ids;
126+
return m_possible_logtypes;
127127
}
128128

129129
size_t get_num_possible_vars() const { return m_vars.size(); }
@@ -152,7 +152,7 @@ class SubQuery {
152152

153153
private:
154154
// Variables
155-
std::unordered_set<logtype_dictionary_id_t> m_possible_logtype_ids;
155+
std::unordered_set<logtype_dictionary_id_t> m_possible_logtypes;
156156
std::set<segment_id_t> m_ids_of_matching_segments;
157157
std::vector<QueryVar> m_vars;
158158
bool m_wildcard_match_required;
@@ -213,13 +213,13 @@ class Query {
213213
/**
214214
* Calculates the segment IDs that should contain a match for each subquery's logtypes and
215215
* QueryVars.
216-
* @param get_segments_containing_log_dict_id
216+
* @param get_segments_containing_logtype_dict_id
217217
* @param get_segments_containing_var_dict_id
218218
*/
219219
void calculate_ids_of_matching_segments(
220-
std::function<std::set<segment_id_t> const&(logtype_dictionary_id_t)>
221-
get_segments_containing_log_dict_id,
222-
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)>
220+
std::function<std::set<segment_id_t> const&(logtype_dictionary_id_t)> const&
221+
get_segments_containing_logtype_dict_id,
222+
std::function<std::set<segment_id_t> const&(variable_dictionary_id_t)> const&
223223
get_segments_containing_var_dict_id
224224
);
225225

components/core/src/clp/QueryToken.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class QueryToken {
5656
std::string m_value;
5757

5858
// Type if variable has unambiguous type
59-
Type m_type{};
59+
Type m_type{Type::Wildcard};
6060
// Types if variable type is ambiguous
6161
std::vector<Type> m_possible_types;
6262
// Index of the current possible type selected for generating a subquery

components/core/src/clp/StringReader.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#include <cassert>
88
#include <cerrno>
99

10+
#include <boost/filesystem.hpp>
11+
1012
using std::string;
1113

1214
namespace clp {

components/core/src/clp/clg/clg.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ static bool search(
212212
std::set<segment_id_t> ids_of_segments_to_search;
213213
bool is_superseding_query = false;
214214
for (auto const& search_string : search_strings) {
215-
auto const& log_dict{archive.get_logtype_dictionary()};
215+
auto const& logtype_dict{archive.get_logtype_dictionary()};
216216
auto const& var_dict{archive.get_var_dictionary()};
217217
auto query_processing_result = GrepCore::process_raw_query(
218-
log_dict,
218+
logtype_dict,
219219
var_dict,
220220
search_string,
221221
search_begin_ts,
@@ -240,19 +240,19 @@ static bool search(
240240
}
241241

242242
// Calculate the IDs of the segments that may contain results for each sub-query.
243-
auto get_segments_containing_log_dict_id
244-
= [&log_dict](
243+
auto get_segments_containing_logtype_dict_id
244+
= [&logtype_dict](
245245
logtype_dictionary_id_t logtype_id
246246
) -> std::set<segment_id_t> const& {
247-
return log_dict.get_entry(logtype_id).get_ids_of_segments_containing_entry();
247+
return logtype_dict.get_entry(logtype_id).get_ids_of_segments_containing_entry();
248248
};
249249
auto get_segments_containing_var_dict_id = [&var_dict](
250250
variable_dictionary_id_t var_id
251251
) -> std::set<segment_id_t> const& {
252252
return var_dict.get_entry(var_id).get_ids_of_segments_containing_entry();
253253
};
254254
query.calculate_ids_of_matching_segments(
255-
get_segments_containing_log_dict_id,
255+
get_segments_containing_logtype_dict_id,
256256
get_segments_containing_var_dict_id
257257
);
258258

components/core/src/clp/clo/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ set(
5959
../Platform.hpp
6060
../Profiler.cpp
6161
../Profiler.hpp
62-
../QueryToken.cpp
63-
../QueryToken.hpp
6462
../Query.cpp
6563
../Query.hpp
64+
../QueryToken.cpp
65+
../QueryToken.hpp
6666
../ReaderInterface.cpp
6767
../ReaderInterface.hpp
6868
../ReadOnlyMemoryMappedFile.cpp

components/core/src/clp/clo/clo.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,13 @@ static bool search_archive(
497497

498498
auto search_begin_ts = command_line_args.get_search_begin_ts();
499499
auto search_end_ts = command_line_args.get_search_end_ts();
500-
auto const& log_dict{archive_reader.get_logtype_dictionary()};
500+
auto const& logtype_dict{archive_reader.get_logtype_dictionary()};
501501
auto const& var_dict{archive_reader.get_var_dictionary()};
502502

503503
std::string wildcard_search_string
504504
= clean_up_wildcard_search_string('*' + command_line_args.get_search_string() + '*');
505505
auto query_processing_result = GrepCore::process_raw_query(
506-
log_dict,
506+
logtype_dict,
507507
var_dict,
508508
wildcard_search_string,
509509
search_begin_ts,
@@ -518,16 +518,16 @@ static bool search_archive(
518518

519519
auto& query = query_processing_result.value();
520520
// Calculate the IDs of the segments that may contain results for each sub-query.
521-
auto get_segments_containing_log_dict_id
522-
= [&log_dict](logtype_dictionary_id_t logtype_id) -> std::set<segment_id_t> const& {
523-
return log_dict.get_entry(logtype_id).get_ids_of_segments_containing_entry();
521+
auto get_segments_containing_logtype_dict_id
522+
= [&logtype_dict](logtype_dictionary_id_t logtype_id) -> std::set<segment_id_t> const& {
523+
return logtype_dict.get_entry(logtype_id).get_ids_of_segments_containing_entry();
524524
};
525525
auto get_segments_containing_var_dict_id
526526
= [&var_dict](variable_dictionary_id_t var_id) -> std::set<segment_id_t> const& {
527527
return var_dict.get_entry(var_id).get_ids_of_segments_containing_entry();
528528
};
529529
query.calculate_ids_of_matching_segments(
530-
get_segments_containing_log_dict_id,
530+
get_segments_containing_logtype_dict_id,
531531
get_segments_containing_var_dict_id
532532
);
533533

0 commit comments

Comments
 (0)