1
#pragma once
2

            
3
#include "envoy/config/grpc_mux.h"
4

            
5
namespace Envoy {
6
namespace Config {
7

            
8
// A placeholder class returned if no ADS is configured.
9
class NullGrpcMuxImpl : public GrpcMux,
10
                        GrpcStreamCallbacks<envoy::service::discovery::v3::DiscoveryResponse> {
11
public:
12
10519
  void start() override {}
13
1
  ScopedResume pause(const std::string&) override {
14
1
    return std::make_unique<Cleanup>([] {});
15
1
  }
16
22802
  ScopedResume pause(const std::vector<std::string>) override {
17
22802
    return std::make_unique<Cleanup>([] {});
18
22802
  }
19

            
20
  GrpcMuxWatchPtr addWatch(const std::string&, const absl::flat_hash_set<std::string>&,
21
                           SubscriptionCallbacks&, OpaqueResourceDecoderSharedPtr,
22
1
                           const SubscriptionOptions&) override {
23
1
    ExceptionUtil::throwEnvoyException("ADS must be configured to support an ADS config source");
24
1
  }
25

            
26
1
  void requestOnDemandUpdate(const std::string&, const absl::flat_hash_set<std::string>&) override {
27
1
    ENVOY_BUG(false, "unexpected request for on demand update");
28
1
  }
29

            
30
  absl::Status updateMuxSource(Grpc::RawAsyncClientSharedPtr&&, Grpc::RawAsyncClientSharedPtr&&,
31
                               Stats::Scope&, BackOffStrategyPtr&&,
32
1
                               const envoy::config::core::v3::ApiConfigSource&) override {
33
1
    return absl::UnimplementedError("");
34
1
  }
35

            
36
116
  EdsResourcesCacheOptRef edsResourcesCache() override { return absl::nullopt; }
37

            
38
  Upstream::LoadStatsReporter* loadStatsReporter() const override { return nullptr; }
39
  Upstream::LoadStatsReporter* maybeCreateLoadStatsReporter() override { return nullptr; }
40

            
41
1
  void onWriteable() override {}
42
1
  void onStreamEstablished() override {}
43
1
  void onEstablishmentFailure(bool) override {}
44
  void onDiscoveryResponse(std::unique_ptr<envoy::service::discovery::v3::DiscoveryResponse>&&,
45
1
                           ControlPlaneStats&) override {}
46
};
47

            
48
} // namespace Config
49
} // namespace Envoy