Skip to content

Commit

Permalink
cdc,index: replace boost::ends_with() with .ends_with()
Browse files Browse the repository at this point in the history
since C++20, std::string and std::string_view started providing
`ends_with()` member function, the same applies to `seastar::sstring`,
so there is no need to use `boost::ends_with()` anymore.

in this change, we switch from `boost::ends_with()` to the member
functions variant to

- improve the readability
- reduce the header dependency

Signed-off-by: Kefu Chai <[email protected]>

Closes scylladb#22502
  • Loading branch information
tchaikov authored and xemul committed Jan 29, 2025
1 parent 2eb06c6 commit e218a62
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions cdc/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <algorithm>

#include <boost/range/irange.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <seastar/core/thread.hh>
#include <seastar/core/metrics.hh>

Expand Down Expand Up @@ -420,7 +419,7 @@ static const sstring cdc_deleted_column_prefix = cdc_meta_column_prefix + "delet
static const sstring cdc_deleted_elements_column_prefix = cdc_meta_column_prefix + "deleted_elements_";

bool is_log_name(const std::string_view& table_name) {
return boost::ends_with(table_name, cdc_log_suffix);
return table_name.ends_with(cdc_log_suffix);
}

bool is_cdc_metacolumn_name(const sstring& name) {
Expand Down
3 changes: 1 addition & 2 deletions index/secondary_index_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "db/tags/extension.hh"

#include <boost/range/adaptor/map.hpp>
#include <boost/algorithm/string/predicate.hpp>

namespace secondary_index {

Expand Down Expand Up @@ -156,7 +155,7 @@ sstring index_table_name(const sstring& index_name) {
}

sstring index_name_from_table_name(const sstring& table_name) {
if (table_name.size() < 7 || !boost::algorithm::ends_with(table_name, "_index")) {
if (table_name.size() < 7 || !table_name.ends_with("_index")) {
throw std::runtime_error(format("Table {} does not have _index suffix", table_name));
}
return table_name.substr(0, table_name.size() - 6); // remove the _index suffix from an index name;
Expand Down

0 comments on commit e218a62

Please sign in to comment.