Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* `using BarSharedPtr = std::shared_ptr<Bar>;`
* `using BlahConstSharedPtr = std::shared_ptr<const Blah>;`
* Regular pointers (e.g. `int* foo`) should not be type aliased.
* `absl::optional<std::reference_wrapper<T>>` has a helper class in `envoy/common/optref.h`, and is type aliased:
* `std::optional<std::reference_wrapper<T>>` has a helper class in `envoy/common/optref.h`, and is type aliased:
* `using FooOptRef = OptRef<T>;`
* `using FooOptConstRef = OptRef<const T>;`
* If move semantics are intended, prefer specifying function arguments with `&&`.
Expand Down
1 change: 0 additions & 1 deletion contrib/config/source/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ envoy_cc_contrib_extension(
"//envoy/stats:stats_macros",
"//source/common/config:utility_lib",
"//source/common/protobuf:utility_lib",
"@abseil-cpp//absl/types:optional",
"@envoy_api//contrib/envoy/extensions/config/v3alpha:pkg_cc_proto",
"@envoy_api//envoy/service/discovery/v3:pkg_cc_proto",
],
Expand Down
1 change: 0 additions & 1 deletion contrib/golang/filters/http/source/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ envoy_cc_library(
"//source/extensions/filters/common/expr:cel_state_lib",
"//source/extensions/filters/common/expr:evaluator_lib",
"@abseil-cpp//absl/container:flat_hash_map",
"@abseil-cpp//absl/types:optional",
"@cel-cpp//eval/public:activation",
"@cel-cpp//eval/public:builtin_func_registrar",
"@cel-cpp//eval/public:cel_expr_builder_factory",
Expand Down
2 changes: 0 additions & 2 deletions contrib/istio/filters/common/source/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ envoy_cc_library(
"//envoy/stream_info:filter_state_interface",
"//source/common/common:hash_lib",
"//source/common/router:string_accessor_lib",
"@abseil-cpp//absl/types:optional",
],
)

Expand All @@ -36,7 +35,6 @@ envoy_cc_library(
"//source/common/protobuf",
"//source/common/protobuf:utility_lib",
"@abseil-cpp//absl/strings",
"@abseil-cpp//absl/types:optional",
"@envoy_api//envoy/config/core/v3:pkg_cc_proto",
],
)
Expand Down
1 change: 0 additions & 1 deletion contrib/kafka/filters/network/source/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,5 @@ envoy_cc_library(
],
deps = [
"//source/common/common:macros",
"@abseil-cpp//absl/types:optional",
],
)
1 change: 0 additions & 1 deletion contrib/rocketmq_proxy/filters/network/source/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,5 @@ envoy_cc_library(
hdrs = ["metadata.h"],
deps = [
"//source/common/http:header_map_lib",
"@abseil-cpp//absl/types:optional",
],
)
2 changes: 0 additions & 2 deletions contrib/sip_proxy/filters/network/source/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ envoy_cc_library(
"//envoy/buffer:buffer_interface",
"//source/common/common:macros",
"//source/common/http:header_map_lib",
"@abseil-cpp//absl/types:optional",
"@envoy_api//contrib/envoy/extensions/filters/network/sip_proxy/v3alpha:pkg_cc_proto",
],
)
Expand Down Expand Up @@ -149,7 +148,6 @@ envoy_cc_library(
"//source/common/config:utility_lib",
"//source/common/protobuf",
"//source/common/singleton:const_singleton",
"@abseil-cpp//absl/types:optional",
"@envoy_api//contrib/envoy/extensions/filters/network/sip_proxy/tra/v3alpha:pkg_cc_proto",
"@envoy_api//contrib/envoy/extensions/filters/network/sip_proxy/v3alpha:pkg_cc_proto",
],
Expand Down
2 changes: 1 addition & 1 deletion contrib/sip_proxy/filters/network/source/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class AffinityEntry {

/**
* MessageMetadata encapsulates metadata about Sip messages. The various fields are considered
* optional. Unless otherwise noted, accessor methods throw absl::bad_optional_access if the
* optional. Unless otherwise noted, accessor methods throw std::bad_optional_access if the
* corresponding value has not been set.
*/
class MessageMetadata : public Logger::Loggable<Logger::Id::filter> {
Expand Down
1 change: 0 additions & 1 deletion contrib/sip_proxy/filters/network/source/router/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ envoy_cc_library(
deps = [
"//contrib/sip_proxy/filters/network/source:metadata_lib",
"//envoy/router:router_interface",
"@abseil-cpp//absl/types:optional",
],
)

Expand Down
1 change: 0 additions & 1 deletion contrib/sip_proxy/filters/network/source/tra/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ envoy_cc_library(
"//envoy/tracing:tracer_interface",
"//source/common/stats:symbol_table_lib",
"@abseil-cpp//absl/types:any",
"@abseil-cpp//absl/types:optional",
],
)
1 change: 0 additions & 1 deletion envoy/api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,5 @@ envoy_cc_library(
],
deps = [
"//envoy/network:address_interface",
"@abseil-cpp//absl/types:optional",
],
)
5 changes: 2 additions & 3 deletions envoy/buffer/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <cstdint>
#include <functional>
#include <memory>
#include <optional>
#include <string>

