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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/bazel/repository_locations.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ REPOSITORY_LOCATIONS = dict(
urls = ["https://github.com/envoyproxy/protoc-gen-validate/archive/" + PGV_GIT_SHA + ".tar.gz"],
),
com_google_googleapis = dict(
# TODO(dio): Consider writing a Skylark macro for importing Google API proto.
# TODO(dio): Consider writing a Starlark macro for importing Google API proto.
sha256 = GOOGLEAPIS_SHA,
strip_prefix = "googleapis-" + GOOGLEAPIS_GIT_SHA,
urls = ["https://github.com/googleapis/googleapis/archive/" + GOOGLEAPIS_GIT_SHA + ".tar.gz"],
Expand Down
2 changes: 1 addition & 1 deletion bazel/envoy_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def tcmalloc_external_deps(repository):

# Envoy C++ library targets that need no transformations or additional dependencies before being
# passed to cc_library should be specified with this function. Note: this exists to ensure that
# all envoy targets pass through an envoy-declared skylark function where they can be modified
# all envoy targets pass through an envoy-declared starlark function where they can be modified
# before being passed to a native bazel function.
def envoy_basic_cc_library(name, deps = [], external_deps = [], **kargs):
cc_library(
Expand Down
2 changes: 1 addition & 1 deletion bazel/genrule_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def _genrule_cc_deps(ctx):
genrule_cc_deps = rule(
attrs = {
"deps": attr.label_list(
providers = [], # CcSkylarkApiProvider
providers = [], # CcStarlarkApiProvider
mandatory = True,
allow_empty = False,
),
Expand Down
2 changes: 1 addition & 1 deletion generated_api_shadow/bazel/repository_locations.bzl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions include/envoy/network/filter.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ class DrainableFilterChain : public FilterChain {
virtual void startDraining() PURE;
};

using DrainableFilterChainSharedPtr = std::shared_ptr<DrainableFilterChain>;

/**
* Interface for searching through configured filter chains.
*/
Expand Down
4 changes: 3 additions & 1 deletion include/envoy/runtime/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ class Snapshot {
virtual const std::vector<OverrideLayerConstPtr>& getLayers() const PURE;
};

using SnapshotConstSharedPtr = std::shared_ptr<const Snapshot>;

/**
* Loads runtime snapshots from storage (local disk, etc.).
*/
Expand Down Expand Up @@ -285,7 +287,7 @@ class Loader {
* @return shared_ptr<const Snapshot> the current snapshot. This function may safely be called
* from non-worker threads.
*/
virtual std::shared_ptr<const Snapshot> threadsafeSnapshot() PURE;
virtual SnapshotConstSharedPtr threadsafeSnapshot() PURE;

/**
* Merge the given map of key-value pairs into the runtime's state. To remove a previous merge for
Expand Down
1 change: 1 addition & 0 deletions include/envoy/server/factory_context.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <functional>
#include <memory>

#include "envoy/access_log/access_log.h"
#include "envoy/config/core/v3/base.pb.h"
Expand Down
8 changes: 5 additions & 3 deletions include/envoy/stream_info/filter_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
namespace Envoy {
namespace StreamInfo {

class FilterState;

using FilterStateSharedPtr = std::shared_ptr<FilterState>;

/**
* FilterState represents dynamically generated information regarding a stream (TCP or HTTP level)
* or a connection by various filters in Envoy. FilterState can be write-once or write-many.
Expand Down Expand Up @@ -146,14 +150,12 @@ class FilterState {
* @return the pointer of the parent FilterState that has longer life span. nullptr means this is
* either the top LifeSpan or the parent is not yet created.
*/
virtual std::shared_ptr<FilterState> parent() const PURE;
virtual FilterStateSharedPtr parent() const PURE;

protected:
virtual const Object* getDataReadOnlyGeneric(absl::string_view data_name) const PURE;
virtual Object* getDataMutableGeneric(absl::string_view data_name) PURE;
};

using FilterStateSharedPtr = std::shared_ptr<FilterState>;

} // namespace StreamInfo
} // namespace Envoy
11 changes: 7 additions & 4 deletions source/common/grpc/google_async_client_impl.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <memory>
#include <queue>

#include "envoy/api/api.h"
Expand Down Expand Up @@ -128,6 +129,8 @@ class GoogleStub {
grpc::CompletionQueue* cq) PURE;
};

using GoogleStubSharedPtr = std::shared_ptr<GoogleStub>;

class GoogleGenericStub : public GoogleStub {
public:
GoogleGenericStub(std::shared_ptr<grpc::Channel> channel) : stub_(channel) {}
Expand All @@ -148,12 +151,12 @@ class GoogleStubFactory {
virtual ~GoogleStubFactory() = default;

// Create a stub from a given channel.
virtual std::shared_ptr<GoogleStub> createStub(std::shared_ptr<grpc::Channel> channel) PURE;
virtual GoogleStubSharedPtr createStub(std::shared_ptr<grpc::Channel> channel) PURE;
};

class GoogleGenericStubFactory : public GoogleStubFactory {
public:
std::shared_ptr<GoogleStub> createStub(std::shared_ptr<grpc::Channel> channel) override {
GoogleStubSharedPtr createStub(std::shared_ptr<grpc::Channel> channel) override {
return std::make_shared<GoogleGenericStub>(channel);
}
};
Expand Down Expand Up @@ -185,7 +188,7 @@ class GoogleAsyncClientImpl final : public RawAsyncClient, Logger::Loggable<Logg
// This is shared with child streams, so that they can cleanup independent of
// the client if it gets destructed. The streams need to wait for their tags
// to drain from the CQ.
std::shared_ptr<GoogleStub> stub_;
GoogleStubSharedPtr stub_;
std::list<std::unique_ptr<GoogleAsyncStreamImpl>> active_streams_;
const std::string stat_prefix_;
const Protobuf::RepeatedPtrField<envoy::config::core::v3::HeaderValue> initial_metadata_;
Expand Down Expand Up @@ -272,7 +275,7 @@ class GoogleAsyncStreamImpl : public RawAsyncStream,
Event::Dispatcher& dispatcher_;
// We hold a ref count on the stub_ to allow the stream to wait for its tags
// to drain from the CQ on cleanup.
std::shared_ptr<GoogleStub> stub_;
GoogleStubSharedPtr stub_;
std::string service_full_name_;
std::string method_name_;
RawAsyncStreamCallbacks& callbacks_;
Expand Down
5 changes: 2 additions & 3 deletions source/common/router/scoped_config_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ ScopeKeyBuilderImpl::ScopeKeyBuilderImpl(ScopedRoutes::ScopeKeyBuilder&& config)
}
}

std::unique_ptr<ScopeKey>
ScopeKeyBuilderImpl::computeScopeKey(const Http::HeaderMap& headers) const {
ScopeKeyPtr ScopeKeyBuilderImpl::computeScopeKey(const Http::HeaderMap& headers) const {
ScopeKey key;
for (const auto& builder : fragment_builders_) {
// returns nullopt if a null fragment is found.
Expand Down Expand Up @@ -139,7 +138,7 @@ void ScopedConfigImpl::removeRoutingScope(const std::string& scope_name) {

Router::ConfigConstSharedPtr
ScopedConfigImpl::getRouteConfig(const Http::HeaderMap& headers) const {
std::unique_ptr<ScopeKey> scope_key = scope_key_builder_.computeScopeKey(headers);
ScopeKeyPtr scope_key = scope_key_builder_.computeScopeKey(headers);
if (scope_key == nullptr) {
return nullptr;
}
Expand Down
7 changes: 5 additions & 2 deletions source/common/router/scoped_config_impl.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#pragma once

#include <memory>
#include <typeinfo>

#include "envoy/config/route/v3/scoped_route.pb.h"
Expand Down Expand Up @@ -77,6 +78,8 @@ class ScopeKey {
std::vector<std::unique_ptr<ScopeKeyFragmentBase>> fragments_;
};

using ScopeKeyPtr = std::unique_ptr<ScopeKey>;

// String fragment.
class StringKeyFragment : public ScopeKeyFragmentBase {
public:
Expand Down Expand Up @@ -130,7 +133,7 @@ class ScopeKeyBuilderBase {
virtual ~ScopeKeyBuilderBase() = default;

// Computes scope key for given headers, returns nullptr if a key can't be computed.
virtual std::unique_ptr<ScopeKey> computeScopeKey(const Http::HeaderMap& headers) const PURE;
virtual ScopeKeyPtr computeScopeKey(const Http::HeaderMap& headers) const PURE;

protected:
const ScopedRoutes::ScopeKeyBuilder config_;
Expand All @@ -140,7 +143,7 @@ class ScopeKeyBuilderImpl : public ScopeKeyBuilderBase {
public:
explicit ScopeKeyBuilderImpl(ScopedRoutes::ScopeKeyBuilder&& config);

std::unique_ptr<ScopeKey> computeScopeKey(const Http::HeaderMap& headers) const override;
ScopeKeyPtr computeScopeKey(const Http::HeaderMap& headers) const override;

private:
std::vector<std::unique_ptr<FragmentBuilderBase>> fragment_builders_;
Expand Down
4 changes: 2 additions & 2 deletions source/common/runtime/runtime_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ const Snapshot& LoaderImpl::snapshot() {
return tls_->getTyped<Snapshot>();
}

std::shared_ptr<const Snapshot> LoaderImpl::threadsafeSnapshot() {
SnapshotConstSharedPtr LoaderImpl::threadsafeSnapshot() {
if (tls_->currentThreadRegistered()) {
return std::dynamic_pointer_cast<const Snapshot>(tls_->get());
}
Expand All @@ -630,7 +630,7 @@ RuntimeStats LoaderImpl::generateStats(Stats::Store& store) {
return stats;
}

std::unique_ptr<SnapshotImpl> LoaderImpl::createNewSnapshot() {
SnapshotImplPtr LoaderImpl::createNewSnapshot() {
std::vector<Snapshot::OverrideLayerConstPtr> layers;
uint32_t disk_layers = 0;
uint32_t error_layers = 0;
Expand Down
8 changes: 5 additions & 3 deletions source/common/runtime/runtime_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ class SnapshotImpl : public Snapshot,
RuntimeStats& stats_;
};

using SnapshotImplPtr = std::unique_ptr<SnapshotImpl>;

/**
* Base implementation of OverrideLayer that by itself provides an empty values map.
*/
Expand Down Expand Up @@ -252,15 +254,15 @@ class LoaderImpl : public Loader, Logger::Loggable<Logger::Id::runtime> {
// Runtime::Loader
void initialize(Upstream::ClusterManager& cm) override;
const Snapshot& snapshot() override;
std::shared_ptr<const Snapshot> threadsafeSnapshot() override;
SnapshotConstSharedPtr threadsafeSnapshot() override;
void mergeValues(const std::unordered_map<std::string, std::string>& values) override;
void startRtdsSubscriptions(ReadyCallback on_done) override;

private:
friend RtdsSubscription;

// Create a new Snapshot
virtual std::unique_ptr<SnapshotImpl> createNewSnapshot();
virtual SnapshotImplPtr createNewSnapshot();
// Load a new Snapshot into TLS
void loadNewSnapshot();
RuntimeStats generateStats(Stats::Store& store);
Expand All @@ -281,7 +283,7 @@ class LoaderImpl : public Loader, Logger::Loggable<Logger::Id::runtime> {
Upstream::ClusterManager* cm_{};

absl::Mutex snapshot_mutex_;
std::shared_ptr<const Snapshot> thread_safe_snapshot_ ABSL_GUARDED_BY(snapshot_mutex_);
SnapshotConstSharedPtr thread_safe_snapshot_ ABSL_GUARDED_BY(snapshot_mutex_);
};

} // namespace Runtime
Expand Down
4 changes: 2 additions & 2 deletions source/common/stream_info/filter_state_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ void FilterStateImpl::maybeCreateParent(ParentAccessMode parent_access_mode) {
if (life_span_ >= FilterState::LifeSpan::TopSpan) {
return;
}
if (absl::holds_alternative<std::shared_ptr<FilterState>>(ancestor_)) {
std::shared_ptr<FilterState> ancestor = absl::get<std::shared_ptr<FilterState>>(ancestor_);
if (absl::holds_alternative<FilterStateSharedPtr>(ancestor_)) {
FilterStateSharedPtr ancestor = absl::get<FilterStateSharedPtr>(ancestor_);
if (ancestor == nullptr || ancestor->lifeSpan() != life_span_ + 1) {
parent_ = std::make_shared<FilterStateImpl>(ancestor, FilterState::LifeSpan(life_span_ + 1));
} else {
Expand Down
10 changes: 5 additions & 5 deletions source/common/stream_info/filter_state_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ class FilterStateImpl : public FilterState {
* @param ancestor a std::shared_ptr storing an already created ancestor.
* @param life_span the life span this is handling.
*/
FilterStateImpl(std::shared_ptr<FilterState> ancestor, FilterState::LifeSpan life_span)
FilterStateImpl(FilterStateSharedPtr ancestor, FilterState::LifeSpan life_span)
: ancestor_(ancestor), life_span_(life_span) {
maybeCreateParent(ParentAccessMode::ReadOnly);
}

using LazyCreateAncestor = std::pair<std::shared_ptr<FilterState>&, FilterState::LifeSpan>;
using LazyCreateAncestor = std::pair<FilterStateSharedPtr&, FilterState::LifeSpan>;
/**
* @param ancestor a std::pair storing an ancestor, that can be passed in as a way to lazy
* initialize a FilterState that's owned by an object with bigger scope than this. This is to
Expand All @@ -49,7 +49,7 @@ class FilterStateImpl : public FilterState {
bool hasDataAtOrAboveLifeSpan(FilterState::LifeSpan life_span) const override;

FilterState::LifeSpan lifeSpan() const override { return life_span_; }
std::shared_ptr<FilterState> parent() const override { return parent_; }
FilterStateSharedPtr parent() const override { return parent_; }

private:
// This only checks the local data_storage_ for data_name existence.
Expand All @@ -62,8 +62,8 @@ class FilterStateImpl : public FilterState {
FilterState::StateType state_type_;
};

absl::variant<std::shared_ptr<FilterState>, LazyCreateAncestor> ancestor_;
std::shared_ptr<FilterState> parent_;
absl::variant<FilterStateSharedPtr, LazyCreateAncestor> ancestor_;
FilterStateSharedPtr parent_;
const FilterState::LifeSpan life_span_;
absl::flat_hash_map<std::string, std::unique_ptr<FilterObject>> data_storage_;
};
Expand Down
2 changes: 1 addition & 1 deletion source/common/stream_info/stream_info_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct StreamInfoImpl : public StreamInfo {
std::make_shared<FilterStateImpl>(FilterState::LifeSpan::FilterChain)) {}

StreamInfoImpl(Http::Protocol protocol, TimeSource& time_source,
std::shared_ptr<FilterState>& parent_filter_state)
FilterStateSharedPtr& parent_filter_state)
: StreamInfoImpl(protocol, time_source,
std::make_shared<FilterStateImpl>(
FilterStateImpl::LazyCreateAncestor(parent_filter_state,
Expand Down
1 change: 1 addition & 0 deletions source/extensions/common/wasm/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ envoy_cc_library(
hdrs = ["wasm_vm.h"],
deps = [
":well_known_names",
"//include/envoy/stats:stats_interface",
"//source/common/common:minimal_logger_lib",
],
)
Expand Down
2 changes: 1 addition & 1 deletion source/extensions/common/wasm/null/null_vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct NullVm : public WasmVmBase {
#undef _REGISTER_CALLBACK

std::string plugin_name_;
std::unique_ptr<NullVmPlugin> plugin_;
NullVmPluginPtr plugin_;
};

} // namespace Null
Expand Down
6 changes: 5 additions & 1 deletion source/extensions/common/wasm/null/null_vm_plugin.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#pragma once

#include <memory>

#include "envoy/config/typed_config.h"

#include "extensions/common/wasm/wasm_vm.h"
Expand All @@ -24,6 +26,8 @@ class NullVmPlugin {
#undef _DEFIN_GET_FUNCTIONE
};

using NullVmPluginPtr = std::unique_ptr<NullVmPlugin>;

/**
* Pseudo-WASM plugins using the NullVM should implement this factory and register via
* Registry::registerFactory or the convenience class RegisterFactory.
Expand All @@ -37,7 +41,7 @@ class NullVmPluginFactory : public Config::UntypedFactory {
/**
* Create an instance of the plugin.
*/
virtual std::unique_ptr<NullVmPlugin> create() const PURE;
virtual NullVmPluginPtr create() const PURE;
};

} // namespace Null
Expand Down
2 changes: 1 addition & 1 deletion source/server/filter_chain_factory_context_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FilterChainFactoryContextCreator {
* Generate the filter chain factory context from proto. Note the caller does not own the filter
* chain context.
*/
virtual std::unique_ptr<Configuration::FilterChainFactoryContext> createFilterChainFactoryContext(
virtual Configuration::FilterChainFactoryContextPtr createFilterChainFactoryContext(
const ::envoy::config::listener::v3::FilterChain* const filter_chain) PURE;
};

Expand Down
5 changes: 2 additions & 3 deletions source/server/filter_chain_manager_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ void FilterChainManagerImpl::convertIPsToTries() {
}
}

std::shared_ptr<Network::DrainableFilterChain> FilterChainManagerImpl::findExistingFilterChain(
Network::DrainableFilterChainSharedPtr FilterChainManagerImpl::findExistingFilterChain(
const envoy::config::listener::v3::FilterChain& filter_chain_message) {
// Origin filter chain manager could be empty if the current is the ancestor.
const auto* origin = getOriginFilterChainManager();
Expand All @@ -609,8 +609,7 @@ std::shared_ptr<Network::DrainableFilterChain> FilterChainManagerImpl::findExist
return nullptr;
}

std::unique_ptr<Configuration::FilterChainFactoryContext>
FilterChainManagerImpl::createFilterChainFactoryContext(
Configuration::FilterChainFactoryContextPtr FilterChainManagerImpl::createFilterChainFactoryContext(
const ::envoy::config::listener::v3::FilterChain* const filter_chain) {
// TODO(lambdai): add stats
UNREFERENCED_PARAMETER(filter_chain);
Expand Down
Loading