Skip to content

Commit ffea694

Browse files
committed
use std::nullopt
1 parent 33ed29e commit ffea694

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

lib/ClientConnection.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1703,7 +1703,7 @@ void ClientConnection::handleProducerSuccess(const proto::CommandProducerSuccess
17031703
if (producerSuccess.has_topic_epoch()) {
17041704
data.topicEpoch = std::make_optional(producerSuccess.topic_epoch());
17051705
} else {
1706-
data.topicEpoch = {};
1706+
data.topicEpoch = std::nullopt;
17071707
}
17081708
requestData.promise.setValue(data);
17091709
cancelTimer(*requestData.timer);

lib/ConsumerImpl.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,8 @@ Future<Result, bool> ConsumerImpl::connectionOpened(const ClientConnectionPtr& c
241241

242242
Lock lockForMessageId(mutexForMessageId_);
243243
clearReceiveQueue();
244-
const auto subscribeMessageId = (subscriptionMode_ == Commands::SubscriptionModeNonDurable)
245-
? startMessageId_.get()
246-
: optional<MessageId>{};
244+
const auto subscribeMessageId =
245+
(subscriptionMode_ == Commands::SubscriptionModeNonDurable) ? startMessageId_.get() : std::nullopt;
247246
lockForMessageId.unlock();
248247

249248
unAckedMessageTrackerPtr_->clear();
@@ -1124,7 +1123,7 @@ void ConsumerImpl::clearReceiveQueue() {
11241123
if (hasSoughtByTimestamp()) {
11251124
// Invalidate startMessageId_ so that isPriorBatchIndex and isPriorEntryIndex checks will be
11261125
// skipped, and hasMessageAvailableAsync won't use startMessageId_ in compare.
1127-
startMessageId_ = optional<MessageId>{};
1126+
startMessageId_ = std::nullopt;
11281127
} else {
11291128
startMessageId_ = seekMessageId_.get();
11301129
}
@@ -1313,7 +1312,7 @@ void ConsumerImpl::negativeAcknowledge(const MessageId& messageId) {
13131312
negativeAcksTracker_->add(messageId);
13141313
}
13151314

1316-
void ConsumerImpl::disconnectConsumer() { disconnectConsumer(optional<std::string>{}); }
1315+
void ConsumerImpl::disconnectConsumer() { disconnectConsumer(std::nullopt); }
13171316

13181317
void ConsumerImpl::disconnectConsumer(const optional<std::string>& assignedBrokerUrl) {
13191318
LOG_INFO("Broker notification of Closed consumer: "

lib/HandlerBase.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ void HandlerBase::setCnx(const ClientConnectionPtr& cnx) {
8585
connection_ = cnx;
8686
}
8787

88-
void HandlerBase::grabCnx() { grabCnx(optional<std::string>{}); }
88+
void HandlerBase::grabCnx() { grabCnx(std::nullopt); }
8989

9090
Future<Result, ClientConnectionPtr> HandlerBase::getConnection(
9191
const ClientImplPtr& client, const optional<std::string>& assignedBrokerUrl) {
@@ -176,7 +176,7 @@ void HandlerBase::handleDisconnection(Result result, const ClientConnectionPtr&
176176
break;
177177
}
178178
}
179-
void HandlerBase::scheduleReconnection() { scheduleReconnection(optional<std::string>{}); }
179+
void HandlerBase::scheduleReconnection() { scheduleReconnection(std::nullopt); }
180180
void HandlerBase::scheduleReconnection(const optional<std::string>& assignedBrokerUrl) {
181181
const auto state = state_.load();
182182

lib/ProducerImpl.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ void ProducerImpl::disconnectProducer(const optional<std::string>& assignedBroke
981981
scheduleReconnection(assignedBrokerUrl);
982982
}
983983

984-
void ProducerImpl::disconnectProducer() { disconnectProducer(optional<std::string>{}); }
984+
void ProducerImpl::disconnectProducer() { disconnectProducer(std::nullopt); }
985985

986986
void ProducerImpl::start() {
987987
HandlerBase::start();

0 commit comments

Comments
 (0)