#include "envoy/api/os_sys_calls.h"
Expand All @@ -18,7 +19,6 @@
#include "absl/container/inlined_vector.h"
#include "absl/functional/any_invocable.h"
#include "absl/strings/string_view.h"
#include "absl/types/optional.h"
#include "absl/types/span.h"

namespace Envoy {
Expand Down Expand Up @@ -234,8 +234,7 @@ class Instance {
* @param max_slices supplies an optional limit on the number of slices to fetch, for performance.
* @return RawSliceVector with non-empty slices in the buffer.
*/
virtual RawSliceVector
getRawSlices(absl::optional<uint64_t> max_slices = absl::nullopt) const PURE;
virtual RawSliceVector getRawSlices(std::optional<uint64_t> max_slices = std::nullopt) const PURE;

/**
* Fetch the valid data pointer and valid data length of the first non-zero-length
Expand Down
1 change: 0 additions & 1 deletion envoy/common/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ envoy_basic_cc_library(
hdrs = [
"optref.h",
],
deps = ["@abseil-cpp//absl/types:optional"],
)

envoy_cc_library(
Expand Down
7 changes: 3 additions & 4 deletions envoy/common/hashable.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#pragma once

#include <cstdint>
#include <optional>

#include "envoy/common/pure.h"

#include "absl/types/optional.h"

namespace Envoy {

/**
Expand All @@ -18,10 +17,10 @@ class Hashable {

/**
* Request the 64-bit hash for this object.
* @return absl::optional<uint64_t> the hash value, or absl::nullopt if a hash could not be
* @return std::optional<uint64_t> the hash value, or std::nullopt if a hash could not be
* produced for this instance.
*/
virtual absl::optional<uint64_t> hash() const PURE;
virtual std::optional<uint64_t> hash() const PURE;
};

} // namespace Envoy
6 changes: 3 additions & 3 deletions envoy/common/io/io_uring.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,13 +436,13 @@ class IoUringSocket {
/**
* Return the data get from the read request.
* @return Only return valid ReadParam when the callback is invoked with
* `Event::FileReadyType::Read`, otherwise `absl::nullopt` returned.
* `Event::FileReadyType::Read`, otherwise `std::nullopt` returned.
*/
virtual const OptRef<ReadParam>& getReadParam() const PURE;
/**
* Return the data get from the write request.
* @return Only return valid WriteParam when the callback is invoked with
* `Event::FileReadyType::Write`, otherwise `absl::nullopt` returned.
* `Event::FileReadyType::Write`, otherwise `std::nullopt` returned.
*/
virtual const OptRef<WriteParam>& getWriteParam() const PURE;

Expand Down Expand Up @@ -533,7 +533,7 @@ class IoUringWorkerFactory {

/**
* Returns the current thread's IoUringWorker. If the thread have not registered a IoUringWorker,
* an absl::nullopt will be returned.
* an std::nullopt will be returned.
*/
virtual OptRef<IoUringWorker> getIoUringWorker() PURE;

Expand Down
8 changes: 4 additions & 4 deletions envoy/common/key_value_store.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <chrono>
#include <optional>

#include "envoy/common/pure.h"
#include "envoy/config/typed_config.h"
Expand All @@ -9,7 +10,6 @@
#include "envoy/protobuf/message_validator.h"

#include "absl/strings/string_view.h"
#include "absl/types/optional.h"

namespace Envoy {

Expand All @@ -27,7 +27,7 @@ class KeyValueStore {
* ttl must be greater than 0.
*/
virtual void addOrUpdate(absl::string_view key, absl::string_view value,
absl::optional<std::chrono::seconds> ttl) PURE;
std::optional<std::chrono::seconds> ttl) PURE;

/**
* Removes a key:value pair from the store. This is a no-op if the key is not present.
Expand All @@ -38,9 +38,9 @@ class KeyValueStore {
/**
* Returns the value of the key provided.
* @param key supplies a key to return the value of.
* @return the value, if the key is in the store, absl::nullopt otherwise.
* @return the value, if the key is in the store, std::nullopt otherwise.
*/
virtual absl::optional<absl::string_view> get(absl::string_view key) PURE;
virtual std::optional<absl::string_view> get(absl::string_view key) PURE;

/**
* Flushes the store to long term storage.
Expand Down
24 changes: 12 additions & 12 deletions envoy/common/optref.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include "absl/types/optional.h" // required for absl::nullopt
#include <optional> // required for std::nullopt

namespace Envoy {

Expand All @@ -11,15 +11,15 @@ namespace Envoy {
// }
// }
//
// Using absl::optional directly you must write optref.value().method() which is
// Using std::optional directly you must write optref.value().method() which is
// a bit more awkward.
//
// This class also consumes less memory -- e.g. 8 bytes for a pointer rather
// than 16 bytes for a pointer plus a bool with alignment padding.
template <class T> struct OptRef {
OptRef(T& t) : ptr_(&t) {}
OptRef() : ptr_(nullptr) {}
OptRef(absl::nullopt_t) : ptr_(nullptr) {}
OptRef(std::nullopt_t) : ptr_(nullptr) {}

/**
* Copy constructor that allows conversion.
Expand All @@ -42,7 +42,7 @@ template <class T> struct OptRef {
* @return a ref to the converted object.
*/
template <class U> operator OptRef<U>() {
return ptr_ == nullptr ? absl::nullopt : OptRef<U>(*ptr_);
return ptr_ == nullptr ? std::nullopt : OptRef<U>(*ptr_);
}

/**
Expand Down Expand Up @@ -88,8 +88,8 @@ template <class T> struct OptRef {
*
* @return an optional copy of the referenced object (or nullopt).
*/
absl::optional<T> copy() const {
absl::optional<T> ret;
std::optional<T> copy() const {
std::optional<T> ret;
if (has_value()) {
ret = *ptr_;
}
Expand Down Expand Up @@ -136,7 +136,7 @@ template <class T> OptRef<T> makeOptRef(T& ref) { return {ref}; }
/**
* Constructs an OptRef<T> from the provided pointer.
* @param ptr the pointer to wrap
* @return OptRef<T> the wrapped pointer, or absl::nullopt if the pointer is nullptr
* @return OptRef<T> the wrapped pointer, or std::nullopt if the pointer is nullptr
*/
template <class T> OptRef<T> makeOptRefFromPtr(T* ptr) {
if (ptr == nullptr) {
Expand All @@ -146,17 +146,17 @@ template <class T> OptRef<T> makeOptRefFromPtr(T* ptr) {
return {*ptr};
}

// Overloads for comparing OptRef against absl::nullopt.
template <class T> bool operator!=(const OptRef<T>& optref, absl::nullopt_t) {
// Overloads for comparing OptRef against std::nullopt.
template <class T> bool operator!=(const OptRef<T>& optref, std::nullopt_t) {
return optref.has_value();
}
template <class T> bool operator!=(absl::nullopt_t, const OptRef<T>& optref) {
template <class T> bool operator!=(std::nullopt_t, const OptRef<T>& optref) {
return optref.has_value();
}
template <class T> bool operator==(const OptRef<T>& optref, absl::nullopt_t) {
template <class T> bool operator==(const OptRef<T>& optref, std::nullopt_t) {
return !optref.has_value();
}
template <class T> bool operator==(absl::nullopt_t, const OptRef<T>& optref) {
template <class T> bool operator==(std::nullopt_t, const OptRef<T>& optref) {
return !optref.has_value();
}

Expand Down
5 changes: 2 additions & 3 deletions envoy/common/resource.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#pragma once

#include <cstdint>
#include <optional>

#include "envoy/common/pure.h"

#include "absl/types/optional.h"

#pragma once

namespace Envoy {
Expand Down Expand Up @@ -48,6 +47,6 @@ class ResourceLimit {
virtual uint64_t count() const PURE;
};

using ResourceLimitOptRef = absl::optional<std::reference_wrapper<ResourceLimit>>;
using ResourceLimitOptRef = std::optional<std::reference_wrapper<ResourceLimit>>;

} // namespace Envoy
2 changes: 0 additions & 2 deletions envoy/config/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ envoy_cc_library(
"//envoy/common:time_interface",
"//source/common/common:assert_lib",
"//source/common/protobuf",
"@abseil-cpp//absl/types:optional",
],
)

Expand Down Expand Up @@ -132,7 +131,6 @@ envoy_cc_library(
":typed_config_interface",
"//envoy/api:api_interface",
"//envoy/protobuf:message_validator_interface",
"@abseil-cpp//absl/types:optional",
"@envoy_api//envoy/service/discovery/v3:pkg_cc_proto",
],
)
Expand Down
9 changes: 4 additions & 5 deletions envoy/config/config_provider.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#pragma once

#include <memory>
#include <optional>

#include "envoy/common/time.h"

#include "source/common/common/assert.h"
#include "source/common/protobuf/protobuf.h"

#include "absl/types/optional.h"

namespace Envoy {
namespace Config {

Expand Down Expand Up @@ -75,16 +74,16 @@ class ConfigProvider {

/**
* Returns a ConfigProtoInfoVector associated with a ApiType::Delta provider.
* @return absl::optional<ConfigProtoInfoVector> an optional ConfigProtoInfoVector; the value is
* @return std::optional<ConfigProtoInfoVector> an optional ConfigProtoInfoVector; the value is
* set when a config is available.
*/
template <typename P> absl::optional<ConfigProtoInfoVector<P>> configProtoInfoVector() const {
template <typename P> std::optional<ConfigProtoInfoVector<P>> configProtoInfoVector() const {
static_assert(std::is_base_of<Protobuf::Message, P>::value,
"Proto type must derive from Protobuf::Message");

const ConfigProtoVector config_protos = getConfigProtos();
if (config_protos.empty()) {
return absl::nullopt;
return std::nullopt;
}
std::vector<const P*> ret_protos;
ret_protos.reserve(config_protos.size());
Expand Down
4 changes: 2 additions & 2 deletions envoy/config/dynamic_extension_config_provider.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#pragma once

#include <optional>

#include "envoy/common/optref.h"
#include "envoy/common/pure.h"
#include "envoy/config/extension_config_provider.h"
#include "envoy/network/filter.h"

#include "source/common/protobuf/protobuf.h"

#include "absl/types/optional.h"

namespace Envoy {
namespace Config {

Expand Down
Loading
Loading