Skip to content

Commit 927c3e3

Browse files
Bohdan Kurylovychdiachenko-mischa
authored andcommitted
Changed the type of StreamLayerClientSettings.maximum_requests
Changed the type of StreamLayerClientSettings's maximum_requests property type from boost::optional to size_t. Relates to: OLPEDGE-826 Signed-off-by: Bohdan Kurylovych <[email protected]>
1 parent e3565a2 commit 927c3e3

File tree

4 files changed

+13
-16
lines changed

4 files changed

+13
-16
lines changed

olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/StreamLayerClientSettings.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
#pragma once
2121

2222
#include <string>
23-
24-
#include <boost/optional.hpp>
23+
#include <limits>
2524

2625
#include <olp/dataservice/write/DataServiceWriteApi.h>
2726

@@ -35,10 +34,9 @@ namespace write {
3534
*/
3635
struct DATASERVICE_WRITE_API StreamLayerClientSettings {
3736
/**
38-
@brief The maximum number of requests that can be stored
39-
boost::none to store all requests. Must be positive.
40-
*/
41-
boost::optional<size_t> maximum_requests = boost::none;
37+
* @brief The maximum number of requests that can be stored. Must be positive.
38+
*/
39+
size_t maximum_requests = std::numeric_limits<size_t>::max();
4240
};
4341

4442
} // namespace write

olp-cpp-sdk-dataservice-write/src/AutoFlushSettings.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ struct AutoFlushSettings {
3636
int auto_flush_interval = 0;
3737

3838
/**
39-
@brief The maximum number of partitions to be flushed each time.Set
40-
0 to flush all partitions. Non-positive number will flush nothing.
41-
*/
39+
* @brief The maximum number of partitions to be flushed each time.Set
40+
* 0 to flush all partitions. Non-positive number will flush nothing.
41+
*/
4242
int events_per_single_flush = 0;
4343
};
4444

olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,10 @@ boost::optional<std::string> StreamLayerClientImpl::Queue(
285285
"PublishDataRequest does not contain a Layer ID");
286286
}
287287

288-
if (stream_client_settings_.maximum_requests) {
289-
if (!(StreamLayerClientImpl::QueueSize() <
290-
*stream_client_settings_.maximum_requests)) {
291-
return boost::make_optional<std::string>(
292-
"Maximum number of requests has reached");
293-
}
288+
if (!(StreamLayerClientImpl::QueueSize() <
289+
stream_client_settings_.maximum_requests)) {
290+
return boost::make_optional<std::string>(
291+
"Maximum number of requests has reached");
294292
}
295293

296294
{

tests/integration/olp-cpp-sdk-dataservice-write/StreamLayerClientCacheTest.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,8 @@ TEST_F(StreamLayerClientCacheTest, FlushDataMaxEventsInvalidCustomSetting) {
437437

438438
TEST_F(StreamLayerClientCacheTest, FlushSettingsMaximumRequests) {
439439
disk_cache_->Close();
440-
ASSERT_EQ(stream_client_settings_.maximum_requests, boost::none);
440+
const auto kMaxRequests = std::numeric_limits<size_t>::max();
441+
ASSERT_EQ(stream_client_settings_.maximum_requests, kMaxRequests);
441442
client_ = CreateStreamLayerClient();
442443
{
443444
testing::InSequence dummy;

0 commit comments

Comments
 (0)