forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdelta_subscription_state.h
43 lines (33 loc) · 1.61 KB
/
delta_subscription_state.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
#pragma once
#include "envoy/config/subscription.h"
#include "envoy/local_info/local_info.h"
#include "envoy/service/discovery/v3/discovery.pb.h"
#include "source/common/common/logger.h"
#include "source/common/config/new_delta_subscription_state.h"
#include "source/common/config/old_delta_subscription_state.h"
#include "absl/container/flat_hash_set.h"
#include "absl/types/variant.h"
namespace Envoy {
namespace Config {
using DeltaSubscriptionStateVariant =
absl::variant<OldDeltaSubscriptionState, NewDeltaSubscriptionState>;
class DeltaSubscriptionState : public Logger::Loggable<Logger::Id::config> {
public:
DeltaSubscriptionState(std::string type_url, UntypedConfigUpdateCallbacks& watch_map,
const LocalInfo::LocalInfo& local_info, Event::Dispatcher& dispatcher);
void updateSubscriptionInterest(const absl::flat_hash_set<std::string>& cur_added,
const absl::flat_hash_set<std::string>& cur_removed);
void setMustSendDiscoveryRequest();
bool subscriptionUpdatePending() const;
void markStreamFresh();
UpdateAck handleResponse(const envoy::service::discovery::v3::DeltaDiscoveryResponse& message);
void handleEstablishmentFailure();
envoy::service::discovery::v3::DeltaDiscoveryRequest getNextRequestAckless();
envoy::service::discovery::v3::DeltaDiscoveryRequest getNextRequestWithAck(const UpdateAck& ack);
DeltaSubscriptionState(const DeltaSubscriptionState&) = delete;
DeltaSubscriptionState& operator=(const DeltaSubscriptionState&) = delete;
private:
DeltaSubscriptionStateVariant state_;
};
} // namespace Config
} // namespace Envoy