Skip to content

Commit

Permalink
Katran: Replace folly::optional with std::optional (set1)
Browse files Browse the repository at this point in the history
Summary: Since folly::optional is deprecated, replaced folly::optional with std::optional.

Reviewed By: lima1756

Differential Revision: D58732977

fbshipit-source-id: 11fe38c3163d7104891fb9e06f664d8991579459
  • Loading branch information
tagrawal03 authored and facebook-github-bot committed Jun 24, 2024
1 parent af105f3 commit 1975e0a
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 14 deletions.
4 changes: 2 additions & 2 deletions katran/lib/KatranLb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ void KatranLb::loadBpfProgs() {

bool KatranLb::reloadBalancerProg(
const std::string& path,
folly::Optional<KatranConfig> config) {
std::optional<KatranConfig> config) {
int res;
res = bpfAdapter_->reloadBpfProg(path);
if (res) {
Expand Down Expand Up @@ -1509,7 +1509,7 @@ std::unique_ptr<folly::IOBuf> KatranLb::getKatranMonitorEventBuffer(

bool KatranLb::restartKatranMonitor(
uint32_t limit,
folly::Optional<PcapStorageFormat> storage) {
std::optional<PcapStorageFormat> storage) {
if (!monitor_) {
return false;
}
Expand Down
6 changes: 3 additions & 3 deletions katran/lib/KatranLb.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class KatranLb {
*/
bool reloadBalancerProg(
const std::string& path,
folly::Optional<KatranConfig> config = folly::none);
std::optional<KatranConfig> config = std::nullopt);

/**
* helper function to attach bpf program (e.g. to rootlet array,
Expand Down Expand Up @@ -677,7 +677,7 @@ class KatranLb {
*/
bool restartKatranMonitor(
uint32_t limit,
folly::Optional<PcapStorageFormat> storage = folly::none);
std::optional<PcapStorageFormat> storage = std::nullopt);

/**
* @param monitoring::EventId event monitoring event id. see
Expand Down Expand Up @@ -1097,7 +1097,7 @@ class KatranLb {

std::unordered_map<VipKey, Vip, VipKeyHasher> vips_;

folly::Optional<VipKey> lruMissStatsVip_;
std::optional<VipKey> lruMissStatsVip_;

/**
* Maps an HcKey to its id
Expand Down
2 changes: 1 addition & 1 deletion katran/lib/KatranMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void KatranMonitor::stopMonitor() {

void KatranMonitor::restartMonitor(
uint32_t limit,
folly::Optional<PcapStorageFormat> storage) {
std::optional<PcapStorageFormat> storage) {
if (storage.has_value() && config_.storage != *storage) {
stopMonitor();
config_.storage = *storage;
Expand Down
4 changes: 1 addition & 3 deletions katran/lib/KatranMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ class KatranMonitor {

void stopMonitor();

void restartMonitor(
uint32_t limit,
folly::Optional<PcapStorageFormat> storage);
void restartMonitor(uint32_t limit, std::optional<PcapStorageFormat> storage);

PcapWriterStats getWriterStats();

Expand Down
6 changes: 3 additions & 3 deletions katran/lib/MonitoringServiceCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ class MonitoringServiceCore
*/
typedef struct SubscriptionResult {
ResponseStatus status;
folly::Optional<ClientId> cid;
folly::Optional<EventIds> subscribed_events;
folly::Optional<std::shared_ptr<SubscriptionCallback>> sub_cb;
std::optional<ClientId> cid;
std::optional<EventIds> subscribed_events;
std::optional<std::shared_ptr<SubscriptionCallback>> sub_cb;

/**
* Constructor used for error and empty results
Expand Down
2 changes: 1 addition & 1 deletion katran/lib/testing/BpfTester.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct TesterConfig {
*/
int bpfProgFd{-1};

folly::Optional<int> singleTestRunPacketNumber_{folly::none};
std::optional<int> singleTestRunPacketNumber_{std::nullopt};
};

/**
Expand Down
2 changes: 1 addition & 1 deletion katran/lib/testing/PacketAttributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct PacketAttributes {

// We set this if we want to verify whether or not the packet was
// routed through global lru
folly::Optional<bool> routedThroughGlobalLru{folly::none};
std::optional<bool> routedThroughGlobalLru{std::nullopt};
};

} // namespace katran

0 comments on commit 1975e0a

Please sign in to comment.