Skip to content

Commit

Permalink
Xds mux unification: introduced unifed mux implementation (envoyproxy…
Browse files Browse the repository at this point in the history
…#17352)

PR #2 out of 3. Introduces unified mux implementation

Risk Level: Low, nor enabled atm
Testing: Updated tests

Signed-off-by: Dmitri Dolguikh <[email protected]>
  • Loading branch information
Dmitri Dolguikh authored Aug 20, 2021
1 parent 26dae5d commit fd6e675
Show file tree
Hide file tree
Showing 13 changed files with 1,839 additions and 29 deletions.
3 changes: 3 additions & 0 deletions envoy/config/grpc_mux.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ class GrpcMux {

virtual void requestOnDemandUpdate(const std::string& type_url,
const absl::flat_hash_set<std::string>& for_update) PURE;

// TODO (dmitri-d) remove this when legacy muxes have been removed
virtual bool isUnified() const { return false; }
};

using GrpcMuxPtr = std::unique_ptr<GrpcMux>;
Expand Down
20 changes: 20 additions & 0 deletions source/common/config/xds_mux/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,23 @@ envoy_cc_library(
"@envoy_api//envoy/service/discovery/v3:pkg_cc_proto",
],
)

envoy_cc_library(
name = "grpc_mux_lib",
srcs = ["grpc_mux_impl.cc"],
hdrs = ["grpc_mux_impl.h"],
deps = [
":delta_subscription_state_lib",
":sotw_subscription_state_lib",
"//envoy/event:dispatcher_interface",
"//envoy/grpc:async_client_interface",
"//source/common/config:grpc_stream_lib",
"//source/common/config:pausable_ack_queue_lib",
"//source/common/config:version_converter_lib",
"//source/common/config:watch_map_lib",
"//source/common/config:xds_context_params_lib",
"//source/common/config:xds_resource_lib",
"//source/common/memory:utils_lib",
"@envoy_api//envoy/service/discovery/v3:pkg_cc_proto",
],
)
14 changes: 14 additions & 0 deletions source/common/config/xds_mux/delta_subscription_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ class DeltaSubscriptionState
std::set<std::string> names_removed_;
};

class DeltaSubscriptionStateFactory : public SubscriptionStateFactory<DeltaSubscriptionState> {
public:
DeltaSubscriptionStateFactory(Event::Dispatcher& dispatcher) : dispatcher_(dispatcher) {}
~DeltaSubscriptionStateFactory() override = default;
std::unique_ptr<DeltaSubscriptionState>
makeSubscriptionState(const std::string& type_url, UntypedConfigUpdateCallbacks& callbacks,
OpaqueResourceDecoder&, const bool wildcard) override {
return std::make_unique<DeltaSubscriptionState>(type_url, callbacks, dispatcher_, wildcard);
}

private:
Event::Dispatcher& dispatcher_;
};

} // namespace XdsMux
} // namespace Config
} // namespace Envoy
Loading

0 comments on commit fd6e675

Please sign in to comment.