forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lds_api.h
55 lines (46 loc) · 1.97 KB
/
lds_api.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#pragma once
#include <functional>
#include "envoy/api/v2/lds.pb.h"
#include "envoy/config/subscription.h"
#include "envoy/config/subscription_factory.h"
#include "envoy/init/manager.h"
#include "envoy/server/listener_manager.h"
#include "envoy/stats/scope.h"
#include "common/common/logger.h"
#include "common/init/target_impl.h"
namespace Envoy {
namespace Server {
/**
* LDS API implementation that fetches via Subscription.
*/
class LdsApiImpl : public LdsApi,
Config::SubscriptionCallbacks,
Logger::Loggable<Logger::Id::upstream> {
public:
LdsApiImpl(const envoy::api::v2::core::ConfigSource& lds_config, Upstream::ClusterManager& cm,
Init::Manager& init_manager, Stats::Scope& scope, ListenerManager& lm,
ProtobufMessage::ValidationVisitor& validation_visitor);
// Server::LdsApi
std::string versionInfo() const override { return system_version_info_; }
private:
// Config::SubscriptionCallbacks
void onConfigUpdate(const Protobuf::RepeatedPtrField<ProtobufWkt::Any>& resources,
const std::string& version_info) override;
void onConfigUpdate(const Protobuf::RepeatedPtrField<envoy::api::v2::Resource>& added_resources,
const Protobuf::RepeatedPtrField<std::string>& removed_resources,
const std::string& system_version_info) override;
void onConfigUpdateFailed(Envoy::Config::ConfigUpdateFailureReason reason,
const EnvoyException* e) override;
std::string resourceName(const ProtobufWkt::Any& resource) override {
return MessageUtil::anyConvert<envoy::api::v2::Listener>(resource).name();
}
std::unique_ptr<Config::Subscription> subscription_;
std::string system_version_info_;
ListenerManager& listener_manager_;
Stats::ScopePtr scope_;
Upstream::ClusterManager& cm_;
Init::TargetImpl init_target_;
ProtobufMessage::ValidationVisitor& validation_visitor_;
};
} // namespace Server
} // namespace Envoy