You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pegasus.apache.org by la...@apache.org on 2024/08/07 06:10:01 UTC
(incubator-pegasus) branch master updated: refactor(string_view): Use std::string_view instead of absl::string_view (#2091)
This is an automated email from the ASF dual-hosted git repository.
laiyingchun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-pegasus.git
The following commit(s) were added to refs/heads/master by this push:
new ad7b18b3c refactor(string_view): Use std::string_view instead of absl::string_view (#2091)
ad7b18b3c is described below
commit ad7b18b3c6660056b1bcff0fcc171600af831bec
Author: Yingchun Lai <la...@apache.org>
AuthorDate: Wed Aug 7 14:09:56 2024 +0800
refactor(string_view): Use std::string_view instead of absl::string_view (#2091)
---
src/base/pegasus_utils.h | 6 +-
src/base/pegasus_value_schema.h | 18 +++---
src/base/test/value_manager_test.cpp | 4 +-
src/base/test/value_schema_test.cpp | 4 +-
src/base/value_field.h | 4 +-
src/base/value_schema_manager.cpp | 4 +-
src/base/value_schema_manager.h | 4 +-
src/base/value_schema_v0.cpp | 8 +--
src/base/value_schema_v0.h | 6 +-
src/base/value_schema_v1.cpp | 10 ++--
src/base/value_schema_v1.h | 8 +--
src/base/value_schema_v2.cpp | 10 ++--
src/base/value_schema_v2.h | 8 +--
src/block_service/local/local_service.cpp | 4 +-
src/client/replication_ddl_client.cpp | 2 +-
src/client/replication_ddl_client.h | 6 +-
src/client_lib/pegasus_client_impl.cpp | 2 +-
src/common/fs_manager.cpp | 14 ++---
src/common/fs_manager.h | 12 ++--
src/common/serialization_helper/thrift_helper.h | 6 +-
src/failure_detector/failure_detector.cpp | 2 +-
src/gutil/test/map_util_unittest.cpp | 4 +-
src/http/http_client.cpp | 6 +-
src/http/http_client.h | 8 +--
src/http/uri_decoder.cpp | 6 +-
src/http/uri_decoder.h | 4 +-
src/meta/duplication/meta_duplication_service.cpp | 66 +++++++++++-----------
src/meta/load_balance_policy.cpp | 5 +-
src/meta/meta_backup_service.cpp | 2 +-
src/meta/meta_bulk_load_ingestion_context.cpp | 8 +--
src/meta/meta_bulk_load_service.cpp | 18 +++---
src/meta/meta_server_failure_detector.cpp | 4 +-
src/meta/meta_service.cpp | 2 +-
src/meta/table_metrics.cpp | 2 +-
src/nfs/nfs_client_impl.cpp | 2 +-
src/nfs/nfs_server_impl.cpp | 2 +-
src/redis_protocol/proxy_lib/redis_parser.cpp | 6 +-
src/replica/backup/replica_backup_manager.cpp | 2 +-
src/replica/bulk_load/replica_bulk_loader.cpp | 4 +-
src/replica/disk_cleaner.cpp | 4 +-
src/replica/duplication/duplication_pipeline.cpp | 4 +-
src/replica/duplication/load_from_private_log.cpp | 4 +-
src/replica/duplication/mutation_batch.cpp | 2 +-
src/replica/duplication/mutation_duplicator.h | 4 +-
src/replica/duplication/replica_duplicator.cpp | 2 +-
.../duplication/replica_duplicator_manager.cpp | 2 +-
src/replica/duplication/replica_follower.cpp | 8 +--
.../duplication/test/duplication_test_base.h | 2 +-
src/replica/log_file_stream.h | 2 +-
src/replica/mutation_log_replay.cpp | 4 +-
src/replica/mutation_log_utils.cpp | 8 +--
src/replica/mutation_log_utils.h | 4 +-
src/replica/replica.cpp | 2 +-
src/replica/replica_base.cpp | 4 +-
src/replica/replica_base.h | 4 +-
src/replica/replica_check.cpp | 6 +-
src/replica/replica_config.cpp | 4 +-
src/replica/replica_disk_migrator.cpp | 8 +--
src/replica/replica_stub.cpp | 11 ++--
src/replica/replication_app_base.cpp | 4 +-
src/replica/split/replica_split_manager.cpp | 28 ++++-----
src/runtime/profiler.cpp | 2 +-
src/runtime/rpc/dns_resolver.cpp | 2 +-
src/runtime/rpc/network.cpp | 2 +-
src/runtime/rpc/rpc_address.cpp | 4 +-
src/runtime/rpc/thrift_message_parser.cpp | 4 +-
src/runtime/task/task_queue.cpp | 2 +-
src/security/sasl_client_wrapper.cpp | 8 +--
src/security/sasl_server_wrapper.cpp | 8 +--
src/security/sasl_wrapper.cpp | 4 +-
src/server/capacity_unit_calculator.cpp | 2 +-
src/server/compaction_filter_rule.cpp | 26 ++++-----
src/server/compaction_filter_rule.h | 26 ++++-----
src/server/compaction_operation.cpp | 20 +++----
src/server/compaction_operation.h | 27 +++++----
src/server/hotkey_collector.cpp | 10 ++--
src/server/hotkey_collector.h | 4 +-
src/server/hotspot_partition_calculator.cpp | 4 +-
src/server/key_ttl_compaction_filter.h | 4 +-
src/server/pegasus_event_listener.cpp | 2 +-
src/server/pegasus_manual_compact_service.cpp | 2 +-
src/server/pegasus_mutation_duplicator.cpp | 10 ++--
src/server/pegasus_mutation_duplicator.h | 6 +-
src/server/pegasus_server_impl.cpp | 4 +-
src/server/pegasus_server_impl_init.cpp | 3 +-
src/server/pegasus_server_write.cpp | 2 +-
src/server/pegasus_write_service.cpp | 2 +-
src/server/pegasus_write_service_impl.h | 16 +++---
src/server/rocksdb_wrapper.cpp | 24 ++++----
src/server/rocksdb_wrapper.h | 14 ++---
src/server/test/hotkey_collector_test.cpp | 4 +-
.../test/pegasus_mutation_duplicator_test.cpp | 3 +-
.../test/pegasus_write_service_impl_test.cpp | 6 +-
src/server/test/rocksdb_wrapper_test.cpp | 8 +--
src/shell/command_helper.h | 4 +-
src/shell/commands.h | 2 +-
src/utils/blob.h | 8 +--
src/utils/builtin_metrics.cpp | 2 +-
src/utils/endians.h | 6 +-
src/utils/errors.h | 8 +--
src/utils/fail_point.cpp | 10 ++--
src/utils/fail_point.h | 6 +-
src/utils/fail_point_impl.h | 10 ++--
src/utils/filesystem.cpp | 14 ++---
src/utils/latency_tracer.cpp | 2 +-
src/utils/metrics.cpp | 2 +-
src/utils/metrics.h | 14 ++---
src/utils/simple_logger.cpp | 4 +-
src/utils/string_conv.h | 22 ++++----
src/utils/test/fail_point_test.cpp | 8 +--
src/utils/test/fmt_logging_test.cpp | 6 +-
src/utils/test/string_conv_test.cpp | 46 +++++++--------
src/utils/time_utils.h | 6 +-
113 files changed, 427 insertions(+), 432 deletions(-)
diff --git a/src/base/pegasus_utils.h b/src/base/pegasus_utils.h
index a6ea381f7..adb078888 100644
--- a/src/base/pegasus_utils.h
+++ b/src/base/pegasus_utils.h
@@ -28,7 +28,7 @@
#include <string>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/flags.h"
DSN_DECLARE_bool(encrypt_data_at_rest);
@@ -122,9 +122,9 @@ const std::string &redact_sensitive_string(const T &src)
}
}
-inline absl::string_view to_string_view(rocksdb::Slice s) { return {s.data(), s.size()}; }
+inline std::string_view to_string_view(rocksdb::Slice s) { return {s.data(), s.size()}; }
-inline rocksdb::Slice to_rocksdb_slice(absl::string_view s) { return {s.data(), s.size()}; }
+inline rocksdb::Slice to_rocksdb_slice(std::string_view s) { return {s.data(), s.size()}; }
} // namespace utils
} // namespace pegasus
diff --git a/src/base/pegasus_value_schema.h b/src/base/pegasus_value_schema.h
index d8f651b16..c95ceedbd 100644
--- a/src/base/pegasus_value_schema.h
+++ b/src/base/pegasus_value_schema.h
@@ -32,7 +32,7 @@
#include "utils/blob.h"
#include "utils/endians.h"
#include "utils/fmt_logging.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "value_field.h"
namespace pegasus {
@@ -55,7 +55,7 @@ inline uint64_t extract_timestamp_from_timetag(uint64_t timetag)
/// Extracts expire_ts from rocksdb value with given version.
/// The value schema must be in v0 or v1.
/// \return expire_ts in host endian
-inline uint32_t pegasus_extract_expire_ts(uint32_t version, absl::string_view value)
+inline uint32_t pegasus_extract_expire_ts(uint32_t version, std::string_view value)
{
CHECK_LE(version, PEGASUS_DATA_VERSION_MAX);
return dsn::data_input(value).read_u32();
@@ -76,7 +76,7 @@ pegasus_extract_user_data(uint32_t version, std::string &&raw_value, ::dsn::blob
if (version == 1) {
input.skip(sizeof(uint64_t));
}
- absl::string_view view = input.read_str();
+ std::string_view view = input.read_str();
// tricky code to avoid memory copy
std::shared_ptr<char> buf(const_cast<char *>(view.data()), [s](char *) { delete s; });
@@ -84,7 +84,7 @@ pegasus_extract_user_data(uint32_t version, std::string &&raw_value, ::dsn::blob
}
/// Extracts timetag from a v1 value.
-inline uint64_t pegasus_extract_timetag(int version, absl::string_view value)
+inline uint64_t pegasus_extract_timetag(int version, std::string_view value)
{
CHECK_EQ(version, 1);
@@ -118,7 +118,7 @@ inline bool check_if_ts_expired(uint32_t epoch_now, uint32_t expire_ts)
/// \return true if expired
inline bool check_if_record_expired(uint32_t value_schema_version,
uint32_t epoch_now,
- absl::string_view raw_value)
+ std::string_view raw_value)
{
return check_if_ts_expired(epoch_now,
pegasus_extract_expire_ts(value_schema_version, raw_value));
@@ -136,7 +136,7 @@ public:
/// A higher level utility for generating value with given version.
/// The value schema must be in v0 or v1.
rocksdb::SliceParts generate_value(uint32_t value_schema_version,
- absl::string_view user_data,
+ std::string_view user_data,
uint32_t expire_ts,
uint64_t timetag)
{
@@ -157,7 +157,7 @@ public:
///
/// rocksdb value (ver 0) = [expire_ts(uint32_t)] [user_data(bytes)]
/// \internal
- rocksdb::SliceParts generate_value_v0(uint32_t expire_ts, absl::string_view user_data)
+ rocksdb::SliceParts generate_value_v0(uint32_t expire_ts, std::string_view user_data)
{
_write_buf.resize(sizeof(uint32_t));
_write_slices.clear();
@@ -210,7 +210,7 @@ public:
///
/// \internal
rocksdb::SliceParts
- generate_value_v1(uint32_t expire_ts, uint64_t timetag, absl::string_view user_data)
+ generate_value_v1(uint32_t expire_ts, uint64_t timetag, std::string_view user_data)
{
_write_buf.resize(sizeof(uint32_t) + sizeof(uint64_t));
_write_slices.clear();
@@ -258,7 +258,7 @@ class value_schema
public:
virtual ~value_schema() = default;
- virtual std::unique_ptr<value_field> extract_field(absl::string_view value,
+ virtual std::unique_ptr<value_field> extract_field(std::string_view value,
value_field_type type) = 0;
/// Extracts user value from the raw rocksdb value.
/// In order to avoid data copy, the ownership of `raw_value` will be transferred
diff --git a/src/base/test/value_manager_test.cpp b/src/base/test/value_manager_test.cpp
index 35c1ce488..f9e8a8dfd 100644
--- a/src/base/test/value_manager_test.cpp
+++ b/src/base/test/value_manager_test.cpp
@@ -23,7 +23,7 @@
#include "base/value_schema_manager.h"
#include "gtest/gtest.h"
#include "pegasus_value_schema.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "value_field.h"
using namespace pegasus;
@@ -31,7 +31,7 @@ using namespace pegasus;
extern std::string generate_value(value_schema *schema,
uint32_t expire_ts,
uint64_t time_tag,
- absl::string_view user_data);
+ std::string_view user_data);
TEST(value_schema_manager, get_latest_value_schema)
{
diff --git a/src/base/test/value_schema_test.cpp b/src/base/test/value_schema_test.cpp
index 246eab5ef..aa39bffcc 100644
--- a/src/base/test/value_schema_test.cpp
+++ b/src/base/test/value_schema_test.cpp
@@ -30,7 +30,7 @@
#include "base/value_schema_manager.h"
#include "gtest/gtest.h"
#include "utils/blob.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "value_field.h"
using namespace pegasus;
@@ -52,7 +52,7 @@ uint64_t extract_time_tag(value_schema *schema, const std::string &raw_value)
std::string generate_value(value_schema *schema,
uint32_t expire_ts,
uint64_t time_tag,
- absl::string_view user_data)
+ std::string_view user_data)
{
std::string write_buf;
std::vector<rocksdb::Slice> write_slices;
diff --git a/src/base/value_field.h b/src/base/value_field.h
index 11e99b893..f5319a226 100644
--- a/src/base/value_field.h
+++ b/src/base/value_field.h
@@ -56,9 +56,9 @@ struct time_tag_field : public value_field
struct user_data_field : public value_field
{
- explicit user_data_field(absl::string_view data) : user_data(data) {}
+ explicit user_data_field(std::string_view data) : user_data(data) {}
value_field_type type() { return value_field_type::USER_DATA; }
- absl::string_view user_data;
+ std::string_view user_data;
};
} // namespace pegasus
diff --git a/src/base/value_schema_manager.cpp b/src/base/value_schema_manager.cpp
index 2ce2f1db6..491230bdf 100644
--- a/src/base/value_schema_manager.cpp
+++ b/src/base/value_schema_manager.cpp
@@ -19,7 +19,7 @@
#include "value_schema_manager.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <iterator>
#include <utility>
@@ -47,7 +47,7 @@ void value_schema_manager::register_schema(std::unique_ptr<value_schema> schema)
}
value_schema *value_schema_manager::get_value_schema(uint32_t meta_cf_data_version,
- absl::string_view value) const
+ std::string_view value) const
{
dsn::data_input input(value);
uint8_t first_byte = input.read_u8();
diff --git a/src/base/value_schema_manager.h b/src/base/value_schema_manager.h
index 5afeef574..86b834bfd 100644
--- a/src/base/value_schema_manager.h
+++ b/src/base/value_schema_manager.h
@@ -25,7 +25,7 @@
#include "pegasus_value_schema.h"
#include "utils/singleton.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace pegasus {
@@ -35,7 +35,7 @@ public:
void register_schema(std::unique_ptr<value_schema> schema);
/// using the raw value in rocksdb and data version stored in meta column family to get data
/// version
- value_schema *get_value_schema(uint32_t meta_cf_data_version, absl::string_view value) const;
+ value_schema *get_value_schema(uint32_t meta_cf_data_version, std::string_view value) const;
value_schema *get_value_schema(uint32_t version) const;
value_schema *get_latest_value_schema() const;
diff --git a/src/base/value_schema_v0.cpp b/src/base/value_schema_v0.cpp
index b7cc30b5d..1d9d0433b 100644
--- a/src/base/value_schema_v0.cpp
+++ b/src/base/value_schema_v0.cpp
@@ -19,7 +19,7 @@
#include "value_schema_v0.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <stdint.h>
#include <string.h>
#include <algorithm>
@@ -32,7 +32,7 @@
#include "utils/ports.h"
namespace pegasus {
-std::unique_ptr<value_field> value_schema_v0::extract_field(absl::string_view value,
+std::unique_ptr<value_field> value_schema_v0::extract_field(std::string_view value,
value_field_type type)
{
std::unique_ptr<value_field> field = nullptr;
@@ -80,14 +80,14 @@ rocksdb::SliceParts value_schema_v0::generate_value(const value_params ¶ms)
params.write_slices.clear();
params.write_slices.emplace_back(params.write_buf.data(), params.write_buf.size());
- absl::string_view user_data = data_field->user_data;
+ std::string_view user_data = data_field->user_data;
if (user_data.length() > 0) {
params.write_slices.emplace_back(user_data.data(), user_data.length());
}
return {¶ms.write_slices[0], static_cast<int>(params.write_slices.size())};
}
-std::unique_ptr<value_field> value_schema_v0::extract_timestamp(absl::string_view value)
+std::unique_ptr<value_field> value_schema_v0::extract_timestamp(std::string_view value)
{
uint32_t expire_ts = dsn::data_input(value).read_u32();
return std::make_unique<expire_timestamp_field>(expire_ts);
diff --git a/src/base/value_schema_v0.h b/src/base/value_schema_v0.h
index 683afe8f9..750136916 100644
--- a/src/base/value_schema_v0.h
+++ b/src/base/value_schema_v0.h
@@ -25,7 +25,7 @@
#include "pegasus_value_schema.h"
#include "utils/blob.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "value_field.h"
namespace pegasus {
@@ -37,7 +37,7 @@ class value_schema_v0 : public value_schema
public:
value_schema_v0() = default;
- std::unique_ptr<value_field> extract_field(absl::string_view value,
+ std::unique_ptr<value_field> extract_field(std::string_view value,
value_field_type type) override;
dsn::blob extract_user_data(std::string &&value) override;
void update_field(std::string &value, std::unique_ptr<value_field> field) override;
@@ -45,7 +45,7 @@ public:
data_version version() const override { return data_version::VERSION_0; }
private:
- std::unique_ptr<value_field> extract_timestamp(absl::string_view value);
+ std::unique_ptr<value_field> extract_timestamp(std::string_view value);
void update_expire_ts(std::string &value, std::unique_ptr<value_field> field);
};
} // namespace pegasus
diff --git a/src/base/value_schema_v1.cpp b/src/base/value_schema_v1.cpp
index 9e0036917..50ac2ba5b 100644
--- a/src/base/value_schema_v1.cpp
+++ b/src/base/value_schema_v1.cpp
@@ -19,7 +19,7 @@
#include "value_schema_v1.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <stdint.h>
#include <string.h>
#include <algorithm>
@@ -32,7 +32,7 @@
#include "utils/ports.h"
namespace pegasus {
-std::unique_ptr<value_field> value_schema_v1::extract_field(absl::string_view value,
+std::unique_ptr<value_field> value_schema_v1::extract_field(std::string_view value,
value_field_type type)
{
std::unique_ptr<value_field> field = nullptr;
@@ -88,20 +88,20 @@ rocksdb::SliceParts value_schema_v1::generate_value(const value_params ¶ms)
params.write_slices.clear();
params.write_slices.emplace_back(params.write_buf.data(), params.write_buf.size());
- absl::string_view user_data = data_field->user_data;
+ std::string_view user_data = data_field->user_data;
if (user_data.length() > 0) {
params.write_slices.emplace_back(user_data.data(), user_data.length());
}
return {¶ms.write_slices[0], static_cast<int>(params.write_slices.size())};
}
-std::unique_ptr<value_field> value_schema_v1::extract_timestamp(absl::string_view value)
+std::unique_ptr<value_field> value_schema_v1::extract_timestamp(std::string_view value)
{
uint32_t expire_ts = dsn::data_input(value).read_u32();
return std::make_unique<expire_timestamp_field>(expire_ts);
}
-std::unique_ptr<value_field> value_schema_v1::extract_time_tag(absl::string_view value)
+std::unique_ptr<value_field> value_schema_v1::extract_time_tag(std::string_view value)
{
dsn::data_input input(value);
input.skip(sizeof(uint32_t));
diff --git a/src/base/value_schema_v1.h b/src/base/value_schema_v1.h
index 7811b49f6..88e8a0337 100644
--- a/src/base/value_schema_v1.h
+++ b/src/base/value_schema_v1.h
@@ -25,7 +25,7 @@
#include "pegasus_value_schema.h"
#include "utils/blob.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "value_field.h"
namespace pegasus {
@@ -37,7 +37,7 @@ class value_schema_v1 : public value_schema
public:
value_schema_v1() = default;
- std::unique_ptr<value_field> extract_field(absl::string_view value,
+ std::unique_ptr<value_field> extract_field(std::string_view value,
value_field_type type) override;
dsn::blob extract_user_data(std::string &&value) override;
void update_field(std::string &value, std::unique_ptr<value_field> field) override;
@@ -45,8 +45,8 @@ public:
data_version version() const override { return data_version::VERSION_1; }
private:
- std::unique_ptr<value_field> extract_timestamp(absl::string_view value);
- std::unique_ptr<value_field> extract_time_tag(absl::string_view value);
+ std::unique_ptr<value_field> extract_timestamp(std::string_view value);
+ std::unique_ptr<value_field> extract_time_tag(std::string_view value);
void update_expire_ts(std::string &value, std::unique_ptr<value_field> field);
};
diff --git a/src/base/value_schema_v2.cpp b/src/base/value_schema_v2.cpp
index 400cad75e..82f4942a7 100644
--- a/src/base/value_schema_v2.cpp
+++ b/src/base/value_schema_v2.cpp
@@ -19,7 +19,7 @@
#include "value_schema_v2.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <stdint.h>
#include <string.h>
#include <algorithm>
@@ -33,7 +33,7 @@
namespace pegasus {
-std::unique_ptr<value_field> value_schema_v2::extract_field(absl::string_view value,
+std::unique_ptr<value_field> value_schema_v2::extract_field(std::string_view value,
value_field_type type)
{
std::unique_ptr<value_field> field = nullptr;
@@ -91,21 +91,21 @@ rocksdb::SliceParts value_schema_v2::generate_value(const value_params ¶ms)
params.write_slices.clear();
params.write_slices.emplace_back(params.write_buf.data(), params.write_buf.size());
- absl::string_view user_data = data_field->user_data;
+ std::string_view user_data = data_field->user_data;
if (user_data.length() > 0) {
params.write_slices.emplace_back(user_data.data(), user_data.length());
}
return {¶ms.write_slices[0], static_cast<int>(params.write_slices.size())};
}
-std::unique_ptr<value_field> value_schema_v2::extract_timestamp(absl::string_view value)
+std::unique_ptr<value_field> value_schema_v2::extract_timestamp(std::string_view value)
{
dsn::data_input input(value);
input.skip(sizeof(uint8_t));
return std::make_unique<expire_timestamp_field>(input.read_u32());
}
-std::unique_ptr<value_field> value_schema_v2::extract_time_tag(absl::string_view value)
+std::unique_ptr<value_field> value_schema_v2::extract_time_tag(std::string_view value)
{
dsn::data_input input(value);
input.skip(sizeof(uint8_t));
diff --git a/src/base/value_schema_v2.h b/src/base/value_schema_v2.h
index c3101baf3..5415c5d64 100644
--- a/src/base/value_schema_v2.h
+++ b/src/base/value_schema_v2.h
@@ -25,7 +25,7 @@
#include "pegasus_value_schema.h"
#include "utils/blob.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "value_field.h"
namespace pegasus {
@@ -38,7 +38,7 @@ class value_schema_v2 : public value_schema
public:
value_schema_v2() = default;
- std::unique_ptr<value_field> extract_field(absl::string_view value,
+ std::unique_ptr<value_field> extract_field(std::string_view value,
value_field_type type) override;
dsn::blob extract_user_data(std::string &&value) override;
void update_field(std::string &value, std::unique_ptr<value_field> field) override;
@@ -46,8 +46,8 @@ public:
data_version version() const override { return data_version::VERSION_2; }
private:
- std::unique_ptr<value_field> extract_timestamp(absl::string_view value);
- std::unique_ptr<value_field> extract_time_tag(absl::string_view value);
+ std::unique_ptr<value_field> extract_timestamp(std::string_view value);
+ std::unique_ptr<value_field> extract_time_tag(std::string_view value);
void update_expire_ts(std::string &value, std::unique_ptr<value_field> field);
};
} // namespace pegasus
diff --git a/src/block_service/local/local_service.cpp b/src/block_service/local/local_service.cpp
index f0dc35f14..0069a0377 100644
--- a/src/block_service/local/local_service.cpp
+++ b/src/block_service/local/local_service.cpp
@@ -21,7 +21,7 @@
#include <type_traits>
#include <utility>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "local_service.h"
#include "nlohmann/json.hpp"
#include "rocksdb/slice.h"
@@ -279,7 +279,7 @@ dsn::task_ptr local_file_object::write(const write_request &req,
write_future_ptr tsk(new write_future(code, cb, 0));
tsk->set_tracker(tracker);
- FAIL_POINT_INJECT_F("mock_local_service_write_failed", [=](absl::string_view) {
+ FAIL_POINT_INJECT_F("mock_local_service_write_failed", [=](std::string_view) {
auto write_failed = [=]() {
write_response resp;
resp.err = ERR_FS_INTERNAL;
diff --git a/src/client/replication_ddl_client.cpp b/src/client/replication_ddl_client.cpp
index 1844b87d9..27bfb2df0 100644
--- a/src/client/replication_ddl_client.cpp
+++ b/src/client/replication_ddl_client.cpp
@@ -1457,7 +1457,7 @@ void replication_ddl_client::end_meta_request(const rpc_response_task_ptr &callb
error_code err, dsn::message_ex *request, dsn::message_ex *response) mutable {
FAIL_POINT_INJECT_NOT_RETURN_F(
"ddl_client_request_meta",
- [&err, this](absl::string_view str) { err = pop_mock_error(); });
+ [&err, this](std::string_view str) { err = pop_mock_error(); });
end_meta_request(callback, attempt_count + 1, err, request, response);
});
diff --git a/src/client/replication_ddl_client.h b/src/client/replication_ddl_client.h
index a14b9a97d..274605bb3 100644
--- a/src/client/replication_ddl_client.h
+++ b/src/client/replication_ddl_client.h
@@ -59,7 +59,7 @@
#include "utils/flags.h"
#include "utils/fmt_logging.h"
#include "utils/ports.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
DSN_DECLARE_uint32(ddl_client_max_attempt_count);
DSN_DECLARE_uint32(ddl_client_retry_interval_ms);
@@ -301,7 +301,7 @@ private:
error_code err, dsn::message_ex *request, dsn::message_ex *response) mutable {
FAIL_POINT_INJECT_NOT_RETURN_F(
"ddl_client_request_meta",
- [&err, this](absl::string_view str) { err = pop_mock_error(); });
+ [&err, this](std::string_view str) { err = pop_mock_error(); });
end_meta_request(std::move(task), 1, err, request, response);
});
@@ -342,7 +342,7 @@ private:
FAIL_POINT_INJECT_NOT_RETURN_F(
"ddl_client_request_meta",
- [&resp, this](absl::string_view str) { resp.err = pop_mock_error(); });
+ [&resp, this](std::string_view str) { resp.err = pop_mock_error(); });
LOG_INFO("received response from meta server: rpc_code={}, err={}, attempt_count={}, "
"max_attempt_count={}",
diff --git a/src/client_lib/pegasus_client_impl.cpp b/src/client_lib/pegasus_client_impl.cpp
index 2ad491c4f..4ab09425b 100644
--- a/src/client_lib/pegasus_client_impl.cpp
+++ b/src/client_lib/pegasus_client_impl.cpp
@@ -26,7 +26,7 @@
#include <type_traits>
#include <utility>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common/common.h"
#include "common/replication_other_types.h"
#include "common/serialization_helper/dsn.layer2_types.h"
diff --git a/src/common/fs_manager.cpp b/src/common/fs_manager.cpp
index 4544c0098..1801d2c46 100644
--- a/src/common/fs_manager.cpp
+++ b/src/common/fs_manager.cpp
@@ -31,7 +31,7 @@
#include <cstdint>
#include <utility>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common/gpid.h"
#include "common/replication_enums.h"
#include "fmt/core.h"
@@ -134,7 +134,7 @@ uint64_t dir_node::replicas_count(app_id id) const
return iter->second.size();
}
-std::string dir_node::replica_dir(absl::string_view app_type, const dsn::gpid &pid) const
+std::string dir_node::replica_dir(std::string_view app_type, const dsn::gpid &pid) const
{
return utils::filesystem::path_combine(full_dir, fmt::format("{}.{}", pid, app_type));
}
@@ -159,7 +159,7 @@ uint64_t dir_node::remove(const gpid &pid)
void dir_node::update_disk_stat()
{
- FAIL_POINT_INJECT_F("update_disk_stat", [](absl::string_view) { return; });
+ FAIL_POINT_INJECT_F("update_disk_stat", [](std::string_view) { return; });
dsn::utils::filesystem::disk_space_info dsi;
if (!dsn::utils::filesystem::get_disk_space_info(full_dir, dsi)) {
@@ -329,7 +329,7 @@ dir_node *fs_manager::find_best_dir_for_new_replica(const gpid &pid) const
}
void fs_manager::specify_dir_for_new_replica_for_test(dir_node *specified_dn,
- absl::string_view app_type,
+ std::string_view app_type,
const dsn::gpid &pid) const
{
bool dn_found = false;
@@ -432,7 +432,7 @@ bool fs_manager::is_dir_node_exist(const std::string &data_dir, const std::strin
return false;
}
-dir_node *fs_manager::find_replica_dir(absl::string_view app_type, gpid pid)
+dir_node *fs_manager::find_replica_dir(std::string_view app_type, gpid pid)
{
std::string replica_dir;
dir_node *replica_dn = nullptr;
@@ -457,7 +457,7 @@ dir_node *fs_manager::find_replica_dir(absl::string_view app_type, gpid pid)
return replica_dn;
}
-dir_node *fs_manager::create_replica_dir_if_necessary(absl::string_view app_type, gpid pid)
+dir_node *fs_manager::create_replica_dir_if_necessary(std::string_view app_type, gpid pid)
{
// Try to find the replica directory.
auto replica_dn = find_replica_dir(app_type, pid);
@@ -489,7 +489,7 @@ dir_node *fs_manager::create_replica_dir_if_necessary(absl::string_view app_type
return replica_dn;
}
-dir_node *fs_manager::create_child_replica_dir(absl::string_view app_type,
+dir_node *fs_manager::create_child_replica_dir(std::string_view app_type,
gpid child_pid,
const std::string &parent_dir)
{
diff --git a/src/common/fs_manager.h b/src/common/fs_manager.h
index 5820d2688..0ceecc3e4 100644
--- a/src/common/fs_manager.h
+++ b/src/common/fs_manager.h
@@ -31,7 +31,7 @@
#include "utils/autoref_ptr.h"
#include "utils/error_code.h"
#include "utils/flags.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/metrics.h"
#include "utils/ports.h"
#include "utils/zlocks.h"
@@ -105,7 +105,7 @@ public:
uint64_t replicas_count() const;
// Construct the replica dir for the given 'app_type' and 'pid'.
// NOTE: Just construct the string, the directory will not be created.
- std::string replica_dir(absl::string_view app_type, const dsn::gpid &pid) const;
+ std::string replica_dir(std::string_view app_type, const dsn::gpid &pid) const;
bool has(const dsn::gpid &pid) const;
uint64_t remove(const dsn::gpid &pid);
void update_disk_stat();
@@ -133,18 +133,18 @@ public:
// dir_nodes.
// NOTE: only used in test.
void specify_dir_for_new_replica_for_test(dir_node *specified_dn,
- absl::string_view app_type,
+ std::string_view app_type,
const dsn::gpid &pid) const;
void add_replica(const dsn::gpid &pid, const std::string &pid_dir);
// Find the replica instance directory.
- dir_node *find_replica_dir(absl::string_view app_type, gpid pid);
+ dir_node *find_replica_dir(std::string_view app_type, gpid pid);
// Similar to the above, but it will create a new directory if not found.
- dir_node *create_replica_dir_if_necessary(absl::string_view app_type, gpid pid);
+ dir_node *create_replica_dir_if_necessary(std::string_view app_type, gpid pid);
// Similar to the above, and will create a directory for the child on the same dir_node
// of parent.
// During partition split, we should guarantee child replica and parent replica share the
// same data dir.
- dir_node *create_child_replica_dir(absl::string_view app_type,
+ dir_node *create_child_replica_dir(std::string_view app_type,
gpid child_pid,
const std::string &parent_dir);
void remove_replica(const dsn::gpid &pid);
diff --git a/src/common/serialization_helper/thrift_helper.h b/src/common/serialization_helper/thrift_helper.h
index c3e2bbfb0..54737a30b 100644
--- a/src/common/serialization_helper/thrift_helper.h
+++ b/src/common/serialization_helper/thrift_helper.h
@@ -37,7 +37,7 @@
#include <thrift/TApplicationException.h>
#include <type_traits>
-#include "absl/strings/string_view.h"
+#include <string_view>
using namespace ::apache::thrift::transport;
namespace dsn {
@@ -498,7 +498,7 @@ inline uint32_t task_code::write(apache::thrift::protocol::TProtocol *oprot) con
dynamic_cast<apache::thrift::protocol::TBinaryProtocol *>(oprot);
if (binary_proto != nullptr) {
// the protocol is binary protocol
- return binary_proto->writeString(absl::string_view(name));
+ return binary_proto->writeString(std::string_view(name));
} else {
// the protocol is json protocol
uint32_t xfer = 0;
@@ -566,7 +566,7 @@ inline uint32_t error_code::write(apache::thrift::protocol::TProtocol *oprot) co
dynamic_cast<apache::thrift::protocol::TBinaryProtocol *>(oprot);
if (binary_proto != nullptr) {
// the protocol is binary protocol
- return binary_proto->writeString(absl::string_view(name));
+ return binary_proto->writeString(std::string_view(name));
} else {
// the protocol is json protocol
uint32_t xfer = 0;
diff --git a/src/failure_detector/failure_detector.cpp b/src/failure_detector/failure_detector.cpp
index 62a0c7fc8..b3d1378eb 100644
--- a/src/failure_detector/failure_detector.cpp
+++ b/src/failure_detector/failure_detector.cpp
@@ -34,7 +34,7 @@
#include <type_traits>
#include <utility>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "failure_detector/fd.code.definition.h"
#include "fd_types.h"
#include "fmt/core.h"
diff --git a/src/gutil/test/map_util_unittest.cpp b/src/gutil/test/map_util_unittest.cpp
index 0c3e70011..8f68bf50a 100644
--- a/src/gutil/test/map_util_unittest.cpp
+++ b/src/gutil/test/map_util_unittest.cpp
@@ -17,7 +17,7 @@
#include "gutil/map_util.h"
#include <absl/hash/hash.h>
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <fmt/core.h>
#include <stdint.h>
#include <algorithm>
@@ -73,7 +73,7 @@ TEST(MapUtil, HeterogeneousLookup)
// Verify that I can use a key type that's appropriate for heterogeneous
// lookup, such as string_view -> string.
- constexpr absl::string_view kLookupKey = "foo";
+ constexpr std::string_view kLookupKey = "foo";
EXPECT_EQ(FindWithDefault(m, kLookupKey), "");
EXPECT_EQ(FindWithDefault(const_m, kLookupKey), "");
diff --git a/src/http/http_client.cpp b/src/http/http_client.cpp
index 24dd575f5..a369fe3e9 100644
--- a/src/http/http_client.cpp
+++ b/src/http/http_client.cpp
@@ -483,15 +483,15 @@ void http_client::free_header_list()
_header_list = nullptr;
}
-void http_client::set_header_field(absl::string_view key, absl::string_view val)
+void http_client::set_header_field(std::string_view key, std::string_view val)
{
_header_fields[std::string(key)] = std::string(val);
_header_changed = true;
}
-void http_client::set_accept(absl::string_view val) { set_header_field("Accept", val); }
+void http_client::set_accept(std::string_view val) { set_header_field("Accept", val); }
-void http_client::set_content_type(absl::string_view val) { set_header_field("Content-Type", val); }
+void http_client::set_content_type(std::string_view val) { set_header_field("Content-Type", val); }
dsn::error_s http_client::process_header()
{
diff --git a/src/http/http_client.h b/src/http/http_client.h
index 0d8b35e13..9624f1e46 100644
--- a/src/http/http_client.h
+++ b/src/http/http_client.h
@@ -27,7 +27,7 @@
#include <unordered_map>
#include <utility>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "http/http_method.h"
#include "http/http_status_code.h"
#include "utils/enum_helper.h"
@@ -199,8 +199,8 @@ public:
// Operations for the header fields.
void clear_header_fields();
- void set_accept(absl::string_view val);
- void set_content_type(absl::string_view val);
+ void set_accept(std::string_view val);
+ void set_content_type(std::string_view val);
// Submit request to remote http service, with response processed by callback function.
//
@@ -235,7 +235,7 @@ private:
dsn::error_s set_method(http_method method);
void free_header_list();
- void set_header_field(absl::string_view key, absl::string_view val);
+ void set_header_field(std::string_view key, std::string_view val);
dsn::error_s process_header();
// The size of a buffer that is used by libcurl to store human readable
diff --git a/src/http/uri_decoder.cpp b/src/http/uri_decoder.cpp
index d6a1a1de9..63b784cae 100644
--- a/src/http/uri_decoder.cpp
+++ b/src/http/uri_decoder.cpp
@@ -40,7 +40,7 @@ error_with<char> from_hex(const char c)
}
}
-error_with<char> decode_char(const absl::string_view &hex)
+error_with<char> decode_char(const std::string_view &hex)
{
CHECK_EQ(2, hex.size());
@@ -53,7 +53,7 @@ error_with<char> decode_char(const absl::string_view &hex)
return error_s::make(ERR_INVALID_PARAMETERS);
}
-error_with<std::string> decode(const absl::string_view &encoded_uri)
+error_with<std::string> decode(const std::string_view &encoded_uri)
{
std::string decoded_uri;
for (size_t i = 0; i < encoded_uri.size(); ++i) {
@@ -64,7 +64,7 @@ error_with<std::string> decode(const absl::string_view &encoded_uri)
"Encountered partial escape sequence at end of string");
}
- const absl::string_view encoded_char(encoded_uri.data() + i + 1, 2);
+ const std::string_view encoded_char(encoded_uri.data() + i + 1, 2);
auto decoded_char = decode_char(encoded_char);
if (!decoded_char.is_ok()) {
return error_s::make(
diff --git a/src/http/uri_decoder.h b/src/http/uri_decoder.h
index b1d28a13b..93266f452 100644
--- a/src/http/uri_decoder.h
+++ b/src/http/uri_decoder.h
@@ -20,14 +20,14 @@
#include <string>
#include "utils/errors.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace dsn {
namespace uri {
/// \brief Decodes a sequence according to the percent decoding rules.
/// \returns the decoded uri path
-error_with<std::string> decode(const absl::string_view &encoded_uri);
+error_with<std::string> decode(const std::string_view &encoded_uri);
} // namespace uri
} // namespace dsn
diff --git a/src/meta/duplication/meta_duplication_service.cpp b/src/meta/duplication/meta_duplication_service.cpp
index 4f0d7f816..a2adf2946 100644
--- a/src/meta/duplication/meta_duplication_service.cpp
+++ b/src/meta/duplication/meta_duplication_service.cpp
@@ -21,7 +21,7 @@
#include <queue>
#include <type_traits>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common//duplication_common.h"
#include "common/common.h"
#include "common/gpid.h"
@@ -484,43 +484,43 @@ void meta_duplication_service::create_follower_app_for_duplication(
dsn::message_ex *msg = dsn::message_ex::create_request(RPC_CM_CREATE_APP);
dsn::marshall(msg, request);
- rpc::call(
- dsn::dns_resolver::instance().resolve_address(meta_servers),
- msg,
- _meta_svc->tracker(),
- [=](error_code err, configuration_create_app_response &&resp) mutable {
- FAIL_POINT_INJECT_NOT_RETURN_F("update_app_request_ok",
- [&](absl::string_view s) -> void { err = ERR_OK; });
- error_code create_err = err == ERR_OK ? resp.err : err;
- error_code update_err = ERR_NO_NEED_OPERATE;
-
- FAIL_POINT_INJECT_NOT_RETURN_F(
- "persist_dup_status_failed",
- [&](absl::string_view s) -> void { create_err = ERR_OK; });
- if (create_err == ERR_OK) {
- update_err = dup->alter_status(duplication_status::DS_APP);
- }
+ rpc::call(dsn::dns_resolver::instance().resolve_address(meta_servers),
+ msg,
+ _meta_svc->tracker(),
+ [=](error_code err, configuration_create_app_response &&resp) mutable {
+ FAIL_POINT_INJECT_NOT_RETURN_F("update_app_request_ok",
+ [&](std::string_view s) -> void { err = ERR_OK; });
+ error_code create_err = err == ERR_OK ? resp.err : err;
+ error_code update_err = ERR_NO_NEED_OPERATE;
- FAIL_POINT_INJECT_F("persist_dup_status_failed",
- [&](absl::string_view s) -> void { return; });
- if (update_err == ERR_OK) {
- blob value = dup->to_json_blob();
- // Note: this function is `async`, it may not be persisted completed
- // after executing, now using `_is_altering` to judge whether `updating` or
- // `completed`, if `_is_altering`, dup->alter_status() will return `ERR_BUSY`
- _meta_svc->get_meta_storage()->set_data(std::string(dup->store_path),
- std::move(value),
- [=]() { dup->persist_status(); });
- } else {
- LOG_ERROR("created follower app[{}.{}] to trigger duplicate checkpoint failed: "
+ FAIL_POINT_INJECT_NOT_RETURN_F(
+ "persist_dup_status_failed",
+ [&](std::string_view s) -> void { create_err = ERR_OK; });
+ if (create_err == ERR_OK) {
+ update_err = dup->alter_status(duplication_status::DS_APP);
+ }
+
+ FAIL_POINT_INJECT_F("persist_dup_status_failed",
+ [&](std::string_view s) -> void { return; });
+ if (update_err == ERR_OK) {
+ blob value = dup->to_json_blob();
+ // Note: this function is `async`, it may not be persisted completed
+ // after executing, now using `_is_altering` to judge whether `updating` or
+ // `completed`, if `_is_altering`, dup->alter_status() will return `ERR_BUSY`
+ _meta_svc->get_meta_storage()->set_data(std::string(dup->store_path),
+ std::move(value),
+ [=]() { dup->persist_status(); });
+ } else {
+ LOG_ERROR(
+ "created follower app[{}.{}] to trigger duplicate checkpoint failed: "
"duplication_status = {}, create_err = {}, update_err = {}",
dup->remote_cluster_name,
dup->app_name,
duplication_status_to_string(dup->status()),
create_err,
update_err);
- }
- });
+ }
+ });
}
void meta_duplication_service::check_follower_app_if_create_completed(
@@ -539,7 +539,7 @@ void meta_duplication_service::check_follower_app_if_create_completed(
msg,
_meta_svc->tracker(),
[=](error_code err, query_cfg_response &&resp) mutable {
- FAIL_POINT_INJECT_NOT_RETURN_F("create_app_ok", [&](absl::string_view s) -> void {
+ FAIL_POINT_INJECT_NOT_RETURN_F("create_app_ok", [&](std::string_view s) -> void {
err = ERR_OK;
int count = dup->partition_count;
while (count-- > 0) {
@@ -588,7 +588,7 @@ void meta_duplication_service::check_follower_app_if_create_completed(
}
FAIL_POINT_INJECT_F("persist_dup_status_failed",
- [&](absl::string_view s) -> void { return; });
+ [&](std::string_view s) -> void { return; });
if (update_err == ERR_OK) {
blob value = dup->to_json_blob();
// Note: this function is `async`, it may not be persisted completed
diff --git a/src/meta/load_balance_policy.cpp b/src/meta/load_balance_policy.cpp
index 929579674..1278b35f9 100644
--- a/src/meta/load_balance_policy.cpp
+++ b/src/meta/load_balance_policy.cpp
@@ -29,7 +29,7 @@
#include <mutex>
#include <ostream>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "dsn.layer2_types.h"
#include "meta/meta_data.h"
#include "meta_admin_types.h"
@@ -146,8 +146,7 @@ generate_balancer_request(const app_mapper &apps,
const host_port &from,
const host_port &to)
{
- FAIL_POINT_INJECT_F("generate_balancer_request",
- [](absl::string_view name) { return nullptr; });
+ FAIL_POINT_INJECT_F("generate_balancer_request", [](std::string_view name) { return nullptr; });
configuration_balancer_request result;
result.gpid = pc.pid;
diff --git a/src/meta/meta_backup_service.cpp b/src/meta/meta_backup_service.cpp
index 7264089e9..2bfa64ede 100644
--- a/src/meta/meta_backup_service.cpp
+++ b/src/meta/meta_backup_service.cpp
@@ -15,7 +15,6 @@
// specific language governing permissions and limitations
// under the License.
-#include <absl/strings/string_view.h>
#include <boost/cstdint.hpp>
#include <boost/lexical_cast.hpp>
#include <fmt/core.h>
@@ -23,6 +22,7 @@
#include <prometheus/metric_type.h>
#include <algorithm>
#include <iterator>
+#include <string_view>
#include <type_traits>
#include <utility>
diff --git a/src/meta/meta_bulk_load_ingestion_context.cpp b/src/meta/meta_bulk_load_ingestion_context.cpp
index 6921d4ea8..79d01a4f1 100644
--- a/src/meta/meta_bulk_load_ingestion_context.cpp
+++ b/src/meta/meta_bulk_load_ingestion_context.cpp
@@ -26,7 +26,7 @@
#include "utils/fail_point.h"
#include "utils/fmt_logging.h"
#include "utils/string_conv.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
DSN_DEFINE_uint32(meta_server,
bulk_load_node_max_ingesting_count,
@@ -73,7 +73,7 @@ uint32_t ingestion_context::node_context::get_max_disk_ingestion_count(
const uint32_t max_node_ingestion_count) const
{
FAIL_POINT_INJECT_F("ingestion_node_context_disk_count",
- [](absl::string_view count_str) -> uint32_t {
+ [](std::string_view count_str) -> uint32_t {
uint32_t count = 0;
buf2uint32(count_str, count);
return count;
@@ -123,7 +123,7 @@ void ingestion_context::node_context::decrease(const std::string &disk_tag)
bool ingestion_context::try_partition_ingestion(const partition_configuration &pc,
const config_context &cc)
{
- FAIL_POINT_INJECT_F("ingestion_try_partition_ingestion", [=](absl::string_view) -> bool {
+ FAIL_POINT_INJECT_F("ingestion_try_partition_ingestion", [=](std::string_view) -> bool {
auto info = partition_node_info();
info.pid = pc.pid;
_running_partitions[pc.pid] = info;
@@ -158,7 +158,7 @@ void ingestion_context::add_partition(const partition_node_info &info)
void ingestion_context::remove_partition(const gpid &pid)
{
FAIL_POINT_INJECT_F("ingestion_context_remove_partition",
- [=](absl::string_view) { _running_partitions.erase(pid); });
+ [=](std::string_view) { _running_partitions.erase(pid); });
if (_running_partitions.find(pid) == _running_partitions.end()) {
return;
diff --git a/src/meta/meta_bulk_load_service.cpp b/src/meta/meta_bulk_load_service.cpp
index aa2688ce5..198fb003e 100644
--- a/src/meta/meta_bulk_load_service.cpp
+++ b/src/meta/meta_bulk_load_service.cpp
@@ -26,7 +26,7 @@
#include <cstdint>
#include <type_traits>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "block_service/block_service.h"
#include "block_service/block_service_manager.h"
#include "common/replica_envs.h"
@@ -101,7 +101,7 @@ void bulk_load_service::initialize_bulk_load_service()
void bulk_load_service::on_start_bulk_load(start_bulk_load_rpc rpc)
{
FAIL_POINT_INJECT_F("meta_on_start_bulk_load",
- [=](absl::string_view) { rpc.response().err = ERR_OK; });
+ [=](std::string_view) { rpc.response().err = ERR_OK; });
const auto &request = rpc.request();
auto &response = rpc.response();
@@ -171,7 +171,7 @@ bulk_load_service::check_bulk_load_request_params(const start_bulk_load_request
std::string &hint_msg)
{
FAIL_POINT_INJECT_F("meta_check_bulk_load_request_params",
- [](absl::string_view) -> error_code { return ERR_OK; });
+ [](std::string_view) -> error_code { return ERR_OK; });
if (!validate_ingest_behind(envs, request.ingest_behind)) {
hint_msg = fmt::format("inconsistent ingestion behind option");
@@ -414,7 +414,7 @@ bool bulk_load_service::check_partition_status(
// ThreadPool: THREAD_POOL_META_STATE
void bulk_load_service::partition_bulk_load(const std::string &app_name, const gpid &pid)
{
- FAIL_POINT_INJECT_F("meta_bulk_load_partition_bulk_load", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("meta_bulk_load_partition_bulk_load", [](std::string_view) {});
partition_configuration pc;
if (!check_partition_status(app_name,
@@ -583,7 +583,7 @@ void bulk_load_service::on_partition_bulk_load_reply(error_code err,
// ThreadPool: THREAD_POOL_META_STATE
void bulk_load_service::try_resend_bulk_load_request(const std::string &app_name, const gpid &pid)
{
- FAIL_POINT_INJECT_F("meta_bulk_load_resend_request", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("meta_bulk_load_resend_request", [](std::string_view) {});
zauto_read_lock l(_lock);
if (is_app_bulk_loading_unlocked(pid.get_app_id())) {
tasking::enqueue(LPC_META_STATE_NORMAL,
@@ -1091,7 +1091,7 @@ void bulk_load_service::update_app_status_on_remote_storage_unlocked(
int32_t app_id, bulk_load_status::type new_status, error_code err, bool should_send_request)
{
FAIL_POINT_INJECT_F("meta_update_app_status_on_remote_storage_unlocked",
- [](absl::string_view) {});
+ [](std::string_view) {});
app_bulk_load_info ainfo = _app_bulk_load_info[app_id];
auto old_status = ainfo.status;
@@ -1223,7 +1223,7 @@ bool bulk_load_service::check_ever_ingestion_succeed(const partition_configurati
// ThreadPool: THREAD_POOL_META_STATE
void bulk_load_service::partition_ingestion(const std::string &app_name, const gpid &pid)
{
- FAIL_POINT_INJECT_F("meta_bulk_load_partition_ingestion", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("meta_bulk_load_partition_ingestion", [](std::string_view) {});
auto app_status = get_app_bulk_load_status(pid.get_app_id());
if (app_status != bulk_load_status::BLS_INGESTING) {
@@ -1659,7 +1659,7 @@ void bulk_load_service::on_clear_bulk_load(clear_bulk_load_rpc rpc)
void bulk_load_service::do_clear_app_bulk_load_result(int32_t app_id, clear_bulk_load_rpc rpc)
{
FAIL_POINT_INJECT_F("meta_do_clear_app_bulk_load_result",
- [rpc](absl::string_view) { rpc.response().err = ERR_OK; });
+ [rpc](std::string_view) { rpc.response().err = ERR_OK; });
std::string bulk_load_path = get_app_bulk_load_path(app_id);
_meta_svc->get_meta_storage()->delete_node_recursively(
std::move(bulk_load_path), [this, app_id, bulk_load_path, rpc]() {
@@ -1753,7 +1753,7 @@ void bulk_load_service::do_sync_partition(const gpid &pid, std::string &partitio
// ThreadPool: THREAD_POOL_META_SERVER
void bulk_load_service::try_to_continue_bulk_load()
{
- FAIL_POINT_INJECT_F("meta_try_to_continue_bulk_load", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("meta_try_to_continue_bulk_load", [](std::string_view) {});
zauto_read_lock l(_lock);
for (const auto app_id : _bulk_load_app_id) {
app_bulk_load_info ainfo = _app_bulk_load_info[app_id];
diff --git a/src/meta/meta_server_failure_detector.cpp b/src/meta/meta_server_failure_detector.cpp
index 1d900fbcb..9e198582c 100644
--- a/src/meta/meta_server_failure_detector.cpp
+++ b/src/meta/meta_server_failure_detector.cpp
@@ -30,7 +30,7 @@
#include <thread>
#include <utility>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "fd_types.h"
#include "meta/meta_options.h"
#include "meta/meta_service.h"
@@ -107,7 +107,7 @@ void meta_server_failure_detector::on_worker_connected(const host_port &node)
bool meta_server_failure_detector::get_leader(host_port *leader)
{
- FAIL_POINT_INJECT_F("meta_server_failure_detector_get_leader", [leader](absl::string_view str) {
+ FAIL_POINT_INJECT_F("meta_server_failure_detector_get_leader", [leader](std::string_view str) {
/// the format of str is : true#{ip}:{port} or false#{ip}:{port}
auto pos = str.find("#");
// get leader host_port
diff --git a/src/meta/meta_service.cpp b/src/meta/meta_service.cpp
index 1de9069bb..98f0339ce 100644
--- a/src/meta/meta_service.cpp
+++ b/src/meta/meta_service.cpp
@@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
-#include <absl/strings/string_view.h>
+#include <string_view>
// IWYU pragma: no_include <boost/detail/basic_pointerbuf.hpp>
// IWYU pragma: no_include <ext/alloc_traits.h>
#include <boost/lexical_cast.hpp>
diff --git a/src/meta/table_metrics.cpp b/src/meta/table_metrics.cpp
index 7b2a21af5..2bacf28ac 100644
--- a/src/meta/table_metrics.cpp
+++ b/src/meta/table_metrics.cpp
@@ -17,7 +17,7 @@
#include "table_metrics.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
// IWYU pragma: no_include <ext/alloc_traits.h>
#include <fmt/core.h>
#include <stddef.h>
diff --git a/src/nfs/nfs_client_impl.cpp b/src/nfs/nfs_client_impl.cpp
index 867d1891a..5b2bcd365 100644
--- a/src/nfs/nfs_client_impl.cpp
+++ b/src/nfs/nfs_client_impl.cpp
@@ -30,7 +30,7 @@
// IWYU pragma: no_include <ext/alloc_traits.h>
#include <mutex>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "fmt/core.h"
#include "nfs/nfs_code_definition.h"
#include "nfs/nfs_node.h"
diff --git a/src/nfs/nfs_server_impl.cpp b/src/nfs/nfs_server_impl.cpp
index 001090d09..d4f8568b8 100644
--- a/src/nfs/nfs_server_impl.cpp
+++ b/src/nfs/nfs_server_impl.cpp
@@ -32,7 +32,7 @@
#include <mutex>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "fmt/core.h" // IWYU pragma: keep
#include "gutil/map_util.h"
#include "nfs/nfs_code_definition.h"
diff --git a/src/redis_protocol/proxy_lib/redis_parser.cpp b/src/redis_protocol/proxy_lib/redis_parser.cpp
index 9aea607ea..99683d902 100644
--- a/src/redis_protocol/proxy_lib/redis_parser.cpp
+++ b/src/redis_protocol/proxy_lib/redis_parser.cpp
@@ -32,7 +32,7 @@
#include <chrono>
#include <cstdint>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common/common.h"
#include "common/replication_other_types.h"
#include "pegasus/client.h"
@@ -207,7 +207,7 @@ void redis_parser::eat_all(char *dest, size_t length)
bool redis_parser::end_array_size()
{
int32_t count = 0;
- if (dsn_unlikely(!dsn::buf2int32(absl::string_view(_current_size), count))) {
+ if (dsn_unlikely(!dsn::buf2int32(std::string_view(_current_size), count))) {
LOG_ERROR_PREFIX("invalid size string \"{}\"", _current_size);
return false;
}
@@ -242,7 +242,7 @@ void redis_parser::append_current_bulk_string()
bool redis_parser::end_bulk_string_size()
{
int32_t length = 0;
- if (dsn_unlikely(!dsn::buf2int32(absl::string_view(_current_size), length))) {
+ if (dsn_unlikely(!dsn::buf2int32(std::string_view(_current_size), length))) {
LOG_ERROR_PREFIX("invalid size string \"{}\"", _current_size);
return false;
}
diff --git a/src/replica/backup/replica_backup_manager.cpp b/src/replica/backup/replica_backup_manager.cpp
index 42882a259..e94cc3aea 100644
--- a/src/replica/backup/replica_backup_manager.cpp
+++ b/src/replica/backup/replica_backup_manager.cpp
@@ -17,7 +17,7 @@
#include "replica_backup_manager.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <stdint.h>
#include <algorithm>
#include <chrono>
diff --git a/src/replica/bulk_load/replica_bulk_loader.cpp b/src/replica/bulk_load/replica_bulk_loader.cpp
index e8eb03987..b58afccc7 100644
--- a/src/replica/bulk_load/replica_bulk_loader.cpp
+++ b/src/replica/bulk_load/replica_bulk_loader.cpp
@@ -22,7 +22,7 @@
#include <utility>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "block_service/block_service_manager.h"
#include "common/bulk_load_common.h"
#include "common/gpid.h"
@@ -487,7 +487,7 @@ void replica_bulk_loader::download_files(const std::string &provider_name,
const std::string &remote_dir,
const std::string &local_dir)
{
- FAIL_POINT_INJECT_F("replica_bulk_loader_download_files", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_bulk_loader_download_files", [](std::string_view) {});
LOG_INFO_PREFIX("start to download files");
dist::block_service::block_filesystem *fs =
diff --git a/src/replica/disk_cleaner.cpp b/src/replica/disk_cleaner.cpp
index 805da2391..8a191d67f 100644
--- a/src/replica/disk_cleaner.cpp
+++ b/src/replica/disk_cleaner.cpp
@@ -36,7 +36,7 @@
#include "utils/fmt_logging.h"
#include "utils/macros.h"
#include "utils/string_conv.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
DSN_DEFINE_uint64(replication,
gc_disk_error_replica_interval_seconds,
@@ -148,7 +148,7 @@ bool parse_timestamp_us(const std::string &name, size_t suffix_size, uint64_t &t
}
const auto ok =
- dsn::buf2uint64(absl::string_view(name.data() + begin_idx, length), timestamp_us);
+ dsn::buf2uint64(std::string_view(name.data() + begin_idx, length), timestamp_us);
return ok ? timestamp_us > MIN_TIMESTAMP_US : false;
}
diff --git a/src/replica/duplication/duplication_pipeline.cpp b/src/replica/duplication/duplication_pipeline.cpp
index 53e54ece3..81c164763 100644
--- a/src/replica/duplication/duplication_pipeline.cpp
+++ b/src/replica/duplication/duplication_pipeline.cpp
@@ -17,7 +17,7 @@
#include "duplication_pipeline.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <stddef.h>
#include <algorithm>
#include <functional>
@@ -47,7 +47,7 @@ namespace replication {
// //
/*static*/ std::function<std::unique_ptr<mutation_duplicator>(
- replica_base *, absl::string_view /*remote cluster*/, absl::string_view /*app*/)>
+ replica_base *, std::string_view /*remote cluster*/, std::string_view /*app*/)>
mutation_duplicator::creator;
// //
diff --git a/src/replica/duplication/load_from_private_log.cpp b/src/replica/duplication/load_from_private_log.cpp
index 6b0af8225..b0e501409 100644
--- a/src/replica/duplication/load_from_private_log.cpp
+++ b/src/replica/duplication/load_from_private_log.cpp
@@ -20,7 +20,7 @@
#include <string>
#include <utility>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common/duplication_common.h"
#include "duplication_types.h"
#include "load_from_private_log.h"
@@ -119,7 +119,7 @@ void load_from_private_log::run()
repeat(1_s);
FAIL_POINT_INJECT_NOT_RETURN_F(
- "duplication_sync_complete", [&](absl::string_view s) -> void {
+ "duplication_sync_complete", [&](std::string_view s) -> void {
if (_duplicator->progress().confirmed_decree == invalid_decree) {
// set_confirmed_decree(9), the value must be equal (decree_start of
// `test_start_duplication` in `load_from_private_log_test.cpp`) -1
diff --git a/src/replica/duplication/mutation_batch.cpp b/src/replica/duplication/mutation_batch.cpp
index f50e7c113..9a6493cb9 100644
--- a/src/replica/duplication/mutation_batch.cpp
+++ b/src/replica/duplication/mutation_batch.cpp
@@ -21,7 +21,7 @@
#include <utility>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common/replication.codes.h"
#include "consensus_types.h"
#include "metadata_types.h"
diff --git a/src/replica/duplication/mutation_duplicator.h b/src/replica/duplication/mutation_duplicator.h
index b1c29e00f..cb6b3c65e 100644
--- a/src/replica/duplication/mutation_duplicator.h
+++ b/src/replica/duplication/mutation_duplicator.h
@@ -68,7 +68,7 @@ public:
// Singleton creator of mutation_duplicator.
static std::function<std::unique_ptr<mutation_duplicator>(
- replica_base *, absl::string_view /*remote cluster*/, absl::string_view /*app name*/)>
+ replica_base *, std::string_view /*remote cluster*/, std::string_view /*app name*/)>
creator;
explicit mutation_duplicator(replica_base *r) : replica_base(r) {}
@@ -84,7 +84,7 @@ protected:
};
inline std::unique_ptr<mutation_duplicator> new_mutation_duplicator(
- replica_base *r, absl::string_view remote_cluster_address, absl::string_view app)
+ replica_base *r, std::string_view remote_cluster_address, std::string_view app)
{
return mutation_duplicator::creator(r, remote_cluster_address, app);
}
diff --git a/src/replica/duplication/replica_duplicator.cpp b/src/replica/duplication/replica_duplicator.cpp
index 31d7e9d94..6bb75b92c 100644
--- a/src/replica/duplication/replica_duplicator.cpp
+++ b/src/replica/duplication/replica_duplicator.cpp
@@ -17,7 +17,7 @@
#include "replica_duplicator.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <rapidjson/document.h>
#include <rapidjson/encodings.h>
#include <rapidjson/stringbuffer.h>
diff --git a/src/replica/duplication/replica_duplicator_manager.cpp b/src/replica/duplication/replica_duplicator_manager.cpp
index d7a6437c2..2e1e61cc4 100644
--- a/src/replica/duplication/replica_duplicator_manager.cpp
+++ b/src/replica/duplication/replica_duplicator_manager.cpp
@@ -15,7 +15,7 @@
// specific language governing permissions and limitations
// under the License.
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <algorithm>
#include <cstdint>
#include <memory>
diff --git a/src/replica/duplication/replica_follower.cpp b/src/replica/duplication/replica_follower.cpp
index 4918f60e8..3373d9a86 100644
--- a/src/replica/duplication/replica_follower.cpp
+++ b/src/replica/duplication/replica_follower.cpp
@@ -42,7 +42,7 @@
#include "utils/filesystem.h"
#include "utils/fmt_logging.h"
#include "utils/ports.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/strings.h"
namespace dsn {
@@ -132,13 +132,13 @@ void replica_follower::async_duplicate_checkpoint_from_master_replica()
msg,
&_tracker,
[&](error_code err, query_cfg_response &&resp) mutable {
- FAIL_POINT_INJECT_F("duplicate_checkpoint_ok", [&](absl::string_view s) -> void {
+ FAIL_POINT_INJECT_F("duplicate_checkpoint_ok", [&](std::string_view s) -> void {
_tracker.set_tasks_success();
return;
});
FAIL_POINT_INJECT_F("duplicate_checkpoint_failed",
- [&](absl::string_view s) -> void { return; });
+ [&](std::string_view s) -> void { return; });
if (update_master_replica_config(err, std::move(resp)) == ERR_OK) {
copy_master_replica_checkpoint();
}
@@ -260,7 +260,7 @@ void replica_follower::nfs_copy_remote_files(const host_port &remote_node,
&_tracker,
[&, remote_dir](error_code err, size_t size) mutable {
FAIL_POINT_INJECT_NOT_RETURN_F("nfs_copy_ok",
- [&](absl::string_view s) -> void { err = ERR_OK; });
+ [&](std::string_view s) -> void { err = ERR_OK; });
if (dsn_unlikely(err != ERR_OK)) {
LOG_ERROR_PREFIX("nfs copy master[{}] checkpoint failed: checkpoint = {}, err = {}",
diff --git a/src/replica/duplication/test/duplication_test_base.h b/src/replica/duplication/test/duplication_test_base.h
index cd54fe9d8..d4dacf9b9 100644
--- a/src/replica/duplication/test/duplication_test_base.h
+++ b/src/replica/duplication/test/duplication_test_base.h
@@ -34,7 +34,7 @@ class duplication_test_base : public replica_test_base
public:
duplication_test_base()
{
- mutation_duplicator::creator = [](replica_base *r, absl::string_view, absl::string_view) {
+ mutation_duplicator::creator = [](replica_base *r, std::string_view, std::string_view) {
return std::make_unique<mock_mutation_duplicator>(r);
};
stub->_duplication_sync_timer = std::make_unique<duplication_sync_timer>(stub.get());
diff --git a/src/replica/log_file_stream.h b/src/replica/log_file_stream.h
index 3b901aed7..2b2567229 100644
--- a/src/replica/log_file_stream.h
+++ b/src/replica/log_file_stream.h
@@ -66,7 +66,7 @@ public:
fill_buffers();
}
- // TODO(wutao1): use absl::string_view instead of using blob.
+ // TODO(wutao1): use std::string_view instead of using blob.
// WARNING: the resulted blob is not guaranteed to be reference counted.
// possible error_code:
// ERR_OK result would always size as expected
diff --git a/src/replica/mutation_log_replay.cpp b/src/replica/mutation_log_replay.cpp
index 126d19cdf..ee891bcb7 100644
--- a/src/replica/mutation_log_replay.cpp
+++ b/src/replica/mutation_log_replay.cpp
@@ -38,7 +38,7 @@
#include "utils/errors.h"
#include "utils/fail_point.h"
#include "utils/fmt_logging.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace dsn {
namespace replication {
@@ -77,7 +77,7 @@ namespace replication {
size_t start_offset,
int64_t &end_offset)
{
- FAIL_POINT_INJECT_F("mutation_log_replay_block", [](absl::string_view) -> error_s {
+ FAIL_POINT_INJECT_F("mutation_log_replay_block", [](std::string_view) -> error_s {
return error_s::make(ERR_INCOMPLETE_DATA, "mutation_log_replay_block");
});
diff --git a/src/replica/mutation_log_utils.cpp b/src/replica/mutation_log_utils.cpp
index 9fed18ab8..e69fd1390 100644
--- a/src/replica/mutation_log_utils.cpp
+++ b/src/replica/mutation_log_utils.cpp
@@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <fmt/core.h>
#include <utility>
@@ -37,9 +37,9 @@ namespace dsn {
namespace replication {
namespace log_utils {
-/*extern*/ error_s open_read(absl::string_view path, /*out*/ log_file_ptr &file)
+/*extern*/ error_s open_read(std::string_view path, /*out*/ log_file_ptr &file)
{
- FAIL_POINT_INJECT_F("open_read", [](absl::string_view) -> error_s {
+ FAIL_POINT_INJECT_F("open_read", [](std::string_view) -> error_s {
return error_s::make(ERR_FILE_OPERATION_FAILED, "open_read");
});
@@ -53,7 +53,7 @@ namespace log_utils {
/*extern*/ error_s list_all_files(const std::string &dir, /*out*/ std::vector<std::string> &files)
{
- FAIL_POINT_INJECT_F("list_all_files", [](absl::string_view) -> error_s {
+ FAIL_POINT_INJECT_F("list_all_files", [](std::string_view) -> error_s {
return error_s::make(ERR_FILE_OPERATION_FAILED, "list_all_files");
});
diff --git a/src/replica/mutation_log_utils.h b/src/replica/mutation_log_utils.h
index fafa4fbf5..56a540543 100644
--- a/src/replica/mutation_log_utils.h
+++ b/src/replica/mutation_log_utils.h
@@ -34,13 +34,13 @@
#include "replica/mutation_log.h"
#include "utils/autoref_ptr.h"
#include "utils/errors.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace dsn {
namespace replication {
namespace log_utils {
-extern error_s open_read(absl::string_view path, /*out*/ log_file_ptr &file);
+extern error_s open_read(std::string_view path, /*out*/ log_file_ptr &file);
extern error_s list_all_files(const std::string &dir, /*out*/ std::vector<std::string> &files);
diff --git a/src/replica/replica.cpp b/src/replica/replica.cpp
index 24d5cf77e..f6d772169 100644
--- a/src/replica/replica.cpp
+++ b/src/replica/replica.cpp
@@ -26,7 +26,7 @@
#include "replica.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <fmt/core.h>
#include <rocksdb/status.h>
#include <functional>
diff --git a/src/replica/replica_base.cpp b/src/replica/replica_base.cpp
index ce4700abd..f45d9b43f 100644
--- a/src/replica/replica_base.cpp
+++ b/src/replica/replica_base.cpp
@@ -17,7 +17,7 @@
#include "replica_base.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <fmt/core.h>
METRIC_DEFINE_entity(replica);
@@ -41,7 +41,7 @@ metric_entity_ptr instantiate_replica_metric_entity(const gpid &id)
} // anonymous namespace
-replica_base::replica_base(gpid id, absl::string_view name, absl::string_view app_name)
+replica_base::replica_base(gpid id, std::string_view name, std::string_view app_name)
: _gpid(id),
_name(name),
_app_name(app_name),
diff --git a/src/replica/replica_base.h b/src/replica/replica_base.h
index 8909197a6..79583c13f 100644
--- a/src/replica/replica_base.h
+++ b/src/replica/replica_base.h
@@ -29,7 +29,7 @@
#include <string>
#include "common/gpid.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/fmt_logging.h"
#include "utils/metrics.h"
@@ -39,7 +39,7 @@ namespace replication {
/// Base class for types that are one-instance-per-replica.
struct replica_base
{
- replica_base(gpid id, absl::string_view name, absl::string_view app_name);
+ replica_base(gpid id, std::string_view name, std::string_view app_name);
explicit replica_base(replica_base *rhs)
: replica_base(rhs->get_gpid(), rhs->replica_name(), rhs->_app_name)
diff --git a/src/replica/replica_check.cpp b/src/replica/replica_check.cpp
index adb4771b5..32cf5f70f 100644
--- a/src/replica/replica_check.cpp
+++ b/src/replica/replica_check.cpp
@@ -58,7 +58,7 @@
#include "utils/fail_point.h"
#include "utils/flags.h"
#include "utils/fmt_logging.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/metrics.h"
#include "utils/thread_access_checker.h"
@@ -82,7 +82,7 @@ namespace replication {
void replica::init_group_check()
{
- FAIL_POINT_INJECT_F("replica_init_group_check", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_init_group_check", [](std::string_view) {});
_checker.only_one_thread_access();
@@ -102,7 +102,7 @@ void replica::init_group_check()
void replica::broadcast_group_check()
{
- FAIL_POINT_INJECT_F("replica_broadcast_group_check", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_broadcast_group_check", [](std::string_view) {});
CHECK_NOTNULL(_primary_states.group_check_task, "");
diff --git a/src/replica/replica_config.cpp b/src/replica/replica_config.cpp
index 7abeaf454..3bcd5faaf 100644
--- a/src/replica/replica_config.cpp
+++ b/src/replica/replica_config.cpp
@@ -40,7 +40,7 @@
#include <utility>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "bulk_load/replica_bulk_loader.h"
#include "common/gpid.h"
#include "common/replica_envs.h"
@@ -694,7 +694,7 @@ bool replica::is_same_ballot_status_change_allowed(partition_status::type olds,
bool replica::update_local_configuration(const replica_configuration &config,
bool same_ballot /* = false*/)
{
- FAIL_POINT_INJECT_F("replica_update_local_configuration", [=](absl::string_view) -> bool {
+ FAIL_POINT_INJECT_F("replica_update_local_configuration", [=](std::string_view) -> bool {
auto old_status = status();
_config = config;
LOG_INFO_PREFIX(
diff --git a/src/replica/replica_disk_migrator.cpp b/src/replica/replica_disk_migrator.cpp
index 189c81c42..f0ff78438 100644
--- a/src/replica/replica_disk_migrator.cpp
+++ b/src/replica/replica_disk_migrator.cpp
@@ -20,7 +20,7 @@
#include <boost/algorithm/string/replace.hpp>
#include <fmt/core.h>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common/fs_manager.h"
#include "common/gpid.h"
#include "common/replication.codes.h"
@@ -164,7 +164,7 @@ void replica_disk_migrator::migrate_replica(const replica_disk_migrate_request &
// THREAD_POOL_REPLICATION_LONG
bool replica_disk_migrator::init_target_dir(const replica_disk_migrate_request &req)
{
- FAIL_POINT_INJECT_F("init_target_dir", [this](absl::string_view) -> bool {
+ FAIL_POINT_INJECT_F("init_target_dir", [this](std::string_view) -> bool {
reset_status();
return false;
});
@@ -210,7 +210,7 @@ bool replica_disk_migrator::init_target_dir(const replica_disk_migrate_request &
// THREAD_POOL_REPLICATION_LONG
bool replica_disk_migrator::migrate_replica_checkpoint(const replica_disk_migrate_request &req)
{
- FAIL_POINT_INJECT_F("migrate_replica_checkpoint", [this](absl::string_view) -> bool {
+ FAIL_POINT_INJECT_F("migrate_replica_checkpoint", [this](std::string_view) -> bool {
reset_status();
return false;
});
@@ -246,7 +246,7 @@ bool replica_disk_migrator::migrate_replica_checkpoint(const replica_disk_migrat
// THREAD_POOL_REPLICATION_LONG
bool replica_disk_migrator::migrate_replica_app_info(const replica_disk_migrate_request &req)
{
- FAIL_POINT_INJECT_F("migrate_replica_app_info", [this](absl::string_view) -> bool {
+ FAIL_POINT_INJECT_F("migrate_replica_app_info", [this](std::string_view) -> bool {
reset_status();
return false;
});
diff --git a/src/replica/replica_stub.cpp b/src/replica/replica_stub.cpp
index 32f5141e1..ebab55380 100644
--- a/src/replica/replica_stub.cpp
+++ b/src/replica/replica_stub.cpp
@@ -43,7 +43,7 @@
#include <type_traits>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "backup/replica_backup_server.h"
#include "bulk_load/replica_bulk_loader.h"
#include "common/backup_common.h"
@@ -1810,7 +1810,7 @@ void replica_stub::open_replica(
dsn::utils::filesystem::rename_path(origin_tmp_dir, origin_dir);
rep = load_replica(origin_dn, origin_dir.c_str());
- FAIL_POINT_INJECT_F("mock_replica_load", [&](absl::string_view) -> void {});
+ FAIL_POINT_INJECT_F("mock_replica_load", [&](std::string_view) -> void {});
}
}
}
@@ -1999,7 +1999,7 @@ bool replica_stub::validate_replica_dir(const std::string &dir,
replica *replica_stub::load_replica(dir_node *dn, const char *dir)
{
FAIL_POINT_INJECT_F("mock_replica_load",
- [&](absl::string_view) -> replica * { return nullptr; });
+ [&](std::string_view) -> replica * { return nullptr; });
app_info ai;
gpid pid;
@@ -2671,7 +2671,7 @@ replica_ptr replica_stub::create_child_replica_if_not_found(gpid child_pid,
const std::string &parent_dir)
{
FAIL_POINT_INJECT_F(
- "replica_stub_create_child_replica_if_not_found", [=](absl::string_view) -> replica_ptr {
+ "replica_stub_create_child_replica_if_not_found", [=](std::string_view) -> replica_ptr {
const auto dn =
_fs_manager.create_child_replica_dir(app->app_type, child_pid, parent_dir);
CHECK_NOTNULL(dn, "");
@@ -2716,8 +2716,7 @@ void replica_stub::split_replica_error_handler(gpid pid, local_execution handler
dsn::error_code
replica_stub::split_replica_exec(dsn::task_code code, gpid pid, local_execution handler)
{
- FAIL_POINT_INJECT_F("replica_stub_split_replica_exec",
- [](absl::string_view) { return ERR_OK; });
+ FAIL_POINT_INJECT_F("replica_stub_split_replica_exec", [](std::string_view) { return ERR_OK; });
replica_ptr replica = pid.get_app_id() == 0 ? nullptr : get_replica(pid);
if (replica && handler) {
tasking::enqueue(
diff --git a/src/replica/replication_app_base.cpp b/src/replica/replication_app_base.cpp
index 045577259..e15df7829 100644
--- a/src/replica/replication_app_base.cpp
+++ b/src/replica/replication_app_base.cpp
@@ -32,7 +32,7 @@
#include <utility>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common/bulk_load_common.h"
#include "common/duplication_common.h"
#include "common/replica_envs.h"
@@ -281,7 +281,7 @@ int replication_app_base::on_batched_write_requests(int64_t decree,
error_code replication_app_base::apply_mutation(const mutation *mu)
{
FAIL_POINT_INJECT_F("replication_app_base_apply_mutation",
- [](absl::string_view) { return ERR_OK; });
+ [](std::string_view) { return ERR_OK; });
CHECK_EQ_PREFIX(mu->data.header.decree, last_committed_decree() + 1);
CHECK_EQ_PREFIX(mu->data.updates.size(), mu->client_requests.size());
diff --git a/src/replica/split/replica_split_manager.cpp b/src/replica/split/replica_split_manager.cpp
index e59096e4d..371d92f09 100644
--- a/src/replica/split/replica_split_manager.cpp
+++ b/src/replica/split/replica_split_manager.cpp
@@ -48,7 +48,7 @@
#include "utils/filesystem.h"
#include "utils/flags.h"
#include "utils/fmt_logging.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/thread_access_checker.h"
METRIC_DEFINE_counter(replica,
@@ -172,7 +172,7 @@ void replica_split_manager::child_init_replica(gpid parent_gpid,
const host_port &primary_host_port,
ballot init_ballot) // on child partition
{
- FAIL_POINT_INJECT_F("replica_child_init_replica", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_child_init_replica", [](std::string_view) {});
if (status() != partition_status::PS_INACTIVE) {
LOG_WARNING_PREFIX("wrong status({})", enum_to_string(status()));
@@ -218,7 +218,7 @@ void replica_split_manager::child_init_replica(gpid parent_gpid,
// ThreadPool: THREAD_POOL_REPLICATION
void replica_split_manager::child_check_split_context() // on child partition
{
- FAIL_POINT_INJECT_F("replica_child_check_split_context", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_child_check_split_context", [](std::string_view) {});
if (status() != partition_status::PS_PARTITION_SPLIT) {
LOG_ERROR_PREFIX("wrong status({})", enum_to_string(status()));
@@ -246,7 +246,7 @@ void replica_split_manager::child_check_split_context() // on child partition
// ThreadPool: THREAD_POOL_REPLICATION
bool replica_split_manager::parent_check_states() // on parent partition
{
- FAIL_POINT_INJECT_F("replica_parent_check_states", [](absl::string_view) { return true; });
+ FAIL_POINT_INJECT_F("replica_parent_check_states", [](std::string_view) { return true; });
if (_split_status != split_status::SPLITTING || _child_init_ballot != get_ballot() ||
_child_gpid.get_app_id() == 0 ||
@@ -387,7 +387,7 @@ void replica_split_manager::child_learn_states(learn_state lstate,
uint64_t total_file_size,
decree last_committed_decree) // on child partition
{
- FAIL_POINT_INJECT_F("replica_child_learn_states", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_child_learn_states", [](std::string_view) {});
if (status() != partition_status::PS_PARTITION_SPLIT) {
LOG_ERROR_PREFIX("wrong status({})", enum_to_string(status()));
@@ -455,7 +455,7 @@ replica_split_manager::child_apply_private_logs(std::vector<std::string> plog_fi
uint64_t total_file_size,
decree last_committed_decree) // on child partition
{
- FAIL_POINT_INJECT_F("replica_child_apply_private_logs", [](absl::string_view arg) {
+ FAIL_POINT_INJECT_F("replica_child_apply_private_logs", [](std::string_view arg) {
return error_code::try_get(arg.data(), ERR_OK);
});
@@ -547,7 +547,7 @@ replica_split_manager::child_apply_private_logs(std::vector<std::string> plog_fi
// ThreadPool: THREAD_POOL_REPLICATION
void replica_split_manager::child_catch_up_states() // on child partition
{
- FAIL_POINT_INJECT_F("replica_child_catch_up_states", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_child_catch_up_states", [](std::string_view) {});
if (status() != partition_status::PS_PARTITION_SPLIT) {
LOG_ERROR_PREFIX("wrong status, status is {}", enum_to_string(status()));
@@ -612,7 +612,7 @@ void replica_split_manager::child_catch_up_states() // on child partition
// ThreadPool: THREAD_POOL_REPLICATION
void replica_split_manager::child_notify_catch_up() // on child partition
{
- FAIL_POINT_INJECT_F("replica_child_notify_catch_up", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_child_notify_catch_up", [](std::string_view) {});
std::unique_ptr<notify_catch_up_request> request = std::make_unique<notify_catch_up_request>();
request->parent_gpid = _replica->_split_states.parent_gpid;
@@ -737,7 +737,7 @@ void replica_split_manager::parent_handle_child_catch_up(
// ThreadPool: THREAD_POOL_REPLICATION
void replica_split_manager::parent_check_sync_point_commit(decree sync_point) // on primary parent
{
- FAIL_POINT_INJECT_F("replica_parent_check_sync_point_commit", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_parent_check_sync_point_commit", [](std::string_view) {});
if (status() != partition_status::PS_PRIMARY) {
LOG_ERROR_PREFIX("wrong status({})", enum_to_string(status()));
parent_handle_split_error("check_sync_point_commit failed, primary changed", false);
@@ -803,7 +803,7 @@ void replica_split_manager::parent_send_update_partition_count_request(
int32_t new_partition_count,
std::shared_ptr<std::unordered_set<host_port>> ¬_replied_addresses) // on primary parent
{
- FAIL_POINT_INJECT_F("replica_parent_update_partition_count_request", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_parent_update_partition_count_request", [](std::string_view) {});
CHECK_EQ_PREFIX(status(), partition_status::PS_PRIMARY);
@@ -964,7 +964,7 @@ void replica_split_manager::on_update_child_group_partition_count_reply(
// ThreadPool: THREAD_POOL_REPLICATION
void replica_split_manager::register_child_on_meta(ballot b) // on primary parent
{
- FAIL_POINT_INJECT_F("replica_register_child_on_meta", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_register_child_on_meta", [](std::string_view) {});
if (status() != partition_status::PS_PRIMARY || _split_status != split_status::SPLITTING) {
LOG_ERROR_PREFIX(
@@ -1013,7 +1013,7 @@ void replica_split_manager::register_child_on_meta(ballot b) // on primary paren
void replica_split_manager::parent_send_register_request(
const register_child_request &request) // on primary parent
{
- FAIL_POINT_INJECT_F("replica_parent_send_register_request", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_parent_send_register_request", [](std::string_view) {});
CHECK_EQ_PREFIX(status(), partition_status::PS_INACTIVE);
LOG_INFO_PREFIX(
@@ -1043,7 +1043,7 @@ void replica_split_manager::on_register_child_on_meta_reply(
const register_child_request &request,
const register_child_response &response) // on primary parent
{
- FAIL_POINT_INJECT_F("replica_on_register_child_on_meta_reply", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_on_register_child_on_meta_reply", [](std::string_view) {});
_replica->_checker.only_one_thread_access();
@@ -1517,7 +1517,7 @@ void replica_split_manager::primary_parent_handle_stop_split(
void replica_split_manager::parent_send_notify_stop_request(
split_status::type meta_split_status) // on primary parent
{
- FAIL_POINT_INJECT_F("replica_parent_send_notify_stop_request", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("replica_parent_send_notify_stop_request", [](std::string_view) {});
auto meta_address =
dsn::dns_resolver::instance().resolve_address(_stub->_failure_detector->get_servers());
std::unique_ptr<notify_stop_split_request> req = std::make_unique<notify_stop_split_request>();
diff --git a/src/runtime/profiler.cpp b/src/runtime/profiler.cpp
index 7852f1fcb..2228cc35b 100644
--- a/src/runtime/profiler.cpp
+++ b/src/runtime/profiler.cpp
@@ -57,7 +57,7 @@ START<== queue(server) == ENQUEUE <===== net(reply) ======= REPLY <=============
#include <string>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "aio/aio_task.h"
#include "fmt/core.h"
#include "profiler_header.h"
diff --git a/src/runtime/rpc/dns_resolver.cpp b/src/runtime/rpc/dns_resolver.cpp
index 2eab9d832..bfd7f5206 100644
--- a/src/runtime/rpc/dns_resolver.cpp
+++ b/src/runtime/rpc/dns_resolver.cpp
@@ -22,7 +22,7 @@
#include <set>
#include <utility>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "fmt/core.h"
#include "fmt/format.h"
#include "runtime/rpc/dns_resolver.h"
diff --git a/src/runtime/rpc/network.cpp b/src/runtime/rpc/network.cpp
index 2c506fd72..c572b19a8 100644
--- a/src/runtime/rpc/network.cpp
+++ b/src/runtime/rpc/network.cpp
@@ -32,7 +32,7 @@
#include <list>
#include <utility>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "message_parser_manager.h"
#include "runtime/api_task.h"
#include "runtime/rpc/rpc_address.h"
diff --git a/src/runtime/rpc/rpc_address.cpp b/src/runtime/rpc/rpc_address.cpp
index f8d02d7c6..064dd458d 100644
--- a/src/runtime/rpc/rpc_address.cpp
+++ b/src/runtime/rpc/rpc_address.cpp
@@ -35,7 +35,7 @@
#include <sys/socket.h>
#include <string>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "runtime/rpc/group_address.h"
#include "utils/error_code.h"
#include "utils/fixed_size_buffer_pool.h"
@@ -143,7 +143,7 @@ bool rpc_address::is_site_local_address(uint32_t ip_net)
/*static*/
bool rpc_address::is_docker_netcard(const char *netcard_interface, uint32_t ip_net)
{
- if (absl::string_view(netcard_interface).find("docker") != absl::string_view::npos) {
+ if (std::string_view(netcard_interface).find("docker") != std::string_view::npos) {
return true;
}
uint32_t iphost = ntohl(ip_net);
diff --git a/src/runtime/rpc/thrift_message_parser.cpp b/src/runtime/rpc/thrift_message_parser.cpp
index 08bbfcb87..d54707502 100644
--- a/src/runtime/rpc/thrift_message_parser.cpp
+++ b/src/runtime/rpc/thrift_message_parser.cpp
@@ -46,7 +46,7 @@
#include "utils/endians.h"
#include "utils/fmt_logging.h"
#include "utils/fmt_utils.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/strings.h"
namespace dsn {
@@ -340,7 +340,7 @@ void thrift_message_parser::prepare_on_send(message_ex *msg)
// first total length, but we don't know the length, so firstly we put a placeholder
header_proto.writeI32(0);
// then the error_message
- header_proto.writeString(absl::string_view(header->server.error_name));
+ header_proto.writeString(std::string_view(header->server.error_name));
// then the thrift message begin
header_proto.writeMessageBegin(
header->rpc_name, ::apache::thrift::protocol::T_REPLY, header->id);
diff --git a/src/runtime/task/task_queue.cpp b/src/runtime/task/task_queue.cpp
index 8b0de42b3..b22e01bdb 100644
--- a/src/runtime/task/task_queue.cpp
+++ b/src/runtime/task/task_queue.cpp
@@ -26,7 +26,7 @@
#include "task_queue.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "fmt/core.h"
#include "runtime/rpc/network.h"
#include "runtime/rpc/rpc_engine.h"
diff --git a/src/security/sasl_client_wrapper.cpp b/src/security/sasl_client_wrapper.cpp
index 50296826d..acdce301e 100644
--- a/src/security/sasl_client_wrapper.cpp
+++ b/src/security/sasl_client_wrapper.cpp
@@ -23,7 +23,7 @@
#include "utils/error_code.h"
#include "utils/fail_point.h"
#include "utils/flags.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
DSN_DECLARE_string(service_fqdn);
DSN_DECLARE_string(service_name);
@@ -33,7 +33,7 @@ namespace security {
error_s sasl_client_wrapper::init()
{
- FAIL_POINT_INJECT_F("sasl_client_wrapper_init", [](absl::string_view str) {
+ FAIL_POINT_INJECT_F("sasl_client_wrapper_init", [](std::string_view str) {
error_code err = error_code::try_get(str.data(), ERR_UNKNOWN);
return error_s::make(err);
});
@@ -45,7 +45,7 @@ error_s sasl_client_wrapper::init()
error_s sasl_client_wrapper::start(const std::string &mechanism, const blob &input, blob &output)
{
- FAIL_POINT_INJECT_F("sasl_client_wrapper_start", [](absl::string_view str) {
+ FAIL_POINT_INJECT_F("sasl_client_wrapper_start", [](std::string_view str) {
error_code err = error_code::try_get(str.data(), ERR_UNKNOWN);
return error_s::make(err);
});
@@ -62,7 +62,7 @@ error_s sasl_client_wrapper::start(const std::string &mechanism, const blob &inp
error_s sasl_client_wrapper::step(const blob &input, blob &output)
{
- FAIL_POINT_INJECT_F("sasl_client_wrapper_step", [](absl::string_view str) {
+ FAIL_POINT_INJECT_F("sasl_client_wrapper_step", [](std::string_view str) {
error_code err = error_code::try_get(str.data(), ERR_UNKNOWN);
return error_s::make(err);
});
diff --git a/src/security/sasl_server_wrapper.cpp b/src/security/sasl_server_wrapper.cpp
index 4cda84241..67498926f 100644
--- a/src/security/sasl_server_wrapper.cpp
+++ b/src/security/sasl_server_wrapper.cpp
@@ -23,7 +23,7 @@
#include "utils/error_code.h"
#include "utils/fail_point.h"
#include "utils/flags.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
DSN_DECLARE_string(service_fqdn);
DSN_DECLARE_string(service_name);
@@ -33,7 +33,7 @@ namespace security {
error_s sasl_server_wrapper::init()
{
- FAIL_POINT_INJECT_F("sasl_server_wrapper_init", [](absl::string_view str) {
+ FAIL_POINT_INJECT_F("sasl_server_wrapper_init", [](std::string_view str) {
error_code err = error_code::try_get(str.data(), ERR_UNKNOWN);
return error_s::make(err);
});
@@ -45,7 +45,7 @@ error_s sasl_server_wrapper::init()
error_s sasl_server_wrapper::start(const std::string &mechanism, const blob &input, blob &output)
{
- FAIL_POINT_INJECT_F("sasl_server_wrapper_start", [](absl::string_view str) {
+ FAIL_POINT_INJECT_F("sasl_server_wrapper_start", [](std::string_view str) {
error_code err = error_code::try_get(str.data(), ERR_UNKNOWN);
return error_s::make(err);
});
@@ -61,7 +61,7 @@ error_s sasl_server_wrapper::start(const std::string &mechanism, const blob &inp
error_s sasl_server_wrapper::step(const blob &input, blob &output)
{
- FAIL_POINT_INJECT_F("sasl_server_wrapper_step", [](absl::string_view str) {
+ FAIL_POINT_INJECT_F("sasl_server_wrapper_step", [](std::string_view str) {
error_code err = error_code::try_get(str.data(), ERR_UNKNOWN);
return error_s::make(err);
});
diff --git a/src/security/sasl_wrapper.cpp b/src/security/sasl_wrapper.cpp
index 14c28f7b9..7d7d222c5 100644
--- a/src/security/sasl_wrapper.cpp
+++ b/src/security/sasl_wrapper.cpp
@@ -23,7 +23,7 @@
#include "sasl_server_wrapper.h"
#include "utils/error_code.h"
#include "utils/fail_point.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace dsn {
namespace security {
@@ -44,7 +44,7 @@ sasl_wrapper::~sasl_wrapper()
error_s sasl_wrapper::retrieve_username(std::string &output)
{
- FAIL_POINT_INJECT_F("sasl_wrapper_retrieve_username", [](absl::string_view str) {
+ FAIL_POINT_INJECT_F("sasl_wrapper_retrieve_username", [](std::string_view str) {
error_code err = error_code::try_get(str.data(), ERR_UNKNOWN);
return error_s::make(err);
});
diff --git a/src/server/capacity_unit_calculator.cpp b/src/server/capacity_unit_calculator.cpp
index cfbc086f4..8a4745f4b 100644
--- a/src/server/capacity_unit_calculator.cpp
+++ b/src/server/capacity_unit_calculator.cpp
@@ -19,7 +19,7 @@
#include "capacity_unit_calculator.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <rocksdb/status.h>
#include <sys/param.h>
#include <cmath>
diff --git a/src/server/compaction_filter_rule.cpp b/src/server/compaction_filter_rule.cpp
index cf369da96..d04b67e70 100644
--- a/src/server/compaction_filter_rule.cpp
+++ b/src/server/compaction_filter_rule.cpp
@@ -22,14 +22,14 @@
#include "base/pegasus_utils.h"
#include "base/pegasus_value_schema.h"
#include "utils/fmt_logging.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/strings.h"
namespace pegasus {
namespace server {
-bool string_pattern_match(absl::string_view value,
+bool string_pattern_match(std::string_view value,
string_match_type type,
- absl::string_view filter_pattern)
+ std::string_view filter_pattern)
{
if (filter_pattern.empty())
return false;
@@ -38,7 +38,7 @@ bool string_pattern_match(absl::string_view value,
switch (type) {
case string_match_type::SMT_MATCH_ANYWHERE:
- return value.find(filter_pattern) != absl::string_view::npos;
+ return value.find(filter_pattern) != std::string_view::npos;
case string_match_type::SMT_MATCH_PREFIX:
return dsn::utils::mequals(value.data(), filter_pattern.data(), filter_pattern.length());
case string_match_type::SMT_MATCH_POSTFIX:
@@ -53,27 +53,27 @@ bool string_pattern_match(absl::string_view value,
hashkey_pattern_rule::hashkey_pattern_rule(uint32_t data_version) {}
-bool hashkey_pattern_rule::match(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value) const
+bool hashkey_pattern_rule::match(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value) const
{
return string_pattern_match(hash_key, match_type, pattern);
}
sortkey_pattern_rule::sortkey_pattern_rule(uint32_t data_version) {}
-bool sortkey_pattern_rule::match(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value) const
+bool sortkey_pattern_rule::match(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value) const
{
return string_pattern_match(sort_key, match_type, pattern);
}
ttl_range_rule::ttl_range_rule(uint32_t data_version) : data_version(data_version) {}
-bool ttl_range_rule::match(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value) const
+bool ttl_range_rule::match(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value) const
{
uint32_t expire_ts = pegasus_extract_expire_ts(data_version, existing_value);
// if start_ttl and stop_ttl = 0, it means we want to delete keys which have no ttl
diff --git a/src/server/compaction_filter_rule.h b/src/server/compaction_filter_rule.h
index be211ba6b..e471a759f 100644
--- a/src/server/compaction_filter_rule.h
+++ b/src/server/compaction_filter_rule.h
@@ -30,7 +30,7 @@
#include "utils/enum_helper.h"
#include "utils/factory_store.h"
#include "utils/fmt_utils.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace pegasus {
namespace server {
@@ -76,9 +76,9 @@ public:
// TODO(zhaoliwei): we can use `value_filed` to replace existing_value in the later,
// after the refactor of value schema
- virtual bool match(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value) const = 0;
+ virtual bool match(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value) const = 0;
};
enum string_match_type
@@ -102,9 +102,9 @@ class hashkey_pattern_rule : public compaction_filter_rule
public:
hashkey_pattern_rule(uint32_t data_version = VERSION_MAX);
- bool match(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value) const;
+ bool match(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value) const;
DEFINE_JSON_SERIALIZATION(pattern, match_type)
private:
@@ -124,9 +124,9 @@ class sortkey_pattern_rule : public compaction_filter_rule
public:
sortkey_pattern_rule(uint32_t data_version = VERSION_MAX);
- bool match(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value) const;
+ bool match(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value) const;
DEFINE_JSON_SERIALIZATION(pattern, match_type)
private:
@@ -144,9 +144,9 @@ class ttl_range_rule : public compaction_filter_rule
public:
explicit ttl_range_rule(uint32_t data_version);
- bool match(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value) const;
+ bool match(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value) const;
DEFINE_JSON_SERIALIZATION(start_ttl, stop_ttl)
private:
diff --git a/src/server/compaction_operation.cpp b/src/server/compaction_operation.cpp
index 5c139073c..a7d21bd32 100644
--- a/src/server/compaction_operation.cpp
+++ b/src/server/compaction_operation.cpp
@@ -17,7 +17,7 @@
* under the License.
*/
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <cstdint>
#include "base/pegasus_utils.h"
@@ -30,9 +30,9 @@ namespace pegasus {
namespace server {
compaction_operation::~compaction_operation() = default;
-bool compaction_operation::all_rules_match(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value) const
+bool compaction_operation::all_rules_match(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value) const
{
if (rules.empty()) {
return false;
@@ -55,9 +55,9 @@ delete_key::delete_key(filter_rules &&rules, uint32_t data_version)
delete_key::delete_key(uint32_t data_version) : compaction_operation(data_version) {}
-bool delete_key::filter(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value,
+bool delete_key::filter(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value,
std::string *new_value,
bool *value_changed) const
{
@@ -74,9 +74,9 @@ update_ttl::update_ttl(filter_rules &&rules, uint32_t data_version)
update_ttl::update_ttl(uint32_t data_version) : compaction_operation(data_version) {}
-bool update_ttl::filter(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value,
+bool update_ttl::filter(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value,
std::string *new_value,
bool *value_changed) const
{
diff --git a/src/server/compaction_operation.h b/src/server/compaction_operation.h
index d7c9d811e..1101be1fa 100644
--- a/src/server/compaction_operation.h
+++ b/src/server/compaction_operation.h
@@ -21,13 +21,12 @@
#include <gtest/gtest_prod.h>
#include <stdint.h>
-#include <algorithm>
#include <memory>
#include <string>
+#include <string_view>
#include <utility>
#include <vector>
-#include "absl/strings/string_view.h"
#include "common/json_helper.h"
#include "compaction_filter_rule.h"
#include "utils/blob.h"
@@ -75,18 +74,18 @@ public:
explicit compaction_operation(uint32_t data_version) : data_version(data_version) {}
virtual ~compaction_operation() = 0;
- bool all_rules_match(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value) const;
+ bool all_rules_match(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value) const;
void set_rules(filter_rules &&rules);
/**
* @return false indicates that this key-value should be removed
* If you want to modify the existing_value, you can pass it back through new_value and
* value_changed needs to be set to true in this case.
*/
- virtual bool filter(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value,
+ virtual bool filter(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value,
std::string *new_value,
bool *value_changed) const = 0;
@@ -106,9 +105,9 @@ public:
delete_key(filter_rules &&rules, uint32_t data_version);
explicit delete_key(uint32_t data_version);
- bool filter(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value,
+ bool filter(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value,
std::string *new_value,
bool *value_changed) const;
@@ -154,9 +153,9 @@ public:
update_ttl(filter_rules &&rules, uint32_t data_version);
explicit update_ttl(uint32_t data_version);
- bool filter(absl::string_view hash_key,
- absl::string_view sort_key,
- absl::string_view existing_value,
+ bool filter(std::string_view hash_key,
+ std::string_view sort_key,
+ std::string_view existing_value,
std::string *new_value,
bool *value_changed) const;
DEFINE_JSON_SERIALIZATION(type, value)
diff --git a/src/server/hotkey_collector.cpp b/src/server/hotkey_collector.cpp
index a05c3012d..ca67a74d0 100644
--- a/src/server/hotkey_collector.cpp
+++ b/src/server/hotkey_collector.cpp
@@ -17,7 +17,7 @@
#include "hotkey_collector.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <boost/container_hash/extensions.hpp>
// IWYU pragma: no_include <ext/alloc_traits.h>
#include <fmt/core.h>
@@ -129,7 +129,7 @@ find_outlier_index(const std::vector<uint64_t> &captured_keys, int threshold, in
// TODO: (Tangyanzhao) replace it to xxhash
-/*extern*/ int get_bucket_id(absl::string_view data, int bucket_num)
+/*extern*/ int get_bucket_id(std::string_view data, int bucket_num)
{
return static_cast<int>(boost::hash_range(data.begin(), data.end()) % bucket_num);
}
@@ -398,7 +398,7 @@ struct blob_hash
{
std::size_t operator()(const dsn::blob &str) const
{
- absl::string_view cp = str.to_string_view();
+ std::string_view cp = str.to_string_view();
return boost::hash_range(cp.begin(), cp.end());
}
};
@@ -429,8 +429,8 @@ void hotkey_fine_data_collector::analyse_data(detect_hotkey_result &result)
// the weight of all the collected hash keys
std::vector<uint64_t> weights;
weights.reserve(hash_keys_weight.size());
- absl::string_view weight_max_key; // the hashkey with the max weight
- uint64_t weight_max = 0; // the max weight by far
+ std::string_view weight_max_key; // the hashkey with the max weight
+ uint64_t weight_max = 0; // the max weight by far
for (const auto &iter : hash_keys_weight) {
weights.push_back(iter.second);
if (iter.second > weight_max) {
diff --git a/src/server/hotkey_collector.h b/src/server/hotkey_collector.h
index 826bf157b..b8b74ccf5 100644
--- a/src/server/hotkey_collector.h
+++ b/src/server/hotkey_collector.h
@@ -29,7 +29,7 @@
#include "replica/replica_base.h"
#include "replica_admin_types.h"
#include "utils/blob.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace pegasus {
namespace server {
@@ -50,7 +50,7 @@ struct detect_hotkey_result
}
};
-extern int get_bucket_id(absl::string_view data, int bucket_num);
+extern int get_bucket_id(std::string_view data, int bucket_num);
extern bool
find_outlier_index(const std::vector<uint64_t> &captured_keys, int threshold, int &hot_index);
diff --git a/src/server/hotspot_partition_calculator.cpp b/src/server/hotspot_partition_calculator.cpp
index b2b71e698..9b99abfab 100644
--- a/src/server/hotspot_partition_calculator.cpp
+++ b/src/server/hotspot_partition_calculator.cpp
@@ -22,7 +22,7 @@
#include <algorithm>
#include <cmath>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "client/replication_ddl_client.h"
#include "common/gpid.h"
#include "common/serialization_helper/dsn.layer2_types.h"
@@ -212,7 +212,7 @@ void hotspot_partition_calculator::send_detect_hotkey_request(
const dsn::replication::hotkey_type::type hotkey_type,
const dsn::replication::detect_action::type action)
{
- FAIL_POINT_INJECT_F("send_detect_hotkey_request", [](absl::string_view) {});
+ FAIL_POINT_INJECT_F("send_detect_hotkey_request", [](std::string_view) {});
int app_id = -1;
int partition_count = -1;
diff --git a/src/server/key_ttl_compaction_filter.h b/src/server/key_ttl_compaction_filter.h
index 8df418de9..6f4f07f05 100644
--- a/src/server/key_ttl_compaction_filter.h
+++ b/src/server/key_ttl_compaction_filter.h
@@ -79,7 +79,7 @@ public:
}
if (!_user_specified_operations.empty()) {
- absl::string_view value_view = utils::to_string_view(existing_value);
+ std::string_view value_view = utils::to_string_view(existing_value);
if (*value_changed) {
value_view = *new_value;
}
@@ -92,7 +92,7 @@ public:
}
bool user_specified_operation_filter(const rocksdb::Slice &key,
- absl::string_view existing_value,
+ std::string_view existing_value,
std::string *new_value,
bool *value_changed) const
{
diff --git a/src/server/pegasus_event_listener.cpp b/src/server/pegasus_event_listener.cpp
index 1c4ebbfd6..ba6b622c9 100644
--- a/src/server/pegasus_event_listener.cpp
+++ b/src/server/pegasus_event_listener.cpp
@@ -19,7 +19,7 @@
#include "pegasus_event_listener.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <rocksdb/compaction_job_stats.h>
#include <rocksdb/table_properties.h>
#include <rocksdb/types.h>
diff --git a/src/server/pegasus_manual_compact_service.cpp b/src/server/pegasus_manual_compact_service.cpp
index f4d143690..e55077e7a 100644
--- a/src/server/pegasus_manual_compact_service.cpp
+++ b/src/server/pegasus_manual_compact_service.cpp
@@ -19,7 +19,7 @@
#include "pegasus_manual_compact_service.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <limits.h>
#include <nlohmann/json.hpp>
#include <nlohmann/json_fwd.hpp>
diff --git a/src/server/pegasus_mutation_duplicator.cpp b/src/server/pegasus_mutation_duplicator.cpp
index 6b29e4e3e..8b82557bb 100644
--- a/src/server/pegasus_mutation_duplicator.cpp
+++ b/src/server/pegasus_mutation_duplicator.cpp
@@ -19,7 +19,7 @@
#include "pegasus_mutation_duplicator.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <fmt/core.h>
#include <pegasus/error.h>
#include <sys/types.h>
@@ -75,9 +75,9 @@ DSN_TAG_VARIABLE(dup_max_allowed_write_size, FT_MUTABLE);
/// static definition of mutation_duplicator::creator.
/*static*/ std::function<std::unique_ptr<mutation_duplicator>(
- replica_base *, absl::string_view, absl::string_view)>
+ replica_base *, std::string_view, std::string_view)>
mutation_duplicator::creator =
- [](replica_base *r, absl::string_view remote, absl::string_view app) {
+ [](replica_base *r, std::string_view remote, std::string_view app) {
return std::make_unique<pegasus::server::pegasus_mutation_duplicator>(r, remote, app);
};
@@ -116,8 +116,8 @@ using namespace dsn::literals::chrono_literals;
}
pegasus_mutation_duplicator::pegasus_mutation_duplicator(dsn::replication::replica_base *r,
- absl::string_view remote_cluster,
- absl::string_view app)
+ std::string_view remote_cluster,
+ std::string_view app)
: mutation_duplicator(r),
_remote_cluster(remote_cluster),
METRIC_VAR_INIT_replica(dup_shipped_successful_requests),
diff --git a/src/server/pegasus_mutation_duplicator.h b/src/server/pegasus_mutation_duplicator.h
index 2d81a6a37..0ac19c68d 100644
--- a/src/server/pegasus_mutation_duplicator.h
+++ b/src/server/pegasus_mutation_duplicator.h
@@ -31,7 +31,7 @@
#include "runtime/task/task_code.h"
#include "runtime/task/task_tracker.h"
#include "utils/chrono_literals.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/metrics.h"
#include "utils/zlocks.h"
@@ -61,8 +61,8 @@ class pegasus_mutation_duplicator : public dsn::replication::mutation_duplicator
public:
pegasus_mutation_duplicator(dsn::replication::replica_base *r,
- absl::string_view remote_cluster,
- absl::string_view app);
+ std::string_view remote_cluster,
+ std::string_view app);
void duplicate(mutation_tuple_set muts, callback cb) override;
diff --git a/src/server/pegasus_server_impl.cpp b/src/server/pegasus_server_impl.cpp
index e3a75c2fe..ffb4b8c1c 100644
--- a/src/server/pegasus_server_impl.cpp
+++ b/src/server/pegasus_server_impl.cpp
@@ -44,7 +44,7 @@
#include <ostream>
#include <set>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "base/idl_utils.h" // IWYU pragma: keep
#include "base/meta_store.h"
#include "base/pegasus_key_schema.h"
@@ -2354,7 +2354,7 @@ bool pegasus_server_impl::validate_filter(::dsn::apps::filter_type::type filter_
return false;
if (filter_type == ::dsn::apps::filter_type::FT_MATCH_ANYWHERE) {
return value.to_string_view().find(filter_pattern.to_string_view()) !=
- absl::string_view::npos;
+ std::string_view::npos;
} else if (filter_type == ::dsn::apps::filter_type::FT_MATCH_PREFIX) {
return dsn::utils::mequals(
value.data(), filter_pattern.data(), filter_pattern.length());
diff --git a/src/server/pegasus_server_impl_init.cpp b/src/server/pegasus_server_impl_init.cpp
index d7611e266..d679d6ce3 100644
--- a/src/server/pegasus_server_impl_init.cpp
+++ b/src/server/pegasus_server_impl_init.cpp
@@ -17,7 +17,6 @@
* under the License.
*/
-#include <absl/strings/string_view.h>
#include <fmt/core.h>
#include <rocksdb/cache.h>
#include <rocksdb/filter_policy.h>
@@ -27,12 +26,12 @@
#include <rocksdb/table.h>
#include <rocksdb/write_buffer_manager.h>
#include <stdio.h>
-#include <algorithm>
#include <cstdint>
#include <memory>
#include <mutex>
#include <set>
#include <string>
+#include <string_view>
#include <unordered_map>
#include <utility>
#include <vector>
diff --git a/src/server/pegasus_server_write.cpp b/src/server/pegasus_server_write.cpp
index 1bb6c968a..33437ca69 100644
--- a/src/server/pegasus_server_write.cpp
+++ b/src/server/pegasus_server_write.cpp
@@ -17,7 +17,7 @@
* under the License.
*/
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <fmt/core.h>
#include <rocksdb/status.h>
#include <thrift/transport/TTransportException.h>
diff --git a/src/server/pegasus_write_service.cpp b/src/server/pegasus_write_service.cpp
index d688ab6e4..2fb573326 100644
--- a/src/server/pegasus_write_service.cpp
+++ b/src/server/pegasus_write_service.cpp
@@ -17,7 +17,7 @@
* under the License.
*/
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <fmt/core.h>
#include <rocksdb/status.h>
#include <stddef.h>
diff --git a/src/server/pegasus_write_service_impl.h b/src/server/pegasus_write_service_impl.h
index 2169b273e..35a9c6399 100644
--- a/src/server/pegasus_write_service_impl.h
+++ b/src/server/pegasus_write_service_impl.h
@@ -90,7 +90,7 @@ public:
int empty_put(int64_t decree)
{
int err =
- _rocksdb_wrapper->write_batch_put(decree, absl::string_view(), absl::string_view(), 0);
+ _rocksdb_wrapper->write_batch_put(decree, std::string_view(), std::string_view(), 0);
auto cleanup = dsn::defer([this]() { _rocksdb_wrapper->clear_up_write_batch(); });
if (err != rocksdb::Status::kOk) {
return err;
@@ -178,7 +178,7 @@ public:
resp.decree = decree;
resp.server = _primary_host_port;
- absl::string_view raw_key = update.key.to_string_view();
+ std::string_view raw_key = update.key.to_string_view();
int64_t new_value = 0;
uint32_t new_expire_ts = 0;
db_get_context get_ctx;
@@ -275,7 +275,7 @@ public:
pegasus_generate_key(check_key, update.hash_key, update.check_sort_key);
db_get_context get_context;
- absl::string_view check_raw_key = check_key.to_string_view();
+ std::string_view check_raw_key = check_key.to_string_view();
int err = _rocksdb_wrapper->get(check_raw_key, &get_context);
if (err != rocksdb::Status::kOk) {
// read check value failed
@@ -327,7 +327,7 @@ public:
} else {
// check not passed, write empty record to update rocksdb's last flushed decree
resp.error = _rocksdb_wrapper->write_batch_put(
- decree, absl::string_view(), absl::string_view(), 0);
+ decree, std::string_view(), std::string_view(), 0);
}
auto cleanup = dsn::defer([this]() { _rocksdb_wrapper->clear_up_write_batch(); });
@@ -395,7 +395,7 @@ public:
pegasus_generate_key(check_key, update.hash_key, update.check_sort_key);
db_get_context get_context;
- absl::string_view check_raw_key = check_key.to_string_view();
+ std::string_view check_raw_key = check_key.to_string_view();
int err = _rocksdb_wrapper->get(check_raw_key, &get_context);
if (err != rocksdb::Status::kOk) {
// read check value failed
@@ -453,7 +453,7 @@ public:
} else {
// check not passed, write empty record to update rocksdb's last flushed decree
resp.error = _rocksdb_wrapper->write_batch_put(
- decree, absl::string_view(), absl::string_view(), 0);
+ decree, std::string_view(), std::string_view(), 0);
}
auto cleanup = dsn::defer([this]() { _rocksdb_wrapper->clear_up_write_batch(); });
@@ -562,7 +562,7 @@ private:
_rocksdb_wrapper->clear_up_write_batch();
}
- static dsn::blob composite_raw_key(absl::string_view hash_key, absl::string_view sort_key)
+ static dsn::blob composite_raw_key(std::string_view hash_key, std::string_view sort_key)
{
dsn::blob raw_key;
pegasus_generate_key(raw_key, hash_key, sort_key);
@@ -609,7 +609,7 @@ private:
return false;
if (check_type == ::dsn::apps::cas_check_type::CT_VALUE_MATCH_ANYWHERE) {
return value.to_string_view().find(check_operand.to_string_view()) !=
- absl::string_view::npos;
+ std::string_view::npos;
} else if (check_type == ::dsn::apps::cas_check_type::CT_VALUE_MATCH_PREFIX) {
return dsn::utils::mequals(
value.data(), check_operand.data(), check_operand.length());
diff --git a/src/server/rocksdb_wrapper.cpp b/src/server/rocksdb_wrapper.cpp
index 59203836b..078b2b9d8 100644
--- a/src/server/rocksdb_wrapper.cpp
+++ b/src/server/rocksdb_wrapper.cpp
@@ -19,7 +19,7 @@
#include "rocksdb_wrapper.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <rocksdb/db.h>
#include <rocksdb/slice.h>
#include <rocksdb/status.h>
@@ -74,9 +74,9 @@ rocksdb_wrapper::rocksdb_wrapper(pegasus_server_impl *server)
_wt_opts->disableWAL = true;
}
-int rocksdb_wrapper::get(absl::string_view raw_key, /*out*/ db_get_context *ctx)
+int rocksdb_wrapper::get(std::string_view raw_key, /*out*/ db_get_context *ctx)
{
- FAIL_POINT_INJECT_F("db_get", [](absl::string_view) -> int { return FAIL_DB_GET; });
+ FAIL_POINT_INJECT_F("db_get", [](std::string_view) -> int { return FAIL_DB_GET; });
rocksdb::Status s = _db->Get(_rd_opts, utils::to_rocksdb_slice(raw_key), &(ctx->raw_value));
if (dsn_likely(s.ok())) {
@@ -105,20 +105,20 @@ int rocksdb_wrapper::get(absl::string_view raw_key, /*out*/ db_get_context *ctx)
}
int rocksdb_wrapper::write_batch_put(int64_t decree,
- absl::string_view raw_key,
- absl::string_view value,
+ std::string_view raw_key,
+ std::string_view value,
uint32_t expire_sec)
{
return write_batch_put_ctx(db_write_context::empty(decree), raw_key, value, expire_sec);
}
int rocksdb_wrapper::write_batch_put_ctx(const db_write_context &ctx,
- absl::string_view raw_key,
- absl::string_view value,
+ std::string_view raw_key,
+ std::string_view value,
uint32_t expire_sec)
{
FAIL_POINT_INJECT_F("db_write_batch_put",
- [](absl::string_view) -> int { return FAIL_DB_WRITE_BATCH_PUT; });
+ [](std::string_view) -> int { return FAIL_DB_WRITE_BATCH_PUT; });
uint64_t new_timetag = ctx.remote_timetag;
if (!ctx.is_duplicated_write()) { // local write
@@ -143,7 +143,7 @@ int rocksdb_wrapper::write_batch_put_ctx(const db_write_context &ctx,
if (local_timetag >= new_timetag) {
// ignore this stale update with lower timetag,
// and write an empty record instead
- raw_key = value = absl::string_view();
+ raw_key = value = std::string_view();
}
}
}
@@ -175,7 +175,7 @@ int rocksdb_wrapper::write(int64_t decree)
return FLAGS_inject_write_error_for_test;
}
- FAIL_POINT_INJECT_F("db_write", [](absl::string_view) -> int { return FAIL_DB_WRITE; });
+ FAIL_POINT_INJECT_F("db_write", [](std::string_view) -> int { return FAIL_DB_WRITE; });
rocksdb::Status status =
_write_batch->Put(_meta_cf, meta_store::LAST_FLUSHED_DECREE, std::to_string(decree));
@@ -194,10 +194,10 @@ int rocksdb_wrapper::write(int64_t decree)
return status.code();
}
-int rocksdb_wrapper::write_batch_delete(int64_t decree, absl::string_view raw_key)
+int rocksdb_wrapper::write_batch_delete(int64_t decree, std::string_view raw_key)
{
FAIL_POINT_INJECT_F("db_write_batch_delete",
- [](absl::string_view) -> int { return FAIL_DB_WRITE_BATCH_DELETE; });
+ [](std::string_view) -> int { return FAIL_DB_WRITE_BATCH_DELETE; });
rocksdb::Status s = _write_batch->Delete(utils::to_rocksdb_slice(raw_key));
if (dsn_unlikely(!s.ok())) {
diff --git a/src/server/rocksdb_wrapper.h b/src/server/rocksdb_wrapper.h
index 00a682a54..c73f5cb91 100644
--- a/src/server/rocksdb_wrapper.h
+++ b/src/server/rocksdb_wrapper.h
@@ -29,7 +29,7 @@
#include "pegasus_value_schema.h"
#include "replica/replica_base.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/metrics.h"
namespace rocksdb {
@@ -54,18 +54,18 @@ public:
/// is returned.
/// \result ctx.expired=true if record expired. Still rocksdb::Status::kOk is returned.
/// \result ctx.found=false if record is not found. Still rocksdb::Status::kOk is returned.
- int get(absl::string_view raw_key, /*out*/ db_get_context *ctx);
+ int get(std::string_view raw_key, /*out*/ db_get_context *ctx);
int write_batch_put(int64_t decree,
- absl::string_view raw_key,
- absl::string_view value,
+ std::string_view raw_key,
+ std::string_view value,
uint32_t expire_sec);
int write_batch_put_ctx(const db_write_context &ctx,
- absl::string_view raw_key,
- absl::string_view value,
+ std::string_view raw_key,
+ std::string_view value,
uint32_t expire_sec);
int write(int64_t decree);
- int write_batch_delete(int64_t decree, absl::string_view raw_key);
+ int write_batch_delete(int64_t decree, std::string_view raw_key);
void clear_up_write_batch();
int ingest_files(int64_t decree,
const std::vector<std::string> &sst_file_list,
diff --git a/src/server/test/hotkey_collector_test.cpp b/src/server/test/hotkey_collector_test.cpp
index c8eb49cad..56864962a 100644
--- a/src/server/test/hotkey_collector_test.cpp
+++ b/src/server/test/hotkey_collector_test.cpp
@@ -17,7 +17,7 @@
#include "server/hotkey_collector.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <fmt/core.h>
#include <chrono>
#include <thread>
@@ -70,7 +70,7 @@ TEST(hotkey_collector_public_func_test, get_bucket_id_test)
{
int bucket_id = -1;
for (int i = 0; i < 1000000; i++) {
- bucket_id = get_bucket_id(absl::string_view(generate_hash_key_by_random(false)),
+ bucket_id = get_bucket_id(std::string_view(generate_hash_key_by_random(false)),
FLAGS_hotkey_buckets_num);
ASSERT_GE(bucket_id, 0);
ASSERT_LT(bucket_id, FLAGS_hotkey_buckets_num);
diff --git a/src/server/test/pegasus_mutation_duplicator_test.cpp b/src/server/test/pegasus_mutation_duplicator_test.cpp
index e93e3bfc3..f4e6d871d 100644
--- a/src/server/test/pegasus_mutation_duplicator_test.cpp
+++ b/src/server/test/pegasus_mutation_duplicator_test.cpp
@@ -19,12 +19,11 @@
#include "server/pegasus_mutation_duplicator.h"
-#include <absl/strings/string_view.h>
#include <fmt/core.h>
#include <pegasus/error.h>
#include <sys/types.h>
-#include <algorithm>
#include <memory>
+#include <string_view>
#include <tuple>
#include <utility>
#include <vector>
diff --git a/src/server/test/pegasus_write_service_impl_test.cpp b/src/server/test/pegasus_write_service_impl_test.cpp
index a076699ef..0ac33faa4 100644
--- a/src/server/test/pegasus_write_service_impl_test.cpp
+++ b/src/server/test/pegasus_write_service_impl_test.cpp
@@ -34,7 +34,7 @@
#include "server/rocksdb_wrapper.h"
#include "utils/blob.h"
#include "utils/fail_point.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace pegasus {
namespace server {
@@ -55,7 +55,7 @@ public:
_rocksdb_wrapper = _write_impl->_rocksdb_wrapper.get();
}
- int db_get(absl::string_view raw_key, db_get_context *get_ctx)
+ int db_get(std::string_view raw_key, db_get_context *get_ctx)
{
return _rocksdb_wrapper->get(raw_key, get_ctx);
}
@@ -79,7 +79,7 @@ public:
{
pegasus_write_service_impl_test::SetUp();
pegasus::pegasus_generate_key(
- req.key, absl::string_view("hash_key"), absl::string_view("sort_key"));
+ req.key, std::string_view("hash_key"), std::string_view("sort_key"));
}
dsn::apps::incr_request req;
diff --git a/src/server/test/rocksdb_wrapper_test.cpp b/src/server/test/rocksdb_wrapper_test.cpp
index e7f4b0006..7831afc71 100644
--- a/src/server/test/rocksdb_wrapper_test.cpp
+++ b/src/server/test/rocksdb_wrapper_test.cpp
@@ -39,7 +39,7 @@
#include "utils/blob.h"
#include "utils/error_code.h"
#include "utils/fmt_logging.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace pegasus {
namespace server {
@@ -60,12 +60,12 @@ public:
_rocksdb_wrapper = _server_write->_write_svc->_impl->_rocksdb_wrapper.get();
pegasus::pegasus_generate_key(
- _raw_key, absl::string_view("hash_key"), absl::string_view("sort_key"));
+ _raw_key, std::string_view("hash_key"), std::string_view("sort_key"));
}
void single_set(db_write_context write_ctx,
dsn::blob raw_key,
- absl::string_view user_value,
+ std::string_view user_value,
int32_t expire_ts_seconds)
{
ASSERT_EQ(_rocksdb_wrapper->write_batch_put_ctx(
@@ -93,7 +93,7 @@ public:
SetUp();
}
- uint64_t read_timestamp_from(absl::string_view raw_value)
+ uint64_t read_timestamp_from(std::string_view raw_value)
{
uint64_t local_timetag =
pegasus_extract_timetag(_rocksdb_wrapper->_pegasus_data_version, raw_value);
diff --git a/src/shell/command_helper.h b/src/shell/command_helper.h
index 0a5440b40..912fae917 100644
--- a/src/shell/command_helper.h
+++ b/src/shell/command_helper.h
@@ -56,7 +56,7 @@
#include "runtime/task/async_calls.h"
#include "tools/mutation_log_tool.h"
#include "utils/fmt_utils.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "utils/errors.h"
#include "utils/metrics.h"
#include "utils/ports.h"
@@ -286,7 +286,7 @@ inline bool validate_filter(pegasus::pegasus_client::filter_type filter_type,
if (value.length() < filter_pattern.length())
return false;
if (filter_type == pegasus::pegasus_client::FT_MATCH_ANYWHERE) {
- return absl::string_view(value).find(filter_pattern) != absl::string_view::npos;
+ return std::string_view(value).find(filter_pattern) != std::string_view::npos;
} else if (filter_type == pegasus::pegasus_client::FT_MATCH_PREFIX) {
return dsn::utils::mequals(
value.data(), filter_pattern.data(), filter_pattern.length());
diff --git a/src/shell/commands.h b/src/shell/commands.h
index 3ea3c132c..2e6044b06 100644
--- a/src/shell/commands.h
+++ b/src/shell/commands.h
@@ -29,7 +29,7 @@
#include "utils/filesystem.h"
#include "utils/output_utils.h"
#include "utils/string_conv.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "client/replication_ddl_client.h"
#include "tools/mutation_log_tool.h"
diff --git a/src/utils/blob.h b/src/utils/blob.h
index fea1a7a0e..3cdbce320 100644
--- a/src/utils/blob.h
+++ b/src/utils/blob.h
@@ -29,7 +29,7 @@
#include <memory>
#include <cstring>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include <thrift/protocol/TBinaryProtocol.h>
#include <thrift/protocol/TProtocol.h>
@@ -59,7 +59,7 @@ public:
{
}
- /// NOTE: Use absl::string_view whenever possible.
+ /// NOTE: Use std::string_view whenever possible.
/// blob is designed for shared buffer, never use it as constant view.
/// Maybe we could deprecate this function in the future.
blob(const char *buffer, int offset, unsigned int length)
@@ -100,7 +100,7 @@ public:
_length = length;
}
- /// Deprecated. Use absl::string_view whenever possible.
+ /// Deprecated. Use std::string_view whenever possible.
void assign(const char *buffer, int offset, unsigned int length)
{
_holder = nullptr;
@@ -165,7 +165,7 @@ public:
return os << bb.to_string();
}
- absl::string_view to_string_view() const { return absl::string_view(_data, _length); }
+ std::string_view to_string_view() const { return std::string_view(_data, _length); }
uint32_t read(::apache::thrift::protocol::TProtocol *iprot);
uint32_t write(::apache::thrift::protocol::TProtocol *oprot) const;
diff --git a/src/utils/builtin_metrics.cpp b/src/utils/builtin_metrics.cpp
index 3ffb8f147..6c8b8ee5a 100644
--- a/src/utils/builtin_metrics.cpp
+++ b/src/utils/builtin_metrics.cpp
@@ -17,7 +17,7 @@
#include "utils/builtin_metrics.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <stdint.h>
#include <functional>
diff --git a/src/utils/endians.h b/src/utils/endians.h
index f41a4b775..1d0739b4e 100644
--- a/src/utils/endians.h
+++ b/src/utils/endians.h
@@ -23,7 +23,7 @@
#include "api_utilities.h"
#include "fmt_logging.h"
#include "ports.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace dsn {
@@ -108,7 +108,7 @@ private:
class data_input
{
public:
- explicit data_input(absl::string_view s) : _p(s.data()), _size(s.size()) {}
+ explicit data_input(std::string_view s) : _p(s.data()), _size(s.size()) {}
uint8_t read_u8() { return read_unsigned<uint8_t>(); }
@@ -118,7 +118,7 @@ public:
uint64_t read_u64() { return read_unsigned<uint64_t>(); }
- absl::string_view read_str() { return {_p, _size}; }
+ std::string_view read_str() { return {_p, _size}; }
void skip(size_t sz)
{
diff --git a/src/utils/errors.h b/src/utils/errors.h
index 8d5806efa..734ee9375 100644
--- a/src/utils/errors.h
+++ b/src/utils/errors.h
@@ -33,7 +33,7 @@
#include "utils/fmt_logging.h"
#include "utils/fmt_utils.h"
#include "utils/ports.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace dsn {
@@ -72,7 +72,7 @@ public:
error_s(error_s &&rhs) noexcept = default;
error_s &operator=(error_s &&) noexcept = default;
- static error_s make(error_code code, absl::string_view reason) { return error_s(code, reason); }
+ static error_s make(error_code code, std::string_view reason) { return error_s(code, reason); }
static error_s make(error_code code)
{
@@ -145,14 +145,14 @@ public:
}
private:
- error_s(error_code code, absl::string_view msg) noexcept : _info(new error_info(code, msg)) {}
+ error_s(error_code code, std::string_view msg) noexcept : _info(new error_info(code, msg)) {}
struct error_info
{
error_code code;
std::string msg; // TODO(wutao1): use raw char* to improve performance?
- error_info(error_code c, absl::string_view s) : code(c), msg(s) {}
+ error_info(error_code c, std::string_view s) : code(c), msg(s) {}
};
void copy(const error_s &rhs)
diff --git a/src/utils/fail_point.cpp b/src/utils/fail_point.cpp
index 45c809c02..49790832c 100644
--- a/src/utils/fail_point.cpp
+++ b/src/utils/fail_point.cpp
@@ -34,7 +34,7 @@
#include <string>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "fail_point_impl.h"
#include "utils/fail_point.h"
#include "utils/fmt_logging.h"
@@ -45,7 +45,7 @@ namespace fail {
static fail_point_registry REGISTRY;
-/*extern*/ const std::string *eval(absl::string_view name)
+/*extern*/ const std::string *eval(std::string_view name)
{
fail_point *p = REGISTRY.try_get(name);
if (!p) {
@@ -71,7 +71,7 @@ inline const char *task_type_to_string(fail_point::task_type t)
}
}
-/*extern*/ void cfg(absl::string_view name, absl::string_view action)
+/*extern*/ void cfg(std::string_view name, std::string_view action)
{
fail_point &p = REGISTRY.create_if_not_exists(name);
p.set_action(action);
@@ -93,14 +93,14 @@ inline const char *task_type_to_string(fail_point::task_type t)
_S_FAIL_POINT_ENABLED = false;
}
-void fail_point::set_action(absl::string_view action)
+void fail_point::set_action(std::string_view action)
{
if (!parse_from_string(action)) {
LOG_FATAL("unrecognized command: {}", action);
}
}
-bool fail_point::parse_from_string(absl::string_view action)
+bool fail_point::parse_from_string(std::string_view action)
{
_max_cnt = -1;
_freq = 100;
diff --git a/src/utils/fail_point.h b/src/utils/fail_point.h
index 663dcbd5a..2c0e4111b 100644
--- a/src/utils/fail_point.h
+++ b/src/utils/fail_point.h
@@ -36,7 +36,7 @@
#include <string>
#include "utils/ports.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
// The only entry to define a fail point with `return` function: lambda function must be
// return non-void type. When a fail point is defined, it's referenced via the name.
@@ -75,14 +75,14 @@
namespace dsn {
namespace fail {
-extern const std::string *eval(absl::string_view name);
+extern const std::string *eval(std::string_view name);
/// Set new actions to a fail point at runtime.
/// The format of an action is `[p%][cnt*]task[(arg)]`. `p%` is the expected probability that
/// the action is triggered, and `cnt*` is the max times the action can be triggered.
/// For example, `20%3*print(still alive!)` means the fail point has 20% chance to print a
/// message "still alive!". And the message will be printed at most 3 times.
-extern void cfg(absl::string_view name, absl::string_view action);
+extern void cfg(std::string_view name, std::string_view action);
extern void setup();
diff --git a/src/utils/fail_point_impl.h b/src/utils/fail_point_impl.h
index 75ad2ef39..449d8fd53 100644
--- a/src/utils/fail_point_impl.h
+++ b/src/utils/fail_point_impl.h
@@ -61,11 +61,11 @@ struct fail_point
Void,
};
- void set_action(absl::string_view action);
+ void set_action(std::string_view action);
const std::string *eval();
- explicit fail_point(absl::string_view name) : _name(name) {}
+ explicit fail_point(std::string_view name) : _name(name) {}
/// for test only
fail_point(task_type t, std::string arg, int freq, int max_cnt)
@@ -76,7 +76,7 @@ struct fail_point
/// for test only
fail_point() = default;
- bool parse_from_string(absl::string_view action);
+ bool parse_from_string(std::string_view action);
friend inline bool operator==(const fail_point &p1, const fail_point &p2)
{
@@ -103,7 +103,7 @@ USER_DEFINED_ENUM_FORMATTER(fail_point::task_type)
struct fail_point_registry
{
- fail_point &create_if_not_exists(absl::string_view name)
+ fail_point &create_if_not_exists(std::string_view name)
{
std::lock_guard<std::mutex> guard(_mu);
@@ -111,7 +111,7 @@ struct fail_point_registry
return it->second;
}
- fail_point *try_get(absl::string_view name)
+ fail_point *try_get(std::string_view name)
{
std::lock_guard<std::mutex> guard(_mu);
diff --git a/src/utils/filesystem.cpp b/src/utils/filesystem.cpp
index 1a7b3dd21..75ad72f5a 100644
--- a/src/utils/filesystem.cpp
+++ b/src/utils/filesystem.cpp
@@ -43,7 +43,7 @@
#include <unistd.h>
#include <memory>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "errors.h"
#include "utils/defer.h"
#include "utils/env.h"
@@ -648,9 +648,9 @@ error_code get_process_image_path(int pid, std::string &path)
bool get_disk_space_info(const std::string &path, disk_space_info &info)
{
- FAIL_POINT_INJECT_F("filesystem_get_disk_space_info", [&info](absl::string_view str) {
+ FAIL_POINT_INJECT_F("filesystem_get_disk_space_info", [&info](std::string_view str) {
info.capacity = 100 * 1024 * 1024;
- if (str.find("insufficient") != absl::string_view::npos) {
+ if (str.find("insufficient") != std::string_view::npos) {
info.available = 512 * 1024;
} else {
info.available = 50 * 1024 * 1024;
@@ -850,11 +850,11 @@ bool verify_file_size(const std::string &fname, FileDataType type, const int64_t
bool create_directory(const std::string &path, std::string &absolute_path, std::string &err_msg)
{
- FAIL_POINT_INJECT_F("filesystem_create_directory", [path](absl::string_view str) {
+ FAIL_POINT_INJECT_F("filesystem_create_directory", [path](std::string_view str) {
// when str contains 'false', and path contains broken_disk_dir, mock create fail(return
// false)
std::string broken_disk_dir = "disk1";
- return str.find("false") == absl::string_view::npos ||
+ return str.find("false") == std::string_view::npos ||
path.find(broken_disk_dir) == std::string::npos;
});
@@ -871,11 +871,11 @@ bool create_directory(const std::string &path, std::string &absolute_path, std::
bool check_dir_rw(const std::string &path, std::string &err_msg)
{
- FAIL_POINT_INJECT_F("filesystem_check_dir_rw", [path](absl::string_view str) {
+ FAIL_POINT_INJECT_F("filesystem_check_dir_rw", [path](std::string_view str) {
// when str contains 'false', and path contains broken_disk_dir, mock check fail(return
// false)
std::string broken_disk_dir = "disk1";
- return str.find("false") == absl::string_view::npos ||
+ return str.find("false") == std::string_view::npos ||
path.find(broken_disk_dir) == std::string::npos;
});
diff --git a/src/utils/latency_tracer.cpp b/src/utils/latency_tracer.cpp
index e8408dd93..f5c97f511 100644
--- a/src/utils/latency_tracer.cpp
+++ b/src/utils/latency_tracer.cpp
@@ -17,7 +17,7 @@
#include "utils/latency_tracer.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <fmt/core.h>
#include <cstdint>
#include <iterator>
diff --git a/src/utils/metrics.cpp b/src/utils/metrics.cpp
index 1677584be..89e3ff1f7 100644
--- a/src/utils/metrics.cpp
+++ b/src/utils/metrics.cpp
@@ -17,7 +17,7 @@
#include "utils/metrics.h"
-#include <absl/strings/string_view.h>
+#include <string_view>
#include <boost/algorithm/string/join.hpp>
#include <boost/asio/basic_deadline_timer.hpp>
#include <boost/date_time/posix_time/posix_time_duration.hpp>
diff --git a/src/utils/metrics.h b/src/utils/metrics.h
index 199d11d48..9d9b0671d 100644
--- a/src/utils/metrics.h
+++ b/src/utils/metrics.h
@@ -40,7 +40,7 @@
#include <utility>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common/json_helper.h"
#include "http/http_server.h"
#include "utils/alloc.h"
@@ -853,22 +853,22 @@ class metric_prototype
public:
struct ctor_args
{
- const absl::string_view entity_type;
+ const std::string_view entity_type;
const metric_type type;
- const absl::string_view name;
+ const std::string_view name;
const metric_unit unit;
- const absl::string_view desc;
+ const std::string_view desc;
};
- absl::string_view entity_type() const { return _args.entity_type; }
+ std::string_view entity_type() const { return _args.entity_type; }
metric_type type() const { return _args.type; }
- absl::string_view name() const { return _args.name; }
+ std::string_view name() const { return _args.name; }
metric_unit unit() const { return _args.unit; }
- absl::string_view description() const { return _args.desc; }
+ std::string_view description() const { return _args.desc; }
protected:
explicit metric_prototype(const ctor_args &args);
diff --git a/src/utils/simple_logger.cpp b/src/utils/simple_logger.cpp
index f67132408..881b97ecd 100644
--- a/src/utils/simple_logger.cpp
+++ b/src/utils/simple_logger.cpp
@@ -41,7 +41,7 @@
#include <utility>
#include <vector>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "runtime/api_layer1.h"
#include "utils/command_manager.h"
#include "utils/errors.h"
@@ -165,7 +165,7 @@ inline void process_fatal_log(log_level_t log_level)
}
bool coredump = true;
- FAIL_POINT_INJECT_NOT_RETURN_F("coredump_for_fatal_log", [&coredump](absl::string_view str) {
+ FAIL_POINT_INJECT_NOT_RETURN_F("coredump_for_fatal_log", [&coredump](std::string_view str) {
CHECK(buf2bool(str, coredump),
"invalid coredump toggle for fatal log, should be true or false: {}",
str);
diff --git a/src/utils/string_conv.h b/src/utils/string_conv.h
index a92b1e6bb..16b0793b2 100644
--- a/src/utils/string_conv.h
+++ b/src/utils/string_conv.h
@@ -27,14 +27,14 @@
#include <string>
#include <type_traits>
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace dsn {
namespace internal {
template <typename T>
-bool buf2signed(absl::string_view buf, T &result)
+bool buf2signed(std::string_view buf, T &result)
{
static_assert(std::is_signed<T>::value, "buf2signed works only with signed integer");
@@ -65,7 +65,7 @@ bool buf2signed(absl::string_view buf, T &result)
}
template <typename T>
-bool buf2unsigned(absl::string_view buf, T &result)
+bool buf2unsigned(std::string_view buf, T &result)
{
static_assert(std::is_unsigned<T>::value, "buf2unsigned works only with unsigned integer");
@@ -104,32 +104,32 @@ bool buf2unsigned(absl::string_view buf, T &result)
/// buf2*: `result` will keep unmodified if false is returned.
-inline bool buf2int32(absl::string_view buf, int32_t &result)
+inline bool buf2int32(std::string_view buf, int32_t &result)
{
return internal::buf2signed(buf, result);
}
-inline bool buf2int64(absl::string_view buf, int64_t &result)
+inline bool buf2int64(std::string_view buf, int64_t &result)
{
return internal::buf2signed(buf, result);
}
-inline bool buf2uint32(absl::string_view buf, uint32_t &result)
+inline bool buf2uint32(std::string_view buf, uint32_t &result)
{
return internal::buf2unsigned(buf, result);
}
-inline bool buf2uint64(absl::string_view buf, uint64_t &result)
+inline bool buf2uint64(std::string_view buf, uint64_t &result)
{
return internal::buf2unsigned(buf, result);
}
-inline bool buf2uint16(absl::string_view buf, uint16_t &result)
+inline bool buf2uint16(std::string_view buf, uint16_t &result)
{
return internal::buf2unsigned(buf, result);
}
-inline bool buf2bool(absl::string_view buf, bool &result, bool ignore_case = true)
+inline bool buf2bool(std::string_view buf, bool &result, bool ignore_case = true)
{
std::string data(buf.data(), buf.length());
if (ignore_case) {
@@ -146,7 +146,7 @@ inline bool buf2bool(absl::string_view buf, bool &result, bool ignore_case = tru
return false;
}
-inline bool buf2double(absl::string_view buf, double &result)
+inline bool buf2double(std::string_view buf, double &result)
{
if (buf.empty()) {
return false;
@@ -175,7 +175,7 @@ inline bool buf2double(absl::string_view buf, double &result)
}
#define DEF_BUF2NUMERIC_FUNC(type, postfix) \
- inline bool buf2numeric(absl::string_view buf, type &result) \
+ inline bool buf2numeric(std::string_view buf, type &result) \
{ \
return buf2##postfix(buf, result); \
}
diff --git a/src/utils/test/fail_point_test.cpp b/src/utils/test/fail_point_test.cpp
index 62b1c0c50..e04d39f54 100644
--- a/src/utils/test/fail_point_test.cpp
+++ b/src/utils/test/fail_point_test.cpp
@@ -33,7 +33,7 @@
#include "gtest/gtest.h"
#include "utils/fail_point.h"
#include "utils/fail_point_impl.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
namespace dsn {
namespace fail {
@@ -119,12 +119,12 @@ TEST(fail_point, parse)
int test_func()
{
- FAIL_POINT_INJECT_F("test_1", [](absl::string_view str) -> int {
+ FAIL_POINT_INJECT_F("test_1", [](std::string_view str) -> int {
EXPECT_EQ(str, "1");
return 1;
});
- FAIL_POINT_INJECT_F("test_2", [](absl::string_view str) -> int {
+ FAIL_POINT_INJECT_F("test_2", [](std::string_view str) -> int {
EXPECT_EQ(str, "2");
return 2;
});
@@ -148,7 +148,7 @@ TEST(fail_point, macro_use)
void test_func_return_void(int &a)
{
- FAIL_POINT_INJECT_F("test_1", [](absl::string_view str) {});
+ FAIL_POINT_INJECT_F("test_1", [](std::string_view str) {});
a++;
}
TEST(fail_point, return_void)
diff --git a/src/utils/test/fmt_logging_test.cpp b/src/utils/test/fmt_logging_test.cpp
index 20017ddec..c19126c7c 100644
--- a/src/utils/test/fmt_logging_test.cpp
+++ b/src/utils/test/fmt_logging_test.cpp
@@ -27,7 +27,7 @@
#include <fmt/core.h>
#include <memory>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "common/gpid.h"
#include "common/replication.codes.h"
#include "gtest/gtest.h"
@@ -46,8 +46,8 @@ TEST(fmt_logging, basic)
ASSERT_EQ(fmt::format("{}", error_s::make(ERR_TIMEOUT, "yes")), "ERR_TIMEOUT: yes");
ASSERT_EQ(fmt::format("{}", ERR_OK), "ERR_OK");
ASSERT_EQ(fmt::format("{}", LPC_REPLICATION_LOW), "LPC_REPLICATION_LOW");
- ASSERT_EQ(absl::string_view("yes"), "yes");
- ASSERT_EQ(fmt::format("{}", absl::string_view("yes\0yes")), "yes\0yes");
+ ASSERT_EQ(std::string_view("yes"), "yes");
+ ASSERT_EQ(fmt::format("{}", std::string_view("yes\0yes")), "yes\0yes");
ASSERT_DEATH(CHECK(false, "CHECK false in test"), "CHECK false in test");
}
diff --git a/src/utils/test/string_conv_test.cpp b/src/utils/test/string_conv_test.cpp
index c9fd5fc2d..5e564b0d2 100644
--- a/src/utils/test/string_conv_test.cpp
+++ b/src/utils/test/string_conv_test.cpp
@@ -27,7 +27,7 @@
#include "utils/string_conv.h"
#include "gtest/gtest.h"
-#include "absl/strings/string_view.h"
+#include <string_view>
TEST(string_conv, buf2bool)
{
@@ -50,13 +50,13 @@ TEST(string_conv, buf2bool)
ASSERT_FALSE(dsn::buf2bool("TrUe", result, false));
std::string str("true\0false", 10);
- ASSERT_FALSE(dsn::buf2bool(absl::string_view(str.data(), 3), result));
- ASSERT_TRUE(dsn::buf2bool(absl::string_view(str.data(), 4), result));
+ ASSERT_FALSE(dsn::buf2bool(std::string_view(str.data(), 3), result));
+ ASSERT_TRUE(dsn::buf2bool(std::string_view(str.data(), 4), result));
ASSERT_EQ(result, true);
- ASSERT_FALSE(dsn::buf2bool(absl::string_view(str.data(), 5), result));
- ASSERT_FALSE(dsn::buf2bool(absl::string_view(str.data(), 6), result));
- ASSERT_FALSE(dsn::buf2bool(absl::string_view(str.data() + 5, 4), result));
- ASSERT_TRUE(dsn::buf2bool(absl::string_view(str.data() + 5, 5), result));
+ ASSERT_FALSE(dsn::buf2bool(std::string_view(str.data(), 5), result));
+ ASSERT_FALSE(dsn::buf2bool(std::string_view(str.data(), 6), result));
+ ASSERT_FALSE(dsn::buf2bool(std::string_view(str.data() + 5, 4), result));
+ ASSERT_TRUE(dsn::buf2bool(std::string_view(str.data() + 5, 5), result));
ASSERT_EQ(result, false);
}
@@ -92,12 +92,12 @@ TEST(string_conv, buf2int32)
// "\045" is "%", so the string length=5, otherwise(2th argument > 5) it will be reported
// "global-buffer-overflow" error under AddressSanitizer check
std::string str("123\0456", 5);
- ASSERT_TRUE(dsn::buf2int32(absl::string_view(str.data(), 2), result));
+ ASSERT_TRUE(dsn::buf2int32(std::string_view(str.data(), 2), result));
ASSERT_EQ(result, 12);
- ASSERT_TRUE(dsn::buf2int32(absl::string_view(str.data(), 3), result));
+ ASSERT_TRUE(dsn::buf2int32(std::string_view(str.data(), 3), result));
ASSERT_EQ(result, 123);
- ASSERT_FALSE(dsn::buf2int32(absl::string_view(str.data(), 4), result));
- ASSERT_FALSE(dsn::buf2int32(absl::string_view(str.data(), 5), result));
+ ASSERT_FALSE(dsn::buf2int32(std::string_view(str.data(), 4), result));
+ ASSERT_FALSE(dsn::buf2int32(std::string_view(str.data(), 5), result));
}
TEST(string_conv, buf2int64)
@@ -139,12 +139,12 @@ TEST(string_conv, buf2int64)
// "\045" is "%", so the string length=5, otherwise(2th argument > 5) it will be reported
// "global-buffer-overflow" error under AddressSanitizer check
std::string str("123\0456", 5);
- ASSERT_TRUE(dsn::buf2int64(absl::string_view(str.data(), 2), result));
+ ASSERT_TRUE(dsn::buf2int64(std::string_view(str.data(), 2), result));
ASSERT_EQ(result, 12);
- ASSERT_TRUE(dsn::buf2int64(absl::string_view(str.data(), 3), result));
+ ASSERT_TRUE(dsn::buf2int64(std::string_view(str.data(), 3), result));
ASSERT_EQ(result, 123);
- ASSERT_FALSE(dsn::buf2int64(absl::string_view(str.data(), 4), result));
- ASSERT_FALSE(dsn::buf2int64(absl::string_view(str.data(), 5), result));
+ ASSERT_FALSE(dsn::buf2int64(std::string_view(str.data(), 4), result));
+ ASSERT_FALSE(dsn::buf2int64(std::string_view(str.data(), 5), result));
}
TEST(string_conv, buf2uint64)
@@ -183,12 +183,12 @@ TEST(string_conv, buf2uint64)
// "\045" is "%", so the string length=5, otherwise(2th argument > 5) it will be reported
// "global-buffer-overflow" error under AddressSanitizer check
std::string str("123\0456", 5);
- ASSERT_TRUE(dsn::buf2uint64(absl::string_view(str.data(), 2), result));
+ ASSERT_TRUE(dsn::buf2uint64(std::string_view(str.data(), 2), result));
ASSERT_EQ(result, 12);
- ASSERT_TRUE(dsn::buf2uint64(absl::string_view(str.data(), 3), result));
+ ASSERT_TRUE(dsn::buf2uint64(std::string_view(str.data(), 3), result));
ASSERT_EQ(result, 123);
- ASSERT_FALSE(dsn::buf2uint64(absl::string_view(str.data(), 4), result));
- ASSERT_FALSE(dsn::buf2uint64(absl::string_view(str.data(), 5), result));
+ ASSERT_FALSE(dsn::buf2uint64(std::string_view(str.data(), 4), result));
+ ASSERT_FALSE(dsn::buf2uint64(std::string_view(str.data(), 5), result));
}
TEST(string_conv, buf2uint32)
@@ -229,12 +229,12 @@ TEST(string_conv, buf2uint32)
// "\045" is "%", so the string length=5, otherwise(2th argument > 5) it will be reported
// "global-buffer-overflow" error under AddressSanitizer check
std::string str("123\0456", 5);
- ASSERT_TRUE(dsn::buf2uint32(absl::string_view(str.data(), 2), result));
+ ASSERT_TRUE(dsn::buf2uint32(std::string_view(str.data(), 2), result));
ASSERT_EQ(result, 12);
- ASSERT_TRUE(dsn::buf2uint32(absl::string_view(str.data(), 3), result));
+ ASSERT_TRUE(dsn::buf2uint32(std::string_view(str.data(), 3), result));
ASSERT_EQ(result, 123);
- ASSERT_FALSE(dsn::buf2uint32(absl::string_view(str.data(), 4), result));
- ASSERT_FALSE(dsn::buf2uint32(absl::string_view(str.data(), 5), result));
+ ASSERT_FALSE(dsn::buf2uint32(std::string_view(str.data(), 4), result));
+ ASSERT_FALSE(dsn::buf2uint32(std::string_view(str.data(), 5), result));
}
TEST(string_conv, int64_partial)
diff --git a/src/utils/time_utils.h b/src/utils/time_utils.h
index 546bea0ef..d36aa9864 100644
--- a/src/utils/time_utils.h
+++ b/src/utils/time_utils.h
@@ -33,7 +33,7 @@
#include <cstdio>
#include <string>
-#include "absl/strings/string_view.h"
+#include <string_view>
#include "runtime/api_layer1.h"
#include "utils/fmt_logging.h"
#include "utils/ports.h"
@@ -115,7 +115,7 @@ inline int64_t get_unix_sec_today_midnight()
// `hh:mm` (range in [00:00, 23:59]) to seconds since 00:00:00
// eg. `01:00` => `3600`
// Return: -1 when invalid
-inline int hh_mm_to_seconds(absl::string_view hhmm)
+inline int hh_mm_to_seconds(std::string_view hhmm)
{
int hour = 0, min = 0, sec = -1;
if (::sscanf(hhmm.data(), "%d:%d", &hour, &min) == 2 && (0 <= hour && hour <= 23) &&
@@ -128,7 +128,7 @@ inline int hh_mm_to_seconds(absl::string_view hhmm)
// local time `hh:mm` to unix timestamp.
// eg. `18:10` => `1525947000` when called on May 10, 2018, CST
// Return: -1 when invalid
-inline int64_t hh_mm_today_to_unix_sec(absl::string_view hhmm_of_day)
+inline int64_t hh_mm_today_to_unix_sec(std::string_view hhmm_of_day)
{
int sec_of_day = hh_mm_to_seconds(hhmm_of_day);
if (sec_of_day == -1) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pegasus.apache.org
For additional commands, e-mail: commits-help@pegasus.apache.org