From cb9c5b2872afaf19cefe96b2b1c6fcb99831a9fc Mon Sep 17 00:00:00 2001 From: Alexander Sopov Date: Mon, 11 Aug 2025 10:13:24 +0200 Subject: [PATCH] Use std::optional if available. Currently, SDK requires C++11 minimum. So, boost::optional type is used for optional values. For C++17 and above more convenient is to use std::optional instead. The task NLAM-23 is about making this type configurable. This commit is a third part of the task: olp-cpp-sdk-read. Also, initial name "optional.hpp" is changed to optional.h to avoid clang-format header sorting issue. Relates-To: NLAM-23 Signed-off-by: sopov --- .../olp/dataservice/read/CatalogRequest.h | 40 +++---- .../dataservice/read/CatalogVersionRequest.h | 44 +++----- .../olp/dataservice/read/ConsumerProperties.h | 1 - .../olp/dataservice/read/DataRequest.h | 105 +++++------------- .../olp/dataservice/read/PartitionsRequest.h | 56 ++++------ .../read/PrefetchPartitionsRequest.h | 49 +++----- .../dataservice/read/PrefetchTilesRequest.h | 67 ++++------- .../olp/dataservice/read/SubscribeRequest.h | 47 ++++---- .../olp/dataservice/read/TileRequest.h | 50 +++------ .../dataservice/read/VersionedLayerClient.h | 4 +- .../olp/dataservice/read/VersionsRequest.h | 39 ++++--- .../olp/dataservice/read/model/Catalog.h | 11 +- .../olp/dataservice/read/model/Messages.h | 37 +++--- .../olp/dataservice/read/model/Partitions.h | 47 ++++---- .../src/StreamLayerClientImpl.cpp | 6 +- olp-cpp-sdk-dataservice-read/src/TaskSink.h | 13 +-- .../src/VersionedLayerClient.cpp | 2 +- .../src/VersionedLayerClientImpl.cpp | 15 ++- .../src/VersionedLayerClientImpl.h | 6 +- .../src/VolatileLayerClientImpl.cpp | 9 +- .../src/generated/api/BlobApi.cpp | 5 +- .../src/generated/api/BlobApi.h | 6 +- .../src/generated/api/ConfigApi.cpp | 8 +- .../src/generated/api/ConfigApi.h | 4 +- .../src/generated/api/MetadataApi.cpp | 30 ++--- .../src/generated/api/MetadataApi.h | 20 ++-- .../src/generated/api/QueryApi.cpp | 25 +++-- .../src/generated/api/QueryApi.h | 14 +-- .../src/generated/api/StreamApi.cpp | 58 +++++----- .../src/generated/api/StreamApi.h | 26 ++--- .../src/generated/api/VolatileBlobApi.cpp | 8 +- .../src/generated/api/VolatileBlobApi.h | 5 +- .../src/generated/model/Index.h | 51 ++++----- .../src/generated/parser/CatalogParser.cpp | 4 +- .../src/generated/parser/IndexParser.cpp | 18 +-- .../src/generated/parser/MessagesParser.cpp | 12 +- .../src/generated/parser/PartitionsParser.cpp | 19 ++-- .../src/repositories/ApiCacheRepository.cpp | 4 +- .../src/repositories/ApiCacheRepository.h | 6 +- .../src/repositories/AsyncJsonStream.cpp | 4 +- .../src/repositories/AsyncJsonStream.h | 9 +- .../repositories/CatalogCacheRepository.cpp | 8 +- .../src/repositories/CatalogCacheRepository.h | 6 +- .../src/repositories/CatalogRepository.cpp | 2 +- .../src/repositories/CatalogRepository.h | 2 +- .../src/repositories/DataCacheRepository.cpp | 4 +- .../src/repositories/DataCacheRepository.h | 6 +- .../src/repositories/DataRepository.cpp | 12 +- .../src/repositories/DataRepository.h | 2 +- .../src/repositories/NamedMutex.cpp | 12 +- .../src/repositories/NamedMutex.h | 14 +-- .../PartitionsCacheRepository.cpp | 51 +++++---- .../repositories/PartitionsCacheRepository.h | 42 +++---- .../src/repositories/PartitionsRepository.cpp | 81 +++++++------- .../src/repositories/PartitionsRepository.h | 18 +-- .../repositories/PrefetchTilesRepository.cpp | 8 +- .../repositories/PrefetchTilesRepository.h | 4 +- .../src/repositories/QuadTreeIndex.cpp | 21 ++-- .../src/repositories/QuadTreeIndex.h | 6 +- .../tests/DataRepositoryTest.cpp | 52 ++++----- .../tests/MetadataApiTest.cpp | 42 +++---- .../tests/ParserTest.cpp | 26 ++--- .../tests/PartitionsCacheRepositoryTest.cpp | 52 +++++---- .../tests/PartitionsRepositoryTest.cpp | 20 ++-- .../tests/PartitionsSaxHandlerTest.cpp | 15 ++- .../tests/QuadTreeIndexTest.cpp | 40 +++---- .../tests/QueryApiTest.cpp | 34 +++--- .../tests/SerializerTest.cpp | 24 +++- .../tests/StreamApiTest.cpp | 36 +++--- .../tests/StreamLayerClientImplTest.cpp | 8 +- .../tests/VersionedLayerClientImplTest.cpp | 31 ++++-- 71 files changed, 791 insertions(+), 872 deletions(-) diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogRequest.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogRequest.h index 05fba51ca..88cb2c0f3 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogRequest.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogRequest.h @@ -23,9 +23,9 @@ #include #include +#include #include #include -#include namespace olp { namespace dataservice { @@ -43,10 +43,10 @@ class DATASERVICE_READ_API CatalogRequest final { * billing records together. If supplied, it must be 4–16 characters * long and contain only alphanumeric ASCII characters [A-Za-z0-9]. * - * @return The `BillingTag` string or `boost::none` if the billing tag is not - * set. + * @return The `BillingTag` string or `olp::porting::none` if the billing tag + * is not set. */ - inline const boost::optional& GetBillingTag() const { + const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -55,27 +55,13 @@ class DATASERVICE_READ_API CatalogRequest final { * * @see `GetBillingTag()` for information on usage and format. * - * @param tag The `BillingTag` string or `boost::none`. + * @param tag The `BillingTag` string or `olp::porting::none`. * * @return A reference to the updated `CatalogRequest` instance. */ - inline CatalogRequest& WithBillingTag(boost::optional tag) { - billing_tag_ = std::move(tag); - return *this; - } - - /** - * @brief Sets the billing tag for the request. - * - * @see `GetBillingTag()` for information on usage and format. - * - * @param tag The rvalue reference to the `BillingTag` string or - * `boost::none`. - * - * @return A reference to the updated `CatalogRequest` instance. - */ - inline CatalogRequest& WithBillingTag(std::string&& tag) { - billing_tag_ = std::move(tag); + template > + CatalogRequest& WithBillingTag(T&& tag) { + billing_tag_ = std::forward(tag); return *this; } @@ -87,7 +73,7 @@ class DATASERVICE_READ_API CatalogRequest final { * * @return The fetch option. */ - inline FetchOptions GetFetchOption() const { return fetch_option_; } + FetchOptions GetFetchOption() const { return fetch_option_; } /** * @brief Sets the fetch option that you can use to set the source from @@ -99,7 +85,7 @@ class DATASERVICE_READ_API CatalogRequest final { * * @return A reference to the updated `CatalogVersionRequest` instance. */ - inline CatalogRequest& WithFetchOption(FetchOptions fetch_option) { + CatalogRequest& WithFetchOption(const FetchOptions fetch_option) { fetch_option_ = fetch_option; return *this; } @@ -109,17 +95,17 @@ class DATASERVICE_READ_API CatalogRequest final { * * @return A string representation of the request. */ - inline std::string CreateKey() const { + std::string CreateKey() const { std::stringstream out; if (GetBillingTag()) { - out << "$" << GetBillingTag().get(); + out << "$" << *GetBillingTag(); } out << "^" << GetFetchOption(); return out.str(); } private: - boost::optional billing_tag_; + porting::optional billing_tag_; FetchOptions fetch_option_{OnlineIfNotFound}; }; diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogVersionRequest.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogVersionRequest.h index 6749b9d5b..e4ad6007c 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogVersionRequest.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/CatalogVersionRequest.h @@ -23,8 +23,7 @@ #include #include -#include - +#include #include "DataServiceReadApi.h" #include "FetchOptions.h" @@ -57,7 +56,7 @@ class DATASERVICE_READ_API CatalogVersionRequest final { * * @return A reference to the updated `CatalogVersionRequest` instance. */ - inline CatalogVersionRequest& WithStartVersion(int64_t startVersion) { + CatalogVersionRequest& WithStartVersion(int64_t startVersion) { start_version_ = startVersion; return *this; } @@ -69,10 +68,10 @@ class DATASERVICE_READ_API CatalogVersionRequest final { * billing records together. If supplied, it must be 4–16 characters * long and contain only alphanumeric ASCII characters [A-Za-z0-9]. * - * @return The `BillingTag` string or `boost::none` if the billing tag is not - * set. + * @return The `BillingTag` string or `olp::porting::none` if the billing tag + * is not set. */ - inline const boost::optional& GetBillingTag() const { + const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -81,28 +80,13 @@ class DATASERVICE_READ_API CatalogVersionRequest final { * * @see `GetBillingTag()` for information on usage and format. * - * @param billingTag The `BillingTag` string or `boost::none`. - * - * @return A reference to the updated `CatalogVersionRequest` instance. - */ - inline CatalogVersionRequest& WithBillingTag( - boost::optional billingTag) { - billing_tag_ = std::move(billingTag); - return *this; - } - - /** - * @brief Sets the billing tag for the request. - * - * @see `GetBillingTag()` for information on usage and format. - * - * @param billingTag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * @param billingTag The `BillingTag` string or `olp::porting::none`. * * @return A reference to the updated `CatalogVersionRequest` instance. */ - inline CatalogVersionRequest& WithBillingTag(std::string&& billingTag) { - billing_tag_ = std::move(billingTag); + template > + CatalogVersionRequest& WithBillingTag(T&& billingTag) { + billing_tag_ = std::forward(billingTag); return *this; } @@ -114,7 +98,7 @@ class DATASERVICE_READ_API CatalogVersionRequest final { * * @return The fetch option. */ - inline FetchOptions GetFetchOption() const { return fetch_option_; } + FetchOptions GetFetchOption() const { return fetch_option_; } /** * @brief Sets the fetch option that you can use to set the source from @@ -126,7 +110,7 @@ class DATASERVICE_READ_API CatalogVersionRequest final { * * @return A reference to the updated `CatalogVersionRequest` instance. */ - inline CatalogVersionRequest& WithFetchOption(FetchOptions fetchoption) { + CatalogVersionRequest& WithFetchOption(FetchOptions fetchoption) { fetch_option_ = fetchoption; return *this; } @@ -136,13 +120,13 @@ class DATASERVICE_READ_API CatalogVersionRequest final { * * @return A string representation of the request. */ - inline std::string CreateKey() const { + std::string CreateKey() const { std::stringstream out; out << "@" << GetStartVersion(); if (GetBillingTag()) { - out << "$" << GetBillingTag().get(); + out << "$" << *GetBillingTag(); } out << "^" << GetFetchOption(); @@ -152,7 +136,7 @@ class DATASERVICE_READ_API CatalogVersionRequest final { private: int64_t start_version_{-1}; - boost::optional billing_tag_; + porting::optional billing_tag_; FetchOptions fetch_option_{OnlineIfNotFound}; }; diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/ConsumerProperties.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/ConsumerProperties.h index 7f9fc4a99..2ac17c5bc 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/ConsumerProperties.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/ConsumerProperties.h @@ -25,7 +25,6 @@ #include #include -#include namespace olp { namespace dataservice { diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/DataRequest.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/DataRequest.h index d6c912fcd..802b05c7a 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/DataRequest.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/DataRequest.h @@ -23,10 +23,10 @@ #include #include +#include #include #include #include -#include namespace olp { namespace dataservice { @@ -47,7 +47,7 @@ class DATASERVICE_READ_API DataRequest final { * * @return The partition ID. */ - inline const boost::optional& GetPartitionId() const { + const porting::optional& GetPartitionId() const { return partition_id_; } @@ -61,24 +61,9 @@ class DATASERVICE_READ_API DataRequest final { * * @return A reference to the updated `DataRequest` instance. */ - inline DataRequest& WithPartitionId( - boost::optional partition_id) { - partition_id_ = std::move(partition_id); - return *this; - } - - /** - * @brief Sets the partition ID. - * - * If the partition cannot be found in the layer, the callback returns - * with an empty response (the `null` result for data and an error). - * - * @param partition_id The partition ID. - * - * @return A reference to the updated `DataRequest` instance. - */ - inline DataRequest& WithPartitionId(std::string&& partition_id) { - partition_id_ = std::move(partition_id); + template > + DataRequest& WithPartitionId(T&& partition_id) { + partition_id_ = std::forward(partition_id); return *this; } @@ -93,7 +78,7 @@ class DATASERVICE_READ_API DataRequest final { * * @return The partition data handle. */ - inline const boost::optional& GetDataHandle() const { + const porting::optional& GetDataHandle() const { return data_handle_; } @@ -109,25 +94,9 @@ class DATASERVICE_READ_API DataRequest final { * * @return A reference to the updated `DataRequest` instance. */ - inline DataRequest& WithDataHandle(boost::optional data_handle) { - data_handle_ = std::move(data_handle); - return *this; - } - - /** - * @brief Sets the partition data handle. - * - * If the data handle cannot be found in the layer, the callback returns - * with an empty response (the `null` result for data and an error). - * - * @see `GetDataHandle` for information on the partition data handle. - * - * @param data_handle The partition data handle. - * - * @return A reference to the updated `DataRequest` instance. - */ - inline DataRequest& WithDataHandle(std::string&& data_handle) { - data_handle_ = std::move(data_handle); + template > + DataRequest& WithDataHandle(T&& data_handle) { + data_handle_ = std::forward(data_handle); return *this; } @@ -138,10 +107,10 @@ class DATASERVICE_READ_API DataRequest final { * billing records together. If supplied, it must be 4–16 characters * long and contain only alphanumeric ASCII characters [A-Za-z0-9]. * - * @return The `BillingTag` string or `boost::none` if the billing tag is not - * set. + * @return The `BillingTag` string or `olp::porting::none` if the billing tag + * is not set. */ - inline const boost::optional& GetBillingTag() const { + const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -150,27 +119,13 @@ class DATASERVICE_READ_API DataRequest final { * * @see `GetBillingTag()` for information on usage and format. * - * @param tag The `BillingTag` string or `boost::none`. - * - * @return A reference to the updated `DataRequest` instance. - */ - inline DataRequest& WithBillingTag(boost::optional tag) { - billing_tag_ = std::move(tag); - return *this; - } - - /** - * @brief Sets the billing tag for the request. - * - * @see `GetBillingTag()` for information on usage and format. - * - * @param tag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * @param tag The `BillingTag` string or `olp::porting::none`. * * @return A reference to the updated `DataRequest` instance. */ - inline DataRequest& WithBillingTag(std::string&& tag) { - billing_tag_ = std::move(tag); + template > + DataRequest& WithBillingTag(T&& tag) { + billing_tag_ = std::forward(tag); return *this; } @@ -182,7 +137,7 @@ class DATASERVICE_READ_API DataRequest final { * * @return The fetch option. */ - inline FetchOptions GetFetchOption() const { return fetch_option_; } + FetchOptions GetFetchOption() const { return fetch_option_; } /** * @brief Sets the fetch option that you can use to set the source from @@ -194,7 +149,7 @@ class DATASERVICE_READ_API DataRequest final { * * @return A reference to the updated `DataRequest` instance. */ - inline DataRequest& WithFetchOption(FetchOptions fetch_option) { + DataRequest& WithFetchOption(FetchOptions fetch_option) { fetch_option_ = fetch_option; return *this; } @@ -206,7 +161,7 @@ class DATASERVICE_READ_API DataRequest final { * * @return The request priority. */ - inline uint32_t GetPriority() const { return priority_; } + uint32_t GetPriority() const { return priority_; } /** * @brief Sets the priority of the request. @@ -215,7 +170,7 @@ class DATASERVICE_READ_API DataRequest final { * * @return A reference to the updated `DataRequest` instance. */ - inline DataRequest& WithPriority(uint32_t priority) { + DataRequest& WithPriority(uint32_t priority) { priority_ = priority; return *this; } @@ -228,31 +183,31 @@ class DATASERVICE_READ_API DataRequest final { * * @return A string representation of the request. */ - inline std::string CreateKey(const std::string& layer_id, - boost::optional version) const { + std::string CreateKey(const std::string& layer_id, + porting::optional version) const { std::stringstream out; out << layer_id << "["; if (GetPartitionId()) { - out << GetPartitionId().get(); + out << *GetPartitionId(); } else if (GetDataHandle()) { - out << GetDataHandle().get(); + out << *GetDataHandle(); } out << "]"; if (version) { - out << "@" << version.get(); + out << "@" << *version; } if (GetBillingTag()) { - out << "$" << GetBillingTag().get(); + out << "$" << *GetBillingTag(); } out << "^" << GetFetchOption(); return out.str(); } private: - boost::optional partition_id_; - boost::optional catalog_version_; - boost::optional data_handle_; - boost::optional billing_tag_; + porting::optional partition_id_; + porting::optional catalog_version_; + porting::optional data_handle_; + porting::optional billing_tag_; FetchOptions fetch_option_{OnlineIfNotFound}; uint32_t priority_{thread::NORMAL}; }; diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PartitionsRequest.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PartitionsRequest.h index d89d35728..b92ae3f82 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PartitionsRequest.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PartitionsRequest.h @@ -24,10 +24,9 @@ #include #include -#include +#include #include #include -#include namespace olp { namespace dataservice { @@ -69,7 +68,7 @@ class DATASERVICE_READ_API PartitionsRequest final { * * @return A reference to the updated `PartitionsRequest` instance. */ - inline PartitionsRequest& WithPartitionIds(PartitionIds partition_ids) { + PartitionsRequest& WithPartitionIds(PartitionIds partition_ids) { partition_ids_ = std::move(partition_ids); return *this; } @@ -79,7 +78,7 @@ class DATASERVICE_READ_API PartitionsRequest final { * * @return The vector of strings that represent partitions. */ - inline const PartitionIds& GetPartitionIds() const { return partition_ids_; } + const PartitionIds& GetPartitionIds() const { return partition_ids_; } /** * @brief Sets the list of additional fields. @@ -95,8 +94,7 @@ class DATASERVICE_READ_API PartitionsRequest final { * * @return A reference to the updated `PartitionsRequest` instance. */ - inline PartitionsRequest& WithAdditionalFields( - AdditionalFields additional_fields) { + PartitionsRequest& WithAdditionalFields(AdditionalFields additional_fields) { additional_fields_ = std::move(additional_fields); return *this; } @@ -106,7 +104,7 @@ class DATASERVICE_READ_API PartitionsRequest final { * * @return The set of additional fields. */ - inline const AdditionalFields& GetAdditionalFields() const { + const AdditionalFields& GetAdditionalFields() const { return additional_fields_; } @@ -117,10 +115,10 @@ class DATASERVICE_READ_API PartitionsRequest final { * billing records together. If supplied, it must be 4–16 characters * long and contain only alphanumeric ASCII characters [A-Za-z0-9]. * - * @return The `BillingTag` string or `boost::none` if the billing tag is not - * set. + * @return The `BillingTag` string or `olp::porting::none` if the billing tag + * is not set. */ - inline const boost::optional& GetBillingTag() const { + const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -129,28 +127,13 @@ class DATASERVICE_READ_API PartitionsRequest final { * * @see `GetBillingTag()` for information on usage and format. * - * @param billingTag The `BillingTag` string or `boost::none`. + * @param billingTag The `BillingTag` string or `olp::porting::none`. * * @return A reference to the updated `PrefetchTilesRequest` instance. */ - inline PartitionsRequest& WithBillingTag( - boost::optional billingTag) { - billing_tag_ = std::move(billingTag); - return *this; - } - - /** - * @brief Sets the billing tag for the request. - * - * @see `GetBillingTag()` for information on usage and format. - * - * @param billingTag The rvalue reference to the `BillingTag` string or - * `boost::none`. - * - * @return A reference to the updated `PrefetchTilesRequest` instance. - */ - inline PartitionsRequest& WithBillingTag(std::string&& billingTag) { - billing_tag_ = std::move(billingTag); + template > + PartitionsRequest& WithBillingTag(T&& billingTag) { + billing_tag_ = std::forward(billingTag); return *this; } @@ -162,7 +145,7 @@ class DATASERVICE_READ_API PartitionsRequest final { * * @return The fetch option. */ - inline FetchOptions GetFetchOption() const { return fetch_option_; } + FetchOptions GetFetchOption() const { return fetch_option_; } /** * @brief Sets the fetch option that you can use to set the source from @@ -174,7 +157,7 @@ class DATASERVICE_READ_API PartitionsRequest final { * * @return A reference to the updated `PrefetchTilesRequest` instance. */ - inline PartitionsRequest& WithFetchOption(FetchOptions fetch_option) { + PartitionsRequest& WithFetchOption(FetchOptions fetch_option) { fetch_option_ = fetch_option; return *this; } @@ -187,15 +170,16 @@ class DATASERVICE_READ_API PartitionsRequest final { * * @return A string representation of the request. */ - std::string CreateKey(const std::string& layer_id, - boost::optional version = boost::none) const { + std::string CreateKey( + const std::string& layer_id, + porting::optional version = porting::none) const { std::stringstream out; out << layer_id; if (version) { - out << "@" << version.get(); + out << "@" << *version; } if (GetBillingTag()) { - out << "$" << GetBillingTag().get(); + out << "$" << *GetBillingTag(); } out << "^" << GetFetchOption(); return out.str(); @@ -204,7 +188,7 @@ class DATASERVICE_READ_API PartitionsRequest final { private: PartitionIds partition_ids_; AdditionalFields additional_fields_; - boost::optional billing_tag_; + porting::optional billing_tag_; FetchOptions fetch_option_{OnlineIfNotFound}; }; diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PrefetchPartitionsRequest.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PrefetchPartitionsRequest.h index aa338f95f..2cef74585 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PrefetchPartitionsRequest.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PrefetchPartitionsRequest.h @@ -24,10 +24,10 @@ #include #include +#include #include #include #include -#include namespace olp { namespace dataservice { @@ -54,8 +54,7 @@ class DATASERVICE_READ_API PrefetchPartitionsRequest final { * * @return A reference to the updated `PrefetchPartitionsRequest` instance. */ - inline PrefetchPartitionsRequest& WithPartitionIds( - PartitionIds partition_ids) { + PrefetchPartitionsRequest& WithPartitionIds(PartitionIds partition_ids) { partition_ids_ = std::move(partition_ids); return *this; } @@ -74,10 +73,10 @@ class DATASERVICE_READ_API PrefetchPartitionsRequest final { * billing records together. If supplied, it must be 4–16 characters * long and contain only alphanumeric ASCII characters [A-Za-z0-9]. * - * @return The `BillingTag` string or `boost::none` if the billing tag is not - * set. + * @return The `BillingTag` string or `olp::porting::none` if the billing tag + * is not set. */ - inline const boost::optional& GetBillingTag() const { + const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -86,28 +85,13 @@ class DATASERVICE_READ_API PrefetchPartitionsRequest final { * * @see `GetBillingTag()` for information on usage and format. * - * @param billing_tag The `BillingTag` string or `boost::none`. + * @param billing_tag The `BillingTag` string or `olp::porting::none`. * * @return A reference to the updated `PrefetchTilesRequest` instance. */ - inline PrefetchPartitionsRequest& WithBillingTag( - boost::optional billing_tag) { - billing_tag_ = std::move(billing_tag); - return *this; - } - - /** - * @brief Sets the billing tag for the request. - * - * @see `GetBillingTag()` for information on usage and format. - * - * @param billing_tag The rvalue reference to the `BillingTag` string or - * `boost::none`. - * - * @return A reference to the updated `PrefetchTilesRequest` instance. - */ - inline PrefetchPartitionsRequest& WithBillingTag(std::string&& billing_tag) { - billing_tag_ = std::move(billing_tag); + template > + PrefetchPartitionsRequest& WithBillingTag(T&& billing_tag) { + billing_tag_ = std::forward(billing_tag); return *this; } @@ -118,7 +102,7 @@ class DATASERVICE_READ_API PrefetchPartitionsRequest final { * * @return The request priority. */ - inline uint32_t GetPriority() const { return priority_; } + uint32_t GetPriority() const { return priority_; } /** * @brief Sets the priority of the prefetch request. @@ -127,7 +111,7 @@ class DATASERVICE_READ_API PrefetchPartitionsRequest final { * * @return A reference to the updated `PrefetchPartitionsRequest` instance. */ - inline PrefetchPartitionsRequest& WithPriority(uint32_t priority) { + PrefetchPartitionsRequest& WithPriority(uint32_t priority) { priority_ = priority; return *this; } @@ -140,19 +124,20 @@ class DATASERVICE_READ_API PrefetchPartitionsRequest final { * * @return A string representation of the request. */ - std::string CreateKey(const std::string& layer_id, - boost::optional version = boost::none) const { + std::string CreateKey( + const std::string& layer_id, + porting::optional version = porting::none) const { std::stringstream out; out << layer_id; if (version) { - out << "@" << version.get(); + out << "@" << *version; } out << "^" << partition_ids_.size(); if (!partition_ids_.empty()) { out << "[" << partition_ids_.front() << ", ...]"; } if (GetBillingTag()) { - out << "$" << GetBillingTag().get(); + out << "$" << *GetBillingTag(); } out << "*" << priority_; return out.str(); @@ -160,7 +145,7 @@ class DATASERVICE_READ_API PrefetchPartitionsRequest final { private: PartitionIds partition_ids_; - boost::optional billing_tag_; + porting::optional billing_tag_; uint32_t priority_{thread::LOW}; }; diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PrefetchTilesRequest.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PrefetchTilesRequest.h index 3d0eb146a..cdfa3e943 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PrefetchTilesRequest.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/PrefetchTilesRequest.h @@ -25,10 +25,9 @@ #include #include -#include +#include #include #include -#include namespace olp { namespace dataservice { @@ -51,9 +50,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return The vector with the tile keys. */ - inline const std::vector& GetTileKeys() const { - return tile_keys_; - } + const std::vector& GetTileKeys() const { return tile_keys_; } /** * @brief Sets the vector of the root tile keys for the request. @@ -62,8 +59,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return A reference to the updated `PrefetchTilesRequest` instance. */ - inline PrefetchTilesRequest& WithTileKeys( - std::vector tile_keys) { + PrefetchTilesRequest& WithTileKeys(std::vector tile_keys) { tile_keys_ = std::move(tile_keys); return *this; } @@ -73,7 +69,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return The minimum tile level. */ - inline unsigned int GetMinLevel() const { return min_level_; } + unsigned int GetMinLevel() const { return min_level_; } /** * @brief Sets the minimum tiles level for the request. @@ -82,7 +78,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return A reference to the updated `PrefetchTilesRequest` instance. */ - inline PrefetchTilesRequest& WithMinLevel(unsigned int min_level) { + PrefetchTilesRequest& WithMinLevel(unsigned int min_level) { min_level_ = min_level; return *this; } @@ -92,7 +88,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return The maximum tile level. */ - inline unsigned int GetMaxLevel() const { return max_level_; } + unsigned int GetMaxLevel() const { return max_level_; } /** * @brief Sets the maximum tile level for the request. @@ -101,7 +97,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return A reference to the updated `PrefetchTilesRequest` instance. */ - inline PrefetchTilesRequest& WithMaxLevel(unsigned int max_level) { + PrefetchTilesRequest& WithMaxLevel(unsigned int max_level) { max_level_ = max_level; return *this; } @@ -113,10 +109,10 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * billing records together. If supplied, it must be 4–16 characters * long and contain only alphanumeric ASCII characters [A-Za-z0-9]. * - * @return The `BillingTag` string or `boost::none` if the billing tag is not - * set. + * @return The `BillingTag` string or `olp::porting::none` if the billing tag + * is not set. */ - inline const boost::optional& GetBillingTag() const { + const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -125,28 +121,13 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @see `GetBillingTag()` for information on usage and format. * - * @param tag The `BillingTag` string or `boost::none`. - * - * @return A reference to the updated `PrefetchTilesRequest` instance. - */ - inline PrefetchTilesRequest& WithBillingTag( - boost::optional tag) { - billing_tag_ = std::move(tag); - return *this; - } - - /** - * @brief Sets the billing tag for the request. - * - * @see `GetBillingTag()` for information on usage and format. - * - * @param tag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * @param tag The `BillingTag` string or `olp::porting::none`. * * @return A reference to the updated `PrefetchTilesRequest` instance. */ - inline PrefetchTilesRequest& WithBillingTag(std::string&& tag) { - billing_tag_ = std::move(tag); + template > + PrefetchTilesRequest& WithBillingTag(T&& tag) { + billing_tag_ = std::forward(tag); return *this; } @@ -160,11 +141,11 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * disables the aggregation. * * @note Experimental. API may change. - * + * * @return A reference to the updated `PrefetchTilesRequest` instance. */ - inline PrefetchTilesRequest& WithDataAggregationEnabled( - bool data_aggregation_enabled) { + PrefetchTilesRequest& WithDataAggregationEnabled( + const bool data_aggregation_enabled) { data_aggregation_enabled_ = data_aggregation_enabled; return *this; } @@ -176,9 +157,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return The data aggregation flag as a boolean value. */ - inline bool GetDataAggregationEnabled() const { - return data_aggregation_enabled_; - } + bool GetDataAggregationEnabled() const { return data_aggregation_enabled_; } /** * @brief Gets the request priority. @@ -187,7 +166,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return The request priority. */ - inline uint32_t GetPriority() const { return priority_; } + uint32_t GetPriority() const { return priority_; } /** * @brief Sets the priority of the prefetch request. @@ -196,7 +175,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return A reference to the updated `PrefetchTileRequest` instance. */ - inline PrefetchTilesRequest& WithPriority(uint32_t priority) { + PrefetchTilesRequest& WithPriority(uint32_t priority) { priority_ = priority; return *this; } @@ -208,12 +187,12 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { * * @return A string representation of the request. */ - inline std::string CreateKey(const std::string& layer_id) const { + std::string CreateKey(const std::string& layer_id) const { std::stringstream out; out << layer_id << "[" << GetMinLevel() << "/" << GetMaxLevel() << "]" << "(" << GetTileKeys().size() << ")"; if (GetBillingTag()) { - out << "$" << GetBillingTag().get(); + out << "$" << *GetBillingTag(); } return out.str(); } @@ -223,7 +202,7 @@ class DATASERVICE_READ_API PrefetchTilesRequest final { std::vector tile_keys_; unsigned int min_level_{geo::TileKey::LevelCount}; unsigned int max_level_{geo::TileKey::LevelCount}; - boost::optional billing_tag_; + porting::optional billing_tag_; bool data_aggregation_enabled_{false}; uint32_t priority_{thread::LOW}; }; diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/SubscribeRequest.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/SubscribeRequest.h index 983a926ee..168478279 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/SubscribeRequest.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/SubscribeRequest.h @@ -22,9 +22,9 @@ #include #include +#include #include #include -#include namespace olp { namespace dataservice { @@ -61,7 +61,7 @@ class DATASERVICE_READ_API SubscribeRequest final { * * @return A reference to the updated `SubscribeRequest` instance. */ - inline SubscribeRequest& WithSubscriptionMode(SubscriptionMode mode) { + SubscribeRequest& WithSubscriptionMode(SubscriptionMode mode) { subscription_mode_ = mode; return *this; } @@ -71,23 +71,21 @@ class DATASERVICE_READ_API SubscribeRequest final { * * @return The subscription mode. */ - inline SubscriptionMode GetSubscriptionMode() const { - return subscription_mode_; - } + SubscriptionMode GetSubscriptionMode() const { return subscription_mode_; } /** * @brief (Optional) Sets the subscription ID used for the request. * - * Generated by the HERE platform if missing. Must be UUID. Must be unique within - * subscriptions. + * Generated by the HERE platform if missing. Must be UUID. Must be unique + * within subscriptions. * * @param subscription_id The subscription ID. * * @return A reference to the updated `SubscribeRequest` instance. */ - inline SubscribeRequest& WithSubscriptionId( - boost::optional subscription_id) { - subscription_id_ = std::move(subscription_id); + template > + SubscribeRequest& WithSubscriptionId(T&& subscription_id) { + subscription_id_ = std::forward(subscription_id); return *this; } @@ -96,7 +94,7 @@ class DATASERVICE_READ_API SubscribeRequest final { * * @return The subscription ID. */ - inline const boost::optional& GetSubscriptionId() const { + const porting::optional& GetSubscriptionId() const { return subscription_id_; } @@ -111,9 +109,9 @@ class DATASERVICE_READ_API SubscribeRequest final { * * @return A reference to the updated `SubscribeRequest` instance. */ - inline SubscribeRequest& WithConsumerId( - boost::optional consumer_id) { - consumer_id_ = std::move(consumer_id); + template > + SubscribeRequest& WithConsumerId(T&& consumer_id) { + consumer_id_ = std::forward(consumer_id); return *this; } @@ -122,24 +120,24 @@ class DATASERVICE_READ_API SubscribeRequest final { * * @return The consumer ID. */ - inline const boost::optional& GetConsumerId() const { + const porting::optional& GetConsumerId() const { return consumer_id_; } /** * @brief Sets the consumer properties for the request. * - * @see The [Get Data from a Stream - * Layer](https://developer.here.com/documentation/data-api/data_dev_guide/rest/getting-data-stream.html) + * @see The [Get Data from a Stream Layer] + * (https://developer.here.com/documentation/data-api/data_dev_guide/rest/getting-data-stream.html) * section in the Data API Developer Guide. * * @param properties The consumer properties. * * @return A reference to the updated `SubscribeRequest` instance. */ - inline SubscribeRequest& WithConsumerProperties( - boost::optional properties) { - consumer_properties_ = std::move(properties); + template > + SubscribeRequest& WithConsumerProperties(T&& properties) { + consumer_properties_ = std::forward(properties); return *this; } @@ -148,16 +146,15 @@ class DATASERVICE_READ_API SubscribeRequest final { * * @return The consumer properties. */ - inline const boost::optional& GetConsumerProperties() - const { + const porting::optional& GetConsumerProperties() const { return consumer_properties_; } private: SubscriptionMode subscription_mode_{SubscriptionMode::kSerial}; - boost::optional subscription_id_; - boost::optional consumer_id_; - boost::optional consumer_properties_; + porting::optional subscription_id_; + porting::optional consumer_id_; + porting::optional consumer_properties_; }; } // namespace read diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/TileRequest.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/TileRequest.h index c1398a770..f9e2ad24c 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/TileRequest.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/TileRequest.h @@ -24,9 +24,9 @@ #include #include +#include #include #include -#include namespace olp { namespace dataservice { @@ -48,10 +48,10 @@ class DATASERVICE_READ_API TileRequest final { * billing records together. If supplied, it must be 4–16 characters * long and contain only alphanumeric ASCII characters [A-Za-z0-9]. * - * @return The `BillingTag` string or `boost::none` if the billing tag is not - * set. + * @return The `BillingTag` string or `olp::porting::none` if the billing tag + * is not set. */ - inline const boost::optional& GetBillingTag() const { + const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -60,27 +60,13 @@ class DATASERVICE_READ_API TileRequest final { * * @see `GetBillingTag()` for information on usage and format. * - * @param tag The `BillingTag` string or `boost::none`. + * @param tag The `BillingTag` string or `olp::porting::none`. * * @return A reference to the updated `TileRequest` instance. */ - inline TileRequest& WithBillingTag(boost::optional tag) { - billing_tag_ = std::move(tag); - return *this; - } - - /** - * @brief Sets the billing tag for the request. - * - * @see `GetBillingTag()` for information on usage and format. - * - * @param tag The rvalue reference to the `BillingTag` string or - * `boost::none`. - * - * @return A reference to the updated `TileRequest` instance. - */ - inline TileRequest& WithBillingTag(std::string tag) { - billing_tag_ = std::move(tag); + template > + TileRequest& WithBillingTag(T&& tag) { + billing_tag_ = std::forward(tag); return *this; } @@ -91,7 +77,7 @@ class DATASERVICE_READ_API TileRequest final { * * @return A reference to the updated `TileRequest` instance. */ - inline TileRequest& WithTileKey(geo::TileKey tile_key) { + TileRequest& WithTileKey(geo::TileKey tile_key) { tile_key_ = std::move(tile_key); return *this; } @@ -99,9 +85,9 @@ class DATASERVICE_READ_API TileRequest final { /** * @brief Gets a tile key value. * - * @return The tile key or `boost::none` if tile_key is not set. + * @return The tile key or `olp::porting::none` if tile_key is not set. */ - inline const geo::TileKey& GetTileKey() const { return tile_key_; } + const geo::TileKey& GetTileKey() const { return tile_key_; } /** * @brief Gets the fetch option that controls how requests are handled. @@ -111,7 +97,7 @@ class DATASERVICE_READ_API TileRequest final { * * @return The fetch option. */ - inline FetchOptions GetFetchOption() const { return fetch_option_; } + FetchOptions GetFetchOption() const { return fetch_option_; } /** * @brief Sets the fetch option that you can use to set the source from @@ -123,7 +109,7 @@ class DATASERVICE_READ_API TileRequest final { * * @return A reference to the updated `TileRequest` instance. */ - inline TileRequest& WithFetchOption(FetchOptions fetch_option) { + TileRequest& WithFetchOption(FetchOptions fetch_option) { fetch_option_ = fetch_option; return *this; } @@ -135,7 +121,7 @@ class DATASERVICE_READ_API TileRequest final { * * @return The request priority. */ - inline uint32_t GetPriority() const { return priority_; } + uint32_t GetPriority() const { return priority_; } /** * @brief Sets the priority of the request. @@ -144,7 +130,7 @@ class DATASERVICE_READ_API TileRequest final { * * @return A reference to the updated `TileRequest` instance. */ - inline TileRequest& WithPriority(uint32_t priority) { + TileRequest& WithPriority(uint32_t priority) { priority_ = priority; return *this; } @@ -156,18 +142,18 @@ class DATASERVICE_READ_API TileRequest final { * * @return A string representation of the request. */ - inline std::string CreateKey(const std::string& layer_id) const { + std::string CreateKey(const std::string& layer_id) const { std::stringstream out; out << layer_id << "[" << GetTileKey().ToHereTile() << "]"; if (GetBillingTag()) { - out << "$" << GetBillingTag().get(); + out << "$" << *GetBillingTag(); } out << "^" << GetFetchOption(); return out.str(); } private: - boost::optional billing_tag_; + porting::optional billing_tag_; geo::TileKey tile_key_; FetchOptions fetch_option_{OnlineIfNotFound}; uint32_t priority_{thread::NORMAL}; diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionedLayerClient.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionedLayerClient.h index 6fc60ce60..398d5cf79 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionedLayerClient.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionedLayerClient.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -36,7 +37,6 @@ #include #include #include -#include namespace olp { namespace dataservice { @@ -123,7 +123,7 @@ class DATASERVICE_READ_API VersionedLayerClient final { * version. */ VersionedLayerClient(client::HRN catalog, std::string layer_id, - boost::optional catalog_version, + porting::optional catalog_version, client::OlpClientSettings settings); /// A copy constructor. diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionsRequest.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionsRequest.h index 89b3b0685..037db4b26 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionsRequest.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionsRequest.h @@ -23,10 +23,8 @@ #include #include -#include +#include #include -#include -#include namespace olp { namespace dataservice { @@ -51,7 +49,7 @@ class DATASERVICE_READ_API VersionsRequest final { * @return A reference to the updated `VersionsRequest` instance. * */ - inline VersionsRequest& WithStartVersion(std::int64_t version) { + VersionsRequest& WithStartVersion(std::int64_t version) { start_version_ = version; return *this; } @@ -63,7 +61,7 @@ class DATASERVICE_READ_API VersionsRequest final { * @return The catalog metadata start version. * */ - inline std::int64_t GetStartVersion() const { return start_version_; } + std::int64_t GetStartVersion() const { return start_version_; } /** * @brief Sets the catalog metadata end version. @@ -79,7 +77,7 @@ class DATASERVICE_READ_API VersionsRequest final { * @return A reference to the updated `VersionsRequest` instance. * */ - inline VersionsRequest& WithEndVersion(std::int64_t version) { + VersionsRequest& WithEndVersion(std::int64_t version) { end_version_ = version; return *this; } @@ -91,7 +89,7 @@ class DATASERVICE_READ_API VersionsRequest final { * @return The catalog metadata end version. * */ - inline std::int64_t GetEndVersion() const { return end_version_; } + std::int64_t GetEndVersion() const { return end_version_; } /** * @brief Gets the billing tag to group billing records together. @@ -100,10 +98,10 @@ class DATASERVICE_READ_API VersionsRequest final { * billing records together. If supplied, it must be 4–16 characters * long and contain only alphanumeric ASCII characters [A-Za-z0-9]. * - * @return The `BillingTag` string or `boost::none` if the billing tag is not - * set. + * @return The `BillingTag` string or `olp::porting::none` if the billing tag + * is not set. */ - inline const boost::optional& GetBillingTag() const { + const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -112,12 +110,13 @@ class DATASERVICE_READ_API VersionsRequest final { * * @see `GetBillingTag()` for information on usage and format. * - * @param tag The `BillingTag` string or `boost::none`. + * @param tag The `BillingTag` string or `olp::porting::none`. * * @return A reference to the updated `VersionsRequest` instance. */ - inline VersionsRequest& WithBillingTag(boost::optional tag) { - billing_tag_ = std::move(tag); + template > + VersionsRequest& WithBillingTag(T&& tag) { + billing_tag_ = std::forward(tag); return *this; } @@ -127,11 +126,11 @@ class DATASERVICE_READ_API VersionsRequest final { * @see `GetBillingTag()` for information on usage and format. * * @param tag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * `olp::porting::none`. * * @return A reference to the updated `VersionsRequest` instance. */ - inline VersionsRequest& WithBillingTag(std::string tag) { + VersionsRequest& WithBillingTag(std::string tag) { billing_tag_ = std::move(tag); return *this; } @@ -141,21 +140,21 @@ class DATASERVICE_READ_API VersionsRequest final { * * @return A string representation of the request. */ - inline std::string CreateKey() const { + std::string CreateKey() const { std::stringstream out; out << "["; out << GetStartVersion() << ", " << GetEndVersion(); out << "]"; if (GetBillingTag()) { - out << "$" << GetBillingTag().get(); + out << "$" << *GetBillingTag(); } return out.str(); } private: - std::int64_t start_version_; - std::int64_t end_version_; - boost::optional billing_tag_; + std::int64_t start_version_ = -1; + std::int64_t end_version_ = -1; + porting::optional billing_tag_; }; } // namespace read diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Catalog.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Catalog.h index 5cf2e7509..0f41a7985 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Catalog.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Catalog.h @@ -22,8 +22,7 @@ #include #include -#include - +#include #include namespace olp { @@ -736,7 +735,7 @@ class DATASERVICE_READ_API Layer { std::string digest_; std::vector tags_; std::vector billing_tags_; - boost::optional ttl_; + porting::optional ttl_; IndexProperties index_properties_; StreamProperties stream_properties_; Volume volume_; @@ -1070,7 +1069,7 @@ class DATASERVICE_READ_API Layer { * * @return The expiry time (in milliseconds) for data in this layer. */ - const boost::optional& GetTtl() const { return ttl_; } + const porting::optional& GetTtl() const { return ttl_; } /** * @brief Gets a mutable reference to the expiry time for data in this layer. * @@ -1079,7 +1078,7 @@ class DATASERVICE_READ_API Layer { * @return The mutable reference to the expiry time for data in * this layer. */ - boost::optional& GetMutableTtl() { return ttl_; } + porting::optional& GetMutableTtl() { return ttl_; } /** * @brief Sets the expiry time for data in this layer. * @@ -1087,7 +1086,7 @@ class DATASERVICE_READ_API Layer { * * @param value The expiry time for data in this layer. */ - void SetTtl(const boost::optional& value) { this->ttl_ = value; } + void SetTtl(const porting::optional& value) { this->ttl_ = value; } /** * @brief Gets the `IndexProperties` instance. diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Messages.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Messages.h index 401bc45ca..0e8045a7b 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Messages.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Messages.h @@ -20,11 +20,10 @@ #pragma once #include -#include #include +#include -#include - +#include #include #include #include @@ -66,7 +65,9 @@ class DATASERVICE_READ_API Metadata final { * * @return The checksum of the content. */ - const boost::optional& GetChecksum() const { return checksum_; } + const porting::optional& GetChecksum() const { + return checksum_; + } /** * @brief (Optional) Sets the checksum of this metadata content. * @@ -74,7 +75,7 @@ class DATASERVICE_READ_API Metadata final { * * @param value The checksum string. */ - void SetChecksum(boost::optional value) { + void SetChecksum(porting::optional value) { checksum_ = std::move(value); } @@ -87,7 +88,7 @@ class DATASERVICE_READ_API Metadata final { * * @return The compressed size of the content (in bytes). */ - const boost::optional& GetCompressedDataSize() const { + const porting::optional& GetCompressedDataSize() const { return compressed_data_size_; } /** @@ -98,7 +99,7 @@ class DATASERVICE_READ_API Metadata final { * * @param value The compressed size of the content (in bytes). */ - void SetCompressedDataSize(boost::optional value) { + void SetCompressedDataSize(porting::optional value) { compressed_data_size_ = value; } @@ -112,7 +113,7 @@ class DATASERVICE_READ_API Metadata final { * * @return The data size in bytes. */ - const boost::optional& GetDataSize() const { return data_size_; } + const porting::optional& GetDataSize() const { return data_size_; } /** * @brief (Optional) Sets the nominal size of the content. * @@ -120,7 +121,7 @@ class DATASERVICE_READ_API Metadata final { * * @param value The nominal size of the content in bytes. */ - void SetDataSize(boost::optional value) { data_size_ = value; } + void SetDataSize(porting::optional value) { data_size_ = value; } /** * @brief Gets the data of this `Metadata` instance. @@ -153,7 +154,7 @@ class DATASERVICE_READ_API Metadata final { * * @return The data handle created when the content was uploaded. */ - const boost::optional& GetDataHandle() const { + const porting::optional& GetDataHandle() const { return data_handle_; } @@ -164,7 +165,7 @@ class DATASERVICE_READ_API Metadata final { * * @param value The data handle represented as a string. */ - void SetDataHandle(boost::optional value) { + void SetDataHandle(porting::optional value) { data_handle_ = std::move(value); } @@ -176,7 +177,7 @@ class DATASERVICE_READ_API Metadata final { * * @return The Unix timestamp of the content (in milliseconds). */ - const boost::optional& GetTimestamp() const { return timestamp_; } + const porting::optional& GetTimestamp() const { return timestamp_; } /** * @brief (Optional) Sets the timestamp of the content. * @@ -184,16 +185,16 @@ class DATASERVICE_READ_API Metadata final { * * @param value The Unix timestamp of the content (in milliseconds). */ - void SetTimestamp(boost::optional value) { timestamp_ = value; } + void SetTimestamp(porting::optional value) { timestamp_ = value; } private: Data data_; std::string partition_; - boost::optional compressed_data_size_; - boost::optional data_size_; - boost::optional timestamp_; - boost::optional checksum_; - boost::optional data_handle_; + porting::optional compressed_data_size_; + porting::optional data_size_; + porting::optional timestamp_; + porting::optional checksum_; + porting::optional data_handle_; }; /** diff --git a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Partitions.h b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Partitions.h index b0364e55a..22ca70351 100644 --- a/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Partitions.h +++ b/olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/model/Partitions.h @@ -23,8 +23,7 @@ #include #include -#include - +#include #include namespace olp { @@ -45,13 +44,13 @@ class DATASERVICE_READ_API Partition { virtual ~Partition() = default; private: - boost::optional checksum_; - boost::optional compressed_data_size_; + porting::optional checksum_; + porting::optional compressed_data_size_; std::string data_handle_; - boost::optional data_size_; - boost::optional crc_; + porting::optional data_size_; + porting::optional crc_; std::string partition_; - boost::optional version_; + porting::optional version_; public: /** @@ -66,7 +65,9 @@ class DATASERVICE_READ_API Partition { * * @return The partition checksum. */ - const boost::optional& GetChecksum() const { return checksum_; } + const porting::optional& GetChecksum() const { + return checksum_; + } /** * @brief (Optional) Gets a mutable reference to the partition checksum. * @@ -74,7 +75,7 @@ class DATASERVICE_READ_API Partition { * * @return The mutable reference to the partition checksum. */ - boost::optional& GetMutableChecksum() { return checksum_; } + porting::optional& GetMutableChecksum() { return checksum_; } /** * @brief (Optional) Sets the partition checksum. * @@ -82,7 +83,7 @@ class DATASERVICE_READ_API Partition { * * @param value The partition checksum. */ - void SetChecksum(boost::optional value) { + void SetChecksum(porting::optional value) { this->checksum_ = std::move(value); } @@ -97,7 +98,7 @@ class DATASERVICE_READ_API Partition { * * @return The compressed size of the partition data. */ - const boost::optional& GetCompressedDataSize() const { + const porting::optional& GetCompressedDataSize() const { return compressed_data_size_; } /** @@ -109,7 +110,7 @@ class DATASERVICE_READ_API Partition { * * @return The mutable reference to the compressed size of the partition data. */ - boost::optional& GetMutableCompressedDataSize() { + porting::optional& GetMutableCompressedDataSize() { return compressed_data_size_; } /** @@ -120,7 +121,7 @@ class DATASERVICE_READ_API Partition { * * @param value The compressed size of the partition data. */ - void SetCompressedDataSize(boost::optional value) { + void SetCompressedDataSize(porting::optional value) { this->compressed_data_size_ = value; } @@ -166,7 +167,7 @@ class DATASERVICE_READ_API Partition { * * @return The uncompressed size of the partition data */ - const boost::optional& GetDataSize() const { return data_size_; } + const porting::optional& GetDataSize() const { return data_size_; } /** * @brief (Optional) Gets a mutable reference to the uncompressed size of * the partition data in bytes. @@ -177,7 +178,7 @@ class DATASERVICE_READ_API Partition { * @return The mutable reference to the uncompressed size of the partition * data. */ - boost::optional& GetMutableDataSize() { return data_size_; } + porting::optional& GetMutableDataSize() { return data_size_; } /** * @brief (Optional) Sets the uncompressed size of the partition data. * @@ -186,7 +187,9 @@ class DATASERVICE_READ_API Partition { * * @param value The uncompressed size of the partition data. */ - void SetDataSize(boost::optional value) { this->data_size_ = value; } + void SetDataSize(porting::optional value) { + this->data_size_ = value; + } /** * Optional value for the CRC of the partition data in bytes. @@ -197,7 +200,7 @@ class DATASERVICE_READ_API Partition { * * @return The partition CRC. */ - const boost::optional& GetCrc() const { return crc_; } + const porting::optional& GetCrc() const { return crc_; } /** * @brief (Optional) Gets a mutable reference to the partition crc. * @@ -205,7 +208,7 @@ class DATASERVICE_READ_API Partition { * * @return The mutable reference to the partition crc. */ - boost::optional& GetMutableCrc() { return crc_; } + porting::optional& GetMutableCrc() { return crc_; } /** * @brief (Optional) Sets the partition crc. * @@ -213,7 +216,7 @@ class DATASERVICE_READ_API Partition { * * @param value The partition crc. */ - void SetCrc(boost::optional value) { + void SetCrc(porting::optional value) { this->crc_ = std::move(value); } @@ -255,7 +258,7 @@ class DATASERVICE_READ_API Partition { * * @return The version of the catalog when this partition was last changed. */ - const boost::optional& GetVersion() const { return version_; } + const porting::optional& GetVersion() const { return version_; } /** * @brief (Optional) Gets a mutable reference to the version of the catalog * when this partition was last changed. @@ -265,7 +268,7 @@ class DATASERVICE_READ_API Partition { * @return The mutable reference to the version of the catalog when this * partition was last changed. */ - boost::optional& GetMutableVersion() { return version_; } + porting::optional& GetMutableVersion() { return version_; } /** * @brief (Optional) Sets the partition version. * @@ -274,7 +277,7 @@ class DATASERVICE_READ_API Partition { * @param value The version of the catalog when this partition was last * changed. */ - void SetVersion(boost::optional value) { this->version_ = value; } + void SetVersion(porting::optional value) { this->version_ = value; } }; /** diff --git a/olp-cpp-sdk-dataservice-read/src/StreamLayerClientImpl.cpp b/olp-cpp-sdk-dataservice-read/src/StreamLayerClientImpl.cpp index 84dcca0bc..c7221efb5 100644 --- a/olp-cpp-sdk-dataservice-read/src/StreamLayerClientImpl.cpp +++ b/olp-cpp-sdk-dataservice-read/src/StreamLayerClientImpl.cpp @@ -101,8 +101,8 @@ client::CancellationToken StreamLayerClientImpl::Subscribe( kLogTag, "Subscribe: started, subscription_id=%s, consumer_id=%s, " "subscription_mode=%s", - request.GetSubscriptionId().get_value_or("none").c_str(), - request.GetConsumerId().get_value_or("none").c_str(), + olp::porting::value_or(request.GetSubscriptionId(), "none").c_str(), + olp::porting::value_or(request.GetConsumerId(), "none").c_str(), subscription_mode.c_str()); auto stream_api = lookup_client_.LookupApi( @@ -262,7 +262,7 @@ client::CancellationToken StreamLayerClientImpl::GetData( const auto blob_response = BlobApi::GetBlob(blob_api.GetResult(), layer_id_, partition, - boost::none, boost::none, context); + olp::porting::none, olp::porting::none, context); OLP_SDK_LOG_INFO_F(kLogTag, "GetData: done, blob_response is successful: %s", diff --git a/olp-cpp-sdk-dataservice-read/src/TaskSink.h b/olp-cpp-sdk-dataservice-read/src/TaskSink.h index ed8b65df9..f0ee7b578 100644 --- a/olp-cpp-sdk-dataservice-read/src/TaskSink.h +++ b/olp-cpp-sdk-dataservice-read/src/TaskSink.h @@ -19,11 +19,10 @@ #pragma once -#include - #include #include #include +#include #include namespace olp { @@ -55,14 +54,14 @@ class TaskSink { } template - boost::optional AddTaskChecked(Function task, - Callback callback, - uint32_t priority, - Args&&... args) { + porting::optional AddTaskChecked(Function task, + Callback callback, + uint32_t priority, + Args&&... args) { auto context = client::TaskContext::Create( std::move(task), std::move(callback), std::forward(args)...); if (!AddTaskImpl(context, priority)) { - return boost::none; + return olp::porting::none; } return context.CancelToken(); } diff --git a/olp-cpp-sdk-dataservice-read/src/VersionedLayerClient.cpp b/olp-cpp-sdk-dataservice-read/src/VersionedLayerClient.cpp index 575f0186a..3084b217d 100644 --- a/olp-cpp-sdk-dataservice-read/src/VersionedLayerClient.cpp +++ b/olp-cpp-sdk-dataservice-read/src/VersionedLayerClient.cpp @@ -28,7 +28,7 @@ namespace read { VersionedLayerClient::VersionedLayerClient( client::HRN catalog, std::string layer_id, - boost::optional catalog_version, + porting::optional catalog_version, client::OlpClientSettings settings) : impl_(std::make_unique( std::move(catalog), std::move(layer_id), std::move(catalog_version), diff --git a/olp-cpp-sdk-dataservice-read/src/VersionedLayerClientImpl.cpp b/olp-cpp-sdk-dataservice-read/src/VersionedLayerClientImpl.cpp index 7ec167c61..e1d44e582 100644 --- a/olp-cpp-sdk-dataservice-read/src/VersionedLayerClientImpl.cpp +++ b/olp-cpp-sdk-dataservice-read/src/VersionedLayerClientImpl.cpp @@ -61,13 +61,12 @@ constexpr auto kQuadTreeDepth = 4; VersionedLayerClientImpl::VersionedLayerClientImpl( client::HRN catalog, std::string layer_id, - boost::optional catalog_version, + porting::optional catalog_version, client::OlpClientSettings settings) : catalog_(std::move(catalog)), layer_id_(std::move(layer_id)), settings_(std::move(settings)), - catalog_version_(catalog_version ? catalog_version.get() - : kInvalidVersion), + catalog_version_(catalog_version ? *catalog_version : kInvalidVersion), lookup_client_(catalog_, settings_), task_sink_(settings_.task_scheduler) { if (!settings_.cache) { @@ -120,7 +119,7 @@ client::CancellationToken VersionedLayerClientImpl::StreamLayerPartitions( auto request_task = [=](const client::CancellationContext& context) -> client::ApiNoResponse { auto version_response = - GetVersion(boost::none, FetchOptions::OnlineIfNotFound, context); + GetVersion(olp::porting::none, FetchOptions::OnlineIfNotFound, context); if (!version_response.IsSuccessful()) { async_stream->CloseStream(version_response.GetError()); return version_response.GetError(); @@ -609,7 +608,8 @@ VersionedLayerClientImpl::PrefetchTiles( } CatalogVersionResponse VersionedLayerClientImpl::GetVersion( - boost::optional billing_tag, const FetchOptions& fetch_options, + porting::optional billing_tag, + const FetchOptions& fetch_options, const client::CancellationContext& context) { auto version = catalog_version_.load(); if (version != kInvalidVersion) { @@ -696,7 +696,7 @@ client::ApiNoResponse VersionedLayerClientImpl::DeleteFromCache( return client::ApiError::PreconditionFailed("Version is not initialized"); } - boost::optional partition; + porting::optional partition; repository::PartitionsCacheRepository partitions_cache_repository( catalog_, layer_id_, settings_.cache); @@ -712,8 +712,7 @@ client::ApiNoResponse VersionedLayerClientImpl::DeleteFromCache( repository::DataCacheRepository data_cache_repository(catalog_, settings_.cache); - return data_cache_repository.Clear(layer_id_, - partition.get().GetDataHandle()); + return data_cache_repository.Clear(layer_id_, partition->GetDataHandle()); } client::ApiNoResponse VersionedLayerClientImpl::DeleteFromCache( diff --git a/olp-cpp-sdk-dataservice-read/src/VersionedLayerClientImpl.h b/olp-cpp-sdk-dataservice-read/src/VersionedLayerClientImpl.h index 971d9a95d..24ef9fe89 100644 --- a/olp-cpp-sdk-dataservice-read/src/VersionedLayerClientImpl.h +++ b/olp-cpp-sdk-dataservice-read/src/VersionedLayerClientImpl.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -35,7 +36,6 @@ #include #include #include -#include #include "TaskSink.h" #include "repositories/NamedMutex.h" @@ -53,7 +53,7 @@ class PrefetchTilesRepository; class VersionedLayerClientImpl { public: VersionedLayerClientImpl(client::HRN catalog, std::string layer_id, - boost::optional catalog_version, + porting::optional catalog_version, client::OlpClientSettings settings); virtual ~VersionedLayerClientImpl() = default; @@ -129,7 +129,7 @@ class VersionedLayerClientImpl { virtual bool Release(const std::vector& partition_ids); private: - CatalogVersionResponse GetVersion(boost::optional billing_tag, + CatalogVersionResponse GetVersion(porting::optional billing_tag, const FetchOptions& fetch_options, const client::CancellationContext& context); diff --git a/olp-cpp-sdk-dataservice-read/src/VolatileLayerClientImpl.cpp b/olp-cpp-sdk-dataservice-read/src/VolatileLayerClientImpl.cpp index 4dbb93aec..9508f0717 100644 --- a/olp-cpp-sdk-dataservice-read/src/VolatileLayerClientImpl.cpp +++ b/olp-cpp-sdk-dataservice-read/src/VolatileLayerClientImpl.cpp @@ -142,9 +142,9 @@ client::ApiNoResponse VolatileLayerClientImpl::DeleteFromCache( const std::string& partition_id) { repository::PartitionsCacheRepository cache_repository(catalog_, layer_id_, settings_.cache); - boost::optional partition; + porting::optional partition; auto clear_response = cache_repository.ClearPartitionMetadata( - partition_id, boost::none, partition); + partition_id, olp::porting::none, partition); if (!clear_response) { return clear_response; } @@ -155,7 +155,7 @@ client::ApiNoResponse VolatileLayerClientImpl::DeleteFromCache( } repository::DataCacheRepository data_repository(catalog_, settings_.cache); - return data_repository.Clear(layer_id_, partition.get().GetDataHandle()); + return data_repository.Clear(layer_id_, partition->GetDataHandle()); } client::ApiNoResponse VolatileLayerClientImpl::DeleteFromCache( @@ -199,7 +199,8 @@ client::CancellationToken VolatileLayerClientImpl::PrefetchTiles( return; } - OLP_SDK_LOG_DEBUG_F(kLogTag, "PrefetchTiles: using key=%s", key.c_str()); + OLP_SDK_LOG_DEBUG_F(kLogTag, "PrefetchTiles: using key=%s", + key.c_str()); // Calculate the minimal set of Tile keys and depth to // cover tree. diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/BlobApi.cpp b/olp-cpp-sdk-dataservice-read/src/generated/api/BlobApi.cpp index 2e8f7d565..cb15747f6 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/BlobApi.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/BlobApi.cpp @@ -33,8 +33,9 @@ namespace read { BlobApi::DataResponse BlobApi::GetBlob( const client::OlpClient& client, const std::string& layer_id, - const model::Partition& partition, boost::optional billing_tag, - boost::optional range, + const model::Partition& partition, + porting::optional billing_tag, + porting::optional range, const client::CancellationContext& context) { std::multimap header_params; header_params.emplace("Accept", "application/json"); diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/BlobApi.h b/olp-cpp-sdk-dataservice-read/src/generated/api/BlobApi.h index 450ee8bdd..399b58309 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/BlobApi.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/BlobApi.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include "ExtendedApiResponse.h" #include "olp/dataservice/read/model/Data.h" #include "olp/dataservice/read/model/Partitions.h" @@ -68,8 +68,8 @@ class BlobApi { static DataResponse GetBlob(const client::OlpClient& client, const std::string& layer_id, const model::Partition& partition, - boost::optional billing_tag, - boost::optional range, + porting::optional billing_tag, + porting::optional range, const client::CancellationContext& context); }; diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/ConfigApi.cpp b/olp-cpp-sdk-dataservice-read/src/generated/api/ConfigApi.cpp index 64ebfa046..1cdf0a6ab 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/ConfigApi.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/ConfigApi.cpp @@ -35,7 +35,7 @@ namespace read { ConfigApi::CatalogResponse ConfigApi::GetCatalog( const client::OlpClient& client, const std::string& catalog_hrn, - boost::optional billing_tag, + porting::optional billing_tag, client::CancellationContext context) { std::multimap header_params; header_params.insert(std::make_pair("Accept", "application/json")); @@ -50,9 +50,11 @@ ConfigApi::CatalogResponse ConfigApi::GetCatalog( std::move(catalog_uri), "GET", std::move(query_params), std::move(header_params), {}, nullptr, std::string{}, std::move(context)); if (response.GetStatus() != olp::http::HttpStatusCode::OK) { - return client::ApiError(response.GetStatus(), response.GetResponseAsString()); + return client::ApiError(response.GetStatus(), + response.GetResponseAsString()); } - return parser::parse_result(response.GetRawResponse()); + return parser::parse_result( + response.GetRawResponse()); } } // namespace read diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/ConfigApi.h b/olp-cpp-sdk-dataservice-read/src/generated/api/ConfigApi.h index 9b91dd9ee..308b87f96 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/ConfigApi.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/ConfigApi.h @@ -19,13 +19,13 @@ #pragma once -#include #include #include #include #include #include +#include #include "olp/dataservice/read/model/Catalog.h" namespace olp { @@ -56,7 +56,7 @@ class ConfigApi { */ static CatalogResponse GetCatalog(const client::OlpClient& client, const std::string& catalog_hrn, - boost::optional billing_tag, + porting::optional billing_tag, client::CancellationContext context); }; diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.cpp b/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.cpp index 9e10447f6..2e391725d 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.cpp @@ -60,7 +60,7 @@ namespace read { MetadataApi::LayerVersionsResponse MetadataApi::GetLayerVersions( const client::OlpClient& client, std::int64_t version, - boost::optional billing_tag, + porting::optional billing_tag, const client::CancellationContext& context) { std::multimap header_params; header_params.emplace("Accept", "application/json"); @@ -78,18 +78,20 @@ MetadataApi::LayerVersionsResponse MetadataApi::GetLayerVersions( {}, nullptr, "", context); if (api_response.GetStatus() != http::HttpStatusCode::OK) { - return client::ApiError(api_response.GetStatus(), api_response.GetResponseAsString()); + return client::ApiError(api_response.GetStatus(), + api_response.GetResponseAsString()); } - return parser::parse_result(api_response.GetRawResponse()); + return parser::parse_result( + api_response.GetRawResponse()); } MetadataApi::PartitionsExtendedResponse MetadataApi::GetPartitions( const client::OlpClient& client, const std::string& layer_id, - boost::optional version, + porting::optional version, const std::vector& additional_fields, - boost::optional range, - boost::optional billing_tag, + porting::optional range, + porting::optional billing_tag, const client::CancellationContext& context) { std::multimap header_params; header_params.emplace("Accept", "application/json"); @@ -117,7 +119,8 @@ MetadataApi::PartitionsExtendedResponse MetadataApi::GetPartitions( if (http_response.GetStatus() != olp::http::HttpStatusCode::OK) { return PartitionsExtendedResponse( - client::ApiError(http_response.GetStatus(), http_response.GetResponseAsString()), + client::ApiError(http_response.GetStatus(), + http_response.GetResponseAsString()), http_response.GetNetworkStatistics()); } @@ -138,10 +141,10 @@ MetadataApi::PartitionsExtendedResponse MetadataApi::GetPartitions( client::HttpResponse MetadataApi::GetPartitionsStream( const client::OlpClient& client, const std::string& layer_id, - boost::optional version, + porting::optional version, const std::vector& additional_fields, - boost::optional range, - boost::optional billing_tag, + porting::optional range, + porting::optional billing_tag, http::Network::DataCallback data_callback, const client::CancellationContext& context) { std::multimap header_params; @@ -171,7 +174,7 @@ client::HttpResponse MetadataApi::GetPartitionsStream( MetadataApi::CatalogVersionResponse MetadataApi::GetLatestCatalogVersion( const client::OlpClient& client, std::int64_t startVersion, - boost::optional billing_tag, + porting::optional billing_tag, const client::CancellationContext& context) { std::multimap header_params; header_params.emplace("Accept", "application/json"); @@ -192,12 +195,13 @@ MetadataApi::CatalogVersionResponse MetadataApi::GetLatestCatalogVersion( return {{api_response.GetStatus(), api_response.GetResponseAsString()}}; } - return parser::parse_result(api_response.GetRawResponse()); + return parser::parse_result( + api_response.GetRawResponse()); } MetadataApi::VersionsResponse MetadataApi::ListVersions( const client::OlpClient& client, std::int64_t start_version, - std::int64_t end_version, boost::optional billing_tag, + std::int64_t end_version, porting::optional billing_tag, const client::CancellationContext& context) { std::multimap header_params; header_params.emplace("Accept", "application/json"); diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.h b/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.h index 562e771b5..24044d7d0 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/MetadataApi.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "ExtendedApiResponse.h" #include "generated/model/LayerVersions.h" #include "olp/dataservice/read/model/Partitions.h" @@ -78,7 +78,7 @@ class MetadataApi { */ static LayerVersionsResponse GetLayerVersions( const client::OlpClient& client, int64_t version, - boost::optional billing_tag, + porting::optional billing_tag, const client::CancellationContext& context); /** @@ -106,10 +106,10 @@ class MetadataApi { */ static PartitionsExtendedResponse GetPartitions( const client::OlpClient& client, const std::string& layer_id, - boost::optional version, + porting::optional version, const std::vector& additional_fields, - boost::optional range, - boost::optional billing_tag, + porting::optional range, + porting::optional billing_tag, const client::CancellationContext& context); /** @@ -138,10 +138,10 @@ class MetadataApi { */ static client::HttpResponse GetPartitionsStream( const client::OlpClient& client, const std::string& layer_id, - boost::optional version, + porting::optional version, const std::vector& additional_fields, - boost::optional range, - boost::optional billing_tag, + porting::optional range, + porting::optional billing_tag, http::Network::DataCallback data_callback, const client::CancellationContext& context); @@ -161,12 +161,12 @@ class MetadataApi { */ static CatalogVersionResponse GetLatestCatalogVersion( const client::OlpClient& client, int64_t start_version, - boost::optional billing_tag, + porting::optional billing_tag, const client::CancellationContext& context); static VersionsResponse ListVersions( const client::OlpClient& client, int64_t start_version, - int64_t end_version, boost::optional billing_tag, + int64_t end_version, porting::optional billing_tag, const client::CancellationContext& context); static CompatibleVersionsResponse GetCompatibleVersions( diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/QueryApi.cpp b/olp-cpp-sdk-dataservice-read/src/generated/api/QueryApi.cpp index 848d5295a..30aab1a1f 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/QueryApi.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/QueryApi.cpp @@ -62,9 +62,9 @@ namespace read { QueryApi::PartitionsExtendedResponse QueryApi::GetPartitionsbyId( const client::OlpClient& client, const std::string& layer_id, const std::vector& partitions, - boost::optional version, + porting::optional version, const std::vector& additional_fields, - boost::optional billing_tag, + porting::optional billing_tag, client::CancellationContext context) { std::multimap header_params; header_params.insert(std::make_pair("Accept", "application/json")); @@ -94,9 +94,9 @@ QueryApi::PartitionsExtendedResponse QueryApi::GetPartitionsbyId( layer_id.c_str(), http_response.GetStatus()); if (http_response.GetStatus() != olp::http::HttpStatusCode::OK) { - return { - client::ApiError(http_response.GetStatus(), http_response.GetResponseAsString()), - http_response.GetNetworkStatistics()}; + return {client::ApiError(http_response.GetStatus(), + http_response.GetResponseAsString()), + http_response.GetNetworkStatistics()}; } using PartitionsResponse = client::ApiResponse; @@ -115,9 +115,9 @@ QueryApi::PartitionsExtendedResponse QueryApi::GetPartitionsbyId( olp::client::HttpResponse QueryApi::QuadTreeIndex( const client::OlpClient& client, const std::string& layer_id, - const std::string& quad_key, boost::optional version, + const std::string& quad_key, porting::optional version, int32_t depth, const std::vector& additional_fields, - boost::optional billing_tag, + porting::optional billing_tag, client::CancellationContext context) { std::multimap header_params; header_params.emplace("Accept", "application/json"); @@ -133,8 +133,8 @@ olp::client::HttpResponse QueryApi::QuadTreeIndex( std::string metadata_uri = "/layers/" + layer_id + - (version ? "/versions/" + std::to_string(version.get()) : "") + - "/quadkeys/" + quad_key + "/depths/" + std::to_string(depth); + (version ? "/versions/" + std::to_string(*version) : "") + "/quadkeys/" + + quad_key + "/depths/" + std::to_string(depth); return client.CallApi(metadata_uri, "GET", std::move(query_params), std::move(header_params), {}, nullptr, std::string{}, @@ -144,8 +144,8 @@ olp::client::HttpResponse QueryApi::QuadTreeIndex( QueryApi::QuadTreeIndexResponse QueryApi::QuadTreeIndexVolatile( const client::OlpClient& client, const std::string& layer_id, const std::string& quad_key, int32_t depth, - boost::optional> additional_fields, - boost::optional billing_tag, + porting::optional> additional_fields, + porting::optional billing_tag, client::CancellationContext context) { std::multimap header_params; header_params.insert(std::make_pair("Accept", "application/json")); @@ -169,7 +169,8 @@ QueryApi::QuadTreeIndexResponse QueryApi::QuadTreeIndexVolatile( OLP_SDK_LOG_DEBUG_F(kLogTag, "QuadTreeIndex, uri=%s, status=%d", metadata_uri.c_str(), response.GetStatus()); if (response.GetStatus() != olp::http::HttpStatusCode::OK) { - return client::ApiError(response.GetStatus(), response.GetResponseAsString()); + return client::ApiError(response.GetStatus(), + response.GetResponseAsString()); } return parser::parse_result(response.GetRawResponse()); diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/QueryApi.h b/olp-cpp-sdk-dataservice-read/src/generated/api/QueryApi.h index cb59bb44e..1b6126361 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/QueryApi.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/QueryApi.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include "ExtendedApiResponse.h" #include "generated/model/Index.h" #include "olp/dataservice/read/model/Partitions.h" @@ -75,9 +75,9 @@ class QueryApi { static PartitionsExtendedResponse GetPartitionsbyId( const client::OlpClient& client, const std::string& layer_id, const std::vector& partitions, - boost::optional version, + porting::optional version, const std::vector& additional_fields, - boost::optional billing_tag, + porting::optional billing_tag, client::CancellationContext context); /** @@ -111,9 +111,9 @@ class QueryApi { **/ static olp::client::HttpResponse QuadTreeIndex( const client::OlpClient& client, const std::string& layer_id, - const std::string& quad_key, boost::optional version, + const std::string& quad_key, porting::optional version, int32_t depth, const std::vector& additional_fields, - boost::optional billing_tag, + porting::optional billing_tag, client::CancellationContext context); /** @@ -147,8 +147,8 @@ class QueryApi { static QuadTreeIndexResponse QuadTreeIndexVolatile( const client::OlpClient& client, const std::string& layer_id, const std::string& quad_key, int32_t depth, - boost::optional> additional_fields, - boost::optional billing_tag, + porting::optional> additional_fields, + porting::optional billing_tag, client::CancellationContext context); }; diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/StreamApi.cpp b/olp-cpp-sdk-dataservice-read/src/generated/api/StreamApi.cpp index 78aba6f97..16923d277 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/StreamApi.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/StreamApi.cpp @@ -62,24 +62,24 @@ namespace read { StreamApi::SubscribeApiResponse StreamApi::Subscribe( const client::OlpClient& client, const std::string& layer_id, - const boost::optional& subscription_id, - const boost::optional& mode, - const boost::optional& consumer_id, - const boost::optional& subscription_properties, + const porting::optional& subscription_id, + const porting::optional& mode, + const porting::optional& consumer_id, + const porting::optional& subscription_properties, const client::CancellationContext& context, std::string& x_correlation_id) { const std::string metadata_uri = "/layers/" + layer_id + "/subscribe"; std::multimap query_params; if (subscription_id) { - query_params.emplace("subscriptionId", subscription_id.get()); + query_params.emplace("subscriptionId", *subscription_id); } if (mode) { - query_params.emplace("mode", mode.get()); + query_params.emplace("mode", *mode); } if (consumer_id) { - query_params.emplace("consumerId", consumer_id.get()); + query_params.emplace("consumerId", *consumer_id); } std::multimap header_params; @@ -88,7 +88,7 @@ StreamApi::SubscribeApiResponse StreamApi::Subscribe( model::Data data; if (subscription_properties) { const auto serialized_subscription_properties = - serializer::serialize(subscription_properties.get()); + serializer::serialize(*subscription_properties); data = std::make_shared>( serialized_subscription_properties.begin(), serialized_subscription_properties.end()); @@ -98,30 +98,32 @@ StreamApi::SubscribeApiResponse StreamApi::Subscribe( metadata_uri, "POST", std::move(query_params), std::move(header_params), {}, data, "application/json", context); if (http_response.GetStatus() != http::HttpStatusCode::CREATED) { - return client::ApiError(http_response.GetStatus(), http_response.GetResponseAsString()); + return client::ApiError(http_response.GetStatus(), + http_response.GetResponseAsString()); } OLP_SDK_LOG_DEBUG_F(kLogTag, "subscribe, uri=%s, status=%d", metadata_uri.c_str(), http_response.GetStatus()); HandleCorrelationId(http_response.GetHeaders(), x_correlation_id); - return parser::parse_result(http_response.GetRawResponse()); + return parser::parse_result( + http_response.GetRawResponse()); } StreamApi::ConsumeDataApiResponse StreamApi::ConsumeData( const client::OlpClient& client, const std::string& layer_id, - const boost::optional& subscription_id, - const boost::optional& mode, + const porting::optional& subscription_id, + const porting::optional& mode, const client::CancellationContext& context, std::string& x_correlation_id) { const std::string metadata_uri = "/layers/" + layer_id + "/partitions"; std::multimap query_params; if (subscription_id) { - query_params.emplace("subscriptionId", subscription_id.get()); + query_params.emplace("subscriptionId", *subscription_id); } if (mode) { - query_params.emplace("mode", mode.get()); + query_params.emplace("mode", *mode); } std::multimap header_params; @@ -132,21 +134,23 @@ StreamApi::ConsumeDataApiResponse StreamApi::ConsumeData( metadata_uri, "GET", std::move(query_params), std::move(header_params), {}, nullptr, std::string{}, context); if (http_response.GetStatus() != http::HttpStatusCode::OK) { - return client::ApiError(http_response.GetStatus(), http_response.GetResponseAsString()); + return client::ApiError(http_response.GetStatus(), + http_response.GetResponseAsString()); } OLP_SDK_LOG_DEBUG_F(kLogTag, "consumeData, uri=%s, status=%d", metadata_uri.c_str(), http_response.GetStatus()); HandleCorrelationId(http_response.GetHeaders(), x_correlation_id); - return parser::parse_result(http_response.GetRawResponse()); + return parser::parse_result( + http_response.GetRawResponse()); } StreamApi::CommitOffsetsApiResponse StreamApi::CommitOffsets( const client::OlpClient& client, const std::string& layer_id, const model::StreamOffsets& commit_offsets, - const boost::optional& subscription_id, - const boost::optional& mode, + const porting::optional& subscription_id, + const porting::optional& mode, const client::CancellationContext& context, std::string& x_correlation_id) { return HandleOffsets(client, layer_id, commit_offsets, subscription_id, mode, context, "offsets", x_correlation_id); @@ -155,8 +159,8 @@ StreamApi::CommitOffsetsApiResponse StreamApi::CommitOffsets( StreamApi::SeekToOffsetApiResponse StreamApi::SeekToOffset( const client::OlpClient& client, const std::string& layer_id, const model::StreamOffsets& seek_offsets, - const boost::optional& subscription_id, - const boost::optional& mode, + const porting::optional& subscription_id, + const porting::optional& mode, const client::CancellationContext& context, std::string& x_correlation_id) { return HandleOffsets(client, layer_id, seek_offsets, subscription_id, mode, context, "seek", x_correlation_id); @@ -183,7 +187,8 @@ StreamApi::UnsubscribeApiResponse StreamApi::DeleteSubscription( metadata_uri, "DELETE", std::move(query_params), std::move(header_params), {}, nullptr, std::string{}, context); if (http_response.GetStatus() != http::HttpStatusCode::OK) { - return client::ApiError(http_response.GetStatus(), http_response.GetResponseAsString()); + return client::ApiError(http_response.GetStatus(), + http_response.GetResponseAsString()); } OLP_SDK_LOG_DEBUG_F(kLogTag, "deleteSubscription, uri=%s, status=%d", @@ -195,19 +200,19 @@ StreamApi::UnsubscribeApiResponse StreamApi::DeleteSubscription( Response StreamApi::HandleOffsets( const client::OlpClient& client, const std::string& layer_id, const model::StreamOffsets& offsets, - const boost::optional& subscription_id, - const boost::optional& mode, + const porting::optional& subscription_id, + const porting::optional& mode, const client::CancellationContext& context, const std::string& endpoint, std::string& x_correlation_id) { const std::string metadata_uri = "/layers/" + layer_id + "/" + endpoint; std::multimap query_params; if (subscription_id) { - query_params.emplace("subscriptionId", subscription_id.get()); + query_params.emplace("subscriptionId", *subscription_id); } if (mode) { - query_params.emplace("mode", mode.get()); + query_params.emplace("mode", *mode); } std::multimap header_params; @@ -222,7 +227,8 @@ Response StreamApi::HandleOffsets( metadata_uri, "PUT", std::move(query_params), std::move(header_params), {}, data, "application/json", context); if (http_response.GetStatus() != http::HttpStatusCode::OK) { - return client::ApiError(http_response.GetStatus(), http_response.GetResponseAsString()); + return client::ApiError(http_response.GetStatus(), + http_response.GetResponseAsString()); } OLP_SDK_LOG_DEBUG_F(kLogTag, "handleOffsets, uri=%s, status=%d", diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/StreamApi.h b/olp-cpp-sdk-dataservice-read/src/generated/api/StreamApi.h index 43d41ce88..35939d1ad 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/StreamApi.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/StreamApi.h @@ -21,9 +21,9 @@ #include -#include #include #include +#include #include #include #include @@ -99,10 +99,10 @@ class StreamApi { */ static SubscribeApiResponse Subscribe( const client::OlpClient& client, const std::string& layer_id, - const boost::optional& subscription_id, - const boost::optional& mode, - const boost::optional& consumer_id, - const boost::optional& subscription_properties, + const porting::optional& subscription_id, + const porting::optional& mode, + const porting::optional& consumer_id, + const porting::optional& subscription_properties, const client::CancellationContext& context, std::string& x_correlation_id); @@ -136,8 +136,8 @@ class StreamApi { */ static ConsumeDataApiResponse ConsumeData( const client::OlpClient& client, const std::string& layer_id, - const boost::optional& subscription_id, - const boost::optional& mode, + const porting::optional& subscription_id, + const porting::optional& mode, const client::CancellationContext& context, std::string& x_correlation_id); @@ -178,8 +178,8 @@ class StreamApi { static CommitOffsetsApiResponse CommitOffsets( const client::OlpClient& client, const std::string& layer_id, const model::StreamOffsets& commit_offsets, - const boost::optional& subscription_id, - const boost::optional& mode, + const porting::optional& subscription_id, + const porting::optional& mode, const client::CancellationContext& context, std::string& x_correlation_id); @@ -215,8 +215,8 @@ class StreamApi { static SeekToOffsetApiResponse SeekToOffset( const client::OlpClient& client, const std::string& layer_id, const model::StreamOffsets& seek_offsets, - const boost::optional& subscription_id, - const boost::optional& mode, + const porting::optional& subscription_id, + const porting::optional& mode, const client::CancellationContext& context, std::string& x_correlation_id); @@ -252,8 +252,8 @@ class StreamApi { static Response HandleOffsets( const client::OlpClient& client, const std::string& layer_id, const model::StreamOffsets& offsets, - const boost::optional& subscription_id, - const boost::optional& mode, + const porting::optional& subscription_id, + const porting::optional& mode, const client::CancellationContext& context, const std::string& endpoint, std::string& x_correlation_id); }; diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/VolatileBlobApi.cpp b/olp-cpp-sdk-dataservice-read/src/generated/api/VolatileBlobApi.cpp index eb9aeeed2..95e28b975 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/VolatileBlobApi.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/VolatileBlobApi.cpp @@ -32,7 +32,7 @@ namespace read { VolatileBlobApi::DataResponse VolatileBlobApi::GetVolatileBlob( const client::OlpClient& client, const std::string& layer_id, - const std::string& data_handle, boost::optional billing_tag, + const std::string& data_handle, porting::optional billing_tag, const client::CancellationContext& context) { std::multimap header_params; header_params.insert(std::make_pair("Accept", "application/json")); @@ -48,9 +48,9 @@ VolatileBlobApi::DataResponse VolatileBlobApi::GetVolatileBlob( form_params, nullptr, "", context); if (api_response.GetStatus() != http::HttpStatusCode::OK) { - return DataResponse( - client::ApiError(api_response.GetStatus(), api_response.GetResponseAsString()), - api_response.GetNetworkStatistics()); + return DataResponse(client::ApiError(api_response.GetStatus(), + api_response.GetResponseAsString()), + api_response.GetNetworkStatistics()); } auto result = std::make_shared>(); diff --git a/olp-cpp-sdk-dataservice-read/src/generated/api/VolatileBlobApi.h b/olp-cpp-sdk-dataservice-read/src/generated/api/VolatileBlobApi.h index dc9b5ad29..db70273c2 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/api/VolatileBlobApi.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/api/VolatileBlobApi.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include "olp/dataservice/read/model/Data.h" #include "ExtendedApiResponse.h" @@ -58,7 +58,8 @@ class VolatileBlobApi { */ static DataResponse GetVolatileBlob( const client::OlpClient& client, const std::string& layer_id, - const std::string& data_handle, boost::optional billing_tag, + const std::string& data_handle, + porting::optional billing_tag, const client::CancellationContext& context); }; diff --git a/olp-cpp-sdk-dataservice-read/src/generated/model/Index.h b/olp-cpp-sdk-dataservice-read/src/generated/model/Index.h index 7f86d2864..32126b247 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/model/Index.h +++ b/olp-cpp-sdk-dataservice-read/src/generated/model/Index.h @@ -19,11 +19,12 @@ #pragma once -#include #include #include #include +#include + namespace olp { namespace dataservice { namespace read { @@ -39,11 +40,11 @@ class ParentQuad { virtual ~ParentQuad() = default; private: - boost::optional additional_metadata_; - boost::optional checksum_; - boost::optional compressed_data_size_; + porting::optional additional_metadata_; + porting::optional checksum_; + porting::optional compressed_data_size_; std::string data_handle_; - boost::optional data_size_; + porting::optional data_size_; std::string partition_; int64_t version_{0}; @@ -52,11 +53,11 @@ class ParentQuad { * @brief Optional value for the additional metadata specified by the * publisher **/ - boost::optional GetAdditionalMetadata() const { + porting::optional GetAdditionalMetadata() const { return additional_metadata_; } - void SetAdditionalMetadata(boost::optional value) { + void SetAdditionalMetadata(porting::optional value) { additional_metadata_ = value; } @@ -69,9 +70,9 @@ class ParentQuad { * for this catalog. The maximum length of the checksum field is 128 * characters. */ - boost::optional GetChecksum() const { return checksum_; } + porting::optional GetChecksum() const { return checksum_; } - void SetChecksum(boost::optional value) { checksum_ = value; } + void SetChecksum(porting::optional value) { checksum_ = value; } /** * @brief Optional value for the size of the compressed partition data in @@ -81,10 +82,10 @@ class ParentQuad { *`compressedDataSize` was specified in the partition metadata when *it was published. **/ - boost::optional GetCompressedDataSize() const { + porting::optional GetCompressedDataSize() const { return compressed_data_size_; } - void SetCompressedDataSize(boost::optional value) { + void SetCompressedDataSize(porting::optional value) { compressed_data_size_ = value; } @@ -104,8 +105,8 @@ class ParentQuad { * `additionalFields` query parameter, and if `dataSize` * was specified in the partition metadata when it was published. **/ - boost::optional GetDataSize() const { return data_size_; } - void SetDataSize(boost::optional value) { data_size_ = value; } + porting::optional GetDataSize() const { return data_size_; } + void SetDataSize(porting::optional value) { data_size_ = value; } /** * @brief The id of the tile @@ -130,11 +131,11 @@ class SubQuad { virtual ~SubQuad() = default; private: - boost::optional additional_metadata_; - boost::optional checksum_; - boost::optional compressed_data_size_; + porting::optional additional_metadata_; + porting::optional checksum_; + porting::optional compressed_data_size_; std::string data_handle_; - boost::optional data_size_; + porting::optional data_size_; std::string sub_quad_key_; int64_t version_{0}; @@ -143,11 +144,11 @@ class SubQuad { * @brief Optional value for the additional meta-data specified by the * publisher. **/ - boost::optional GetAdditionalMetadata() const { + porting::optional GetAdditionalMetadata() const { return additional_metadata_; } - void SetAdditionalMetadata(boost::optional value) { + void SetAdditionalMetadata(porting::optional value) { additional_metadata_ = value; } @@ -161,9 +162,9 @@ class SubQuad { * data comparison needs to work for this catalog. The maximum length of * checksum field is 128 characters. **/ - boost::optional GetChecksum() const { return checksum_; } + porting::optional GetChecksum() const { return checksum_; } - void SetChecksum(boost::optional value) { checksum_ = value; } + void SetChecksum(porting::optional value) { checksum_ = value; } /** * @brief @@ -174,10 +175,10 @@ class SubQuad { * request, and if the request for the commit of the partition specifies * compressedDataSize. **/ - boost::optional GetCompressedDataSize() const { + porting::optional GetCompressedDataSize() const { return compressed_data_size_; } - void SetCompressedDataSize(boost::optional value) { + void SetCompressedDataSize(porting::optional value) { compressed_data_size_ = value; } @@ -201,8 +202,8 @@ class SubQuad { * this information if you specify the dataSize field in the requested, and * if the request for the commit of the partition specifies dataSize. **/ - boost::optional GetDataSize() const { return data_size_; } - void SetDataSize(boost::optional value) { data_size_ = value; } + porting::optional GetDataSize() const { return data_size_; } + void SetDataSize(porting::optional value) { data_size_ = value; } /** * @brief diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.cpp index aad08dcef..33d39c1fa 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/CatalogParser.cpp @@ -23,7 +23,7 @@ namespace olp { namespace parser { -using namespace olp::dataservice::read; +namespace model = dataservice::read::model; void from_json(const rapidjson::Value& value, model::Coverage& x) { x.SetAdminAreas(parse>(value, "adminAreas")); @@ -96,7 +96,7 @@ void from_json(const rapidjson::Value& value, model::Layer& x) { x.SetDigest(parse(value, "digest")); x.SetTags(parse>(value, "tags")); x.SetBillingTags(parse>(value, "billingTags")); - x.SetTtl(parse>(value, "ttl")); + x.SetTtl(parse>(value, "ttl")); x.SetIndexProperties(parse(value, "indexProperties")); x.SetStreamProperties( parse(value, "streamProperties")); diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.cpp index 6737d6d80..d9cfe81ab 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/IndexParser.cpp @@ -23,23 +23,23 @@ namespace olp { namespace parser { -using namespace olp::dataservice::read; +namespace model = dataservice::read::model; void from_json(const rapidjson::Value& value, std::shared_ptr& x) { auto quad = std::make_shared(); quad->SetAdditionalMetadata( - parse>(value, "additionalMetadata")); + parse>(value, "additionalMetadata")); - quad->SetChecksum(parse>(value, "checksum")); + quad->SetChecksum(parse>(value, "checksum")); quad->SetCompressedDataSize( - parse>(value, "compressedDataSize")); + parse>(value, "compressedDataSize")); quad->SetDataHandle(parse(value, "dataHandle")); - quad->SetDataSize(parse>(value, "dataSize")); + quad->SetDataSize(parse>(value, "dataSize")); quad->SetSubQuadKey(parse(value, "subQuadKey")); quad->SetVersion(parse(value, "version")); @@ -52,16 +52,16 @@ void from_json(const rapidjson::Value& value, auto quad = std::make_shared(); quad->SetAdditionalMetadata( - parse>(value, "additionalMetadata")); + parse>(value, "additionalMetadata")); - quad->SetChecksum(parse>(value, "checksum")); + quad->SetChecksum(parse>(value, "checksum")); quad->SetCompressedDataSize( - parse>(value, "compressedDataSize")); + parse>(value, "compressedDataSize")); quad->SetDataHandle(parse(value, "dataHandle")); - quad->SetDataSize(parse>(value, "dataSize")); + quad->SetDataSize(parse>(value, "dataSize")); quad->SetPartition(parse(value, "partition")); quad->SetVersion(parse(value, "version")); diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.cpp index 138e2b98f..67ec4793a 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/MessagesParser.cpp @@ -26,17 +26,17 @@ namespace olp { namespace parser { -using namespace olp::dataservice::read; +namespace model = dataservice::read::model; void from_json(const rapidjson::Value& value, model::Metadata& x) { x.SetPartition(parse(value, "partition")); - x.SetChecksum(parse>(value, "checksum")); + x.SetChecksum(parse>(value, "checksum")); x.SetCompressedDataSize( - parse>(value, "compressedDataSize")); - x.SetDataSize(parse>(value, "dataSize")); + parse>(value, "compressedDataSize")); + x.SetDataSize(parse>(value, "dataSize")); x.SetData(parse(value, "data")); - x.SetDataHandle(parse>(value, "dataHandle")); - x.SetTimestamp(parse>(value, "timestamp")); + x.SetDataHandle(parse>(value, "dataHandle")); + x.SetTimestamp(parse>(value, "timestamp")); } void from_json(const rapidjson::Value& value, model::Message& x) { diff --git a/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.cpp b/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.cpp index ca924c20c..b09c7a370 100644 --- a/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.cpp +++ b/olp-cpp-sdk-dataservice-read/src/generated/parser/PartitionsParser.cpp @@ -23,21 +23,22 @@ namespace olp { namespace parser { -using namespace olp::dataservice::read; +using dataservice::read::model::Partition; +using dataservice::read::model::Partitions; -void from_json(const rapidjson::Value& value, model::Partition& x) { - x.SetChecksum(parse>(value, "checksum")); +void from_json(const rapidjson::Value& value, Partition& x) { + x.SetChecksum(parse>(value, "checksum")); x.SetCompressedDataSize( - parse>(value, "compressedDataSize")); + parse>(value, "compressedDataSize")); x.SetDataHandle(parse(value, "dataHandle")); - x.SetDataSize(parse>(value, "dataSize")); - x.SetCrc(parse>(value, "crc")); + x.SetDataSize(parse>(value, "dataSize")); + x.SetCrc(parse>(value, "crc")); x.SetPartition(parse(value, "partition")); - x.SetVersion(parse>(value, "version")); + x.SetVersion(parse>(value, "version")); } -void from_json(const rapidjson::Value& value, model::Partitions& x) { - x.SetPartitions(parse>(value, "partitions")); +void from_json(const rapidjson::Value& value, Partitions& x) { + x.SetPartitions(parse>(value, "partitions")); } } // namespace parser diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/ApiCacheRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/ApiCacheRepository.cpp index 1b04e5bd7..3291b4017 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/ApiCacheRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/ApiCacheRepository.cpp @@ -46,7 +46,7 @@ void ApiCacheRepository::Put(const std::string& service, cache_->Put(key, url, [&]() { return url; }, kLookupApiExpiryTime); } -boost::optional ApiCacheRepository::Get( +porting::optional ApiCacheRepository::Get( const std::string& service, const std::string& version) { const std::string hrn(hrn_.ToCatalogHRNString()); const auto key = cache::KeyGenerator::CreateApiKey(hrn, service, version); @@ -54,7 +54,7 @@ boost::optional ApiCacheRepository::Get( auto url = cache_->Get(key, [](const std::string& value) { return value; }); if (url.empty()) { - return boost::none; + return olp::porting::none; } return boost::any_cast(url); diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/ApiCacheRepository.h b/olp-cpp-sdk-dataservice-read/src/repositories/ApiCacheRepository.h index 2449cbccb..3a72fad35 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/ApiCacheRepository.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/ApiCacheRepository.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include namespace olp { @@ -43,8 +43,8 @@ class ApiCacheRepository final { void Put(const std::string& service, const std::string& version, const std::string& url); - boost::optional Get(const std::string& service, - const std::string& version); + porting::optional Get(const std::string& service, + const std::string& version); private: client::HRN hrn_; diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.cpp index 959a01013..a2e0f05e7 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.cpp @@ -100,7 +100,7 @@ void AsyncJsonStream::ResetStream(const char* content, size_t length) { current_stream_->AppendContent(content, length); } -void AsyncJsonStream::CloseStream(boost::optional error) { +void AsyncJsonStream::CloseStream(porting::optional error) { std::unique_lock lock(mutex_); if (closed_) { return; @@ -110,7 +110,7 @@ void AsyncJsonStream::CloseStream(boost::optional error) { closed_ = true; } -boost::optional AsyncJsonStream::GetError() const { +porting::optional AsyncJsonStream::GetError() const { std::unique_lock lock(mutex_); return error_; } diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.h b/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.h index 863d1e78e..ae1f57ba6 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/AsyncJsonStream.h @@ -23,9 +23,8 @@ #include #include -#include - #include +#include namespace olp { namespace dataservice { @@ -79,16 +78,16 @@ class AsyncJsonStream { void ResetStream(const char* content, size_t length); - void CloseStream(boost::optional error); + void CloseStream(porting::optional error); - boost::optional GetError() const; + porting::optional GetError() const; bool IsClosed() const; private: mutable std::mutex mutex_; std::shared_ptr current_stream_; - boost::optional error_; + porting::optional error_; bool closed_; }; diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.cpp index 90e3cb304..3e9844c40 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.cpp @@ -64,7 +64,7 @@ bool CatalogCacheRepository::Put(const model::Catalog& catalog) { default_expiry_); } -boost::optional CatalogCacheRepository::Get() { +porting::optional CatalogCacheRepository::Get() { const std::string hrn(hrn_.ToCatalogHRNString()); const auto key = cache::KeyGenerator::CreateCatalogKey(hrn); OLP_SDK_LOG_TRACE_F(kLogTag, "Get -> '%s'", key.c_str()); @@ -74,7 +74,7 @@ boost::optional CatalogCacheRepository::Get() { }); if (cached_catalog.empty()) { - return boost::none; + return olp::porting::none; } return boost::any_cast(cached_catalog); @@ -90,7 +90,7 @@ bool CatalogCacheRepository::PutVersion(const model::VersionResponse& version) { default_expiry_); } -boost::optional CatalogCacheRepository::GetVersion() { +porting::optional CatalogCacheRepository::GetVersion() { const std::string hrn(hrn_.ToCatalogHRNString()); const auto key = cache::KeyGenerator::CreateLatestVersionKey(hrn); OLP_SDK_LOG_TRACE_F(kLogTag, "GetVersion -> '%s'", key.c_str()); @@ -100,7 +100,7 @@ boost::optional CatalogCacheRepository::GetVersion() { }); if (cached_version.empty()) { - return boost::none; + return olp::porting::none; } return boost::any_cast(cached_version); } diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.h b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.h index e5159d84d..dd9462881 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogCacheRepository.h @@ -23,9 +23,9 @@ #include #include +#include #include #include -#include namespace olp { namespace cache { @@ -45,11 +45,11 @@ class CatalogCacheRepository final { bool Put(const model::Catalog& catalog); - boost::optional Get(); + porting::optional Get(); bool PutVersion(const model::VersionResponse& version); - boost::optional GetVersion(); + porting::optional GetVersion(); bool Clear(); diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.cpp index 3623be5c4..c55a2635f 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.cpp @@ -215,7 +215,7 @@ VersionsResponse CatalogRepository::GetVersionsList( } CatalogVersionResponse CatalogRepository::GetLatestVersionOnline( - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext context) { auto metadata_api = lookup_client_.LookupApi( "metadata", "v1", client::OnlineIfNotFound, context); diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.h b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.h index 1aeb6e88c..51e14cc32 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/CatalogRepository.h @@ -58,7 +58,7 @@ class CatalogRepository final { private: CatalogVersionResponse GetLatestVersionOnline( - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext context); client::HRN catalog_; diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/DataCacheRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/DataCacheRepository.cpp index 30bb40d6a..7c4fad0bc 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/DataCacheRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/DataCacheRepository.cpp @@ -63,7 +63,7 @@ client::ApiNoResponse DataCacheRepository::Put(const model::Data& data, return {client::ApiNoResult{}}; } -boost::optional DataCacheRepository::Get( +porting::optional DataCacheRepository::Get( const std::string& layer_id, const std::string& data_handle) { const auto key = cache::KeyGenerator::CreateDataHandleKey(hrn_, layer_id, data_handle); @@ -71,7 +71,7 @@ boost::optional DataCacheRepository::Get( auto cached_data = cache_->Get(key); if (!cached_data) { - return boost::none; + return olp::porting::none; } return cached_data; diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/DataCacheRepository.h b/olp-cpp-sdk-dataservice-read/src/repositories/DataCacheRepository.h index 599d46868..695513dac 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/DataCacheRepository.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/DataCacheRepository.h @@ -24,8 +24,8 @@ #include #include +#include #include -#include namespace olp { namespace cache { @@ -47,8 +47,8 @@ class DataCacheRepository final { const std::string& layer_id, const std::string& data_handle); - boost::optional Get(const std::string& layer_id, - const std::string& data_handle); + porting::optional Get(const std::string& layer_id, + const std::string& data_handle); bool IsCached(const std::string& layer_id, const std::string& data_handle) const; diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.cpp index 498c57d1d..9a0daf204 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.cpp @@ -118,7 +118,7 @@ BlobApi::DataResponse DataRepository::GetVersionedData( OLP_SDK_LOG_INFO_F( kLogTag, "GetVersionedData partition %s not found, hrn='%s', key='%s'", - request.GetPartitionId() ? request.GetPartitionId().get().c_str() + request.GetPartitionId() ? request.GetPartitionId()->c_str() : "", catalog_.ToCatalogHRNString().c_str(), request.CreateKey(layer_id, version).c_str()); @@ -147,7 +147,7 @@ BlobApi::DataResponse DataRepository::GetVersionedData( BlobApi::DataResponse DataRepository::GetBlobData( const std::string& layer, const std::string& service, const model::Partition& partition, FetchOptions fetch_option, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext context, const bool fail_on_cache_error) { const auto& data_handle = partition.GetDataHandle(); if (data_handle.empty()) { @@ -210,7 +210,7 @@ BlobApi::DataResponse DataRepository::GetBlobData( if (service == kBlobService) { storage_response = BlobApi::GetBlob(storage_api_lookup.GetResult(), layer, partition, - billing_tag, boost::none, context); + billing_tag, olp::porting::none, context); } else { auto volatile_blob = VolatileBlobApi::GetVolatileBlob(storage_api_lookup.GetResult(), layer, @@ -264,7 +264,7 @@ BlobApi::DataResponse DataRepository::GetVolatileData( PartitionsRepository repository(catalog_, layer_id, settings_, lookup_client_, storage_); auto partitions_response = - repository.GetPartitionById(request, boost::none, context); + repository.GetPartitionById(request, olp::porting::none, context); if (!partitions_response.IsSuccessful()) { return partitions_response.GetError(); @@ -276,10 +276,10 @@ BlobApi::DataResponse DataRepository::GetVolatileData( if (partitions.empty()) { OLP_SDK_LOG_INFO_F( kLogTag, "GetVolatileData partition %s not found, hrn='%s', key='%s'", - request.GetPartitionId() ? request.GetPartitionId().get().c_str() + request.GetPartitionId() ? request.GetPartitionId()->c_str() : "", catalog_.ToCatalogHRNString().c_str(), - request.CreateKey(layer_id, boost::none).c_str()); + request.CreateKey(layer_id, olp::porting::none).c_str()); return client::ApiError::NotFound("Partition not found"); } diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.h b/olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.h index 306465836..290086661 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/DataRepository.h @@ -60,7 +60,7 @@ class DataRepository final { BlobApi::DataResponse GetBlobData( const std::string& layer, const std::string& service, const model::Partition& partition, FetchOptions fetch_option, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext context, bool fail_on_cache_error); private: diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/NamedMutex.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/NamedMutex.cpp index 4ba094053..409bf71b2 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/NamedMutex.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/NamedMutex.cpp @@ -35,13 +35,13 @@ class NamedMutexStorage::Impl { std::condition_variable& GetLockCondition(const std::string& resource); std::mutex& GetLockMutex(const std::string& resource); void SetError(const std::string& resource, const client::ApiError& error); - boost::optional GetError(const std::string& resource); + porting::optional GetError(const std::string& resource); private: struct RefCounterMutex { std::mutex mutex; uint32_t use_count{0u}; - boost::optional optional_error; + porting::optional optional_error; std::condition_variable lock_condition; std::mutex lock_mutex; }; @@ -92,12 +92,12 @@ void NamedMutexStorage::Impl::SetError(const std::string& resource, } } -boost::optional NamedMutexStorage::Impl::GetError( +porting::optional NamedMutexStorage::Impl::GetError( const std::string& resource) { std::lock_guard lock(mutex_); auto mutex_it = mutexes_.find(resource); if (mutex_it == mutexes_.end()) { - return boost::none; + return olp::porting::none; } return mutex_it->second.optional_error; @@ -127,7 +127,7 @@ void NamedMutexStorage::SetError(const std::string& resource, impl_->SetError(resource, error); } -boost::optional NamedMutexStorage::GetError( +porting::optional NamedMutexStorage::GetError( const std::string& resource) { return impl_->GetError(resource); } @@ -179,7 +179,7 @@ void NamedMutex::SetError(const client::ApiError& error) { storage_.SetError(name_, error); } -boost::optional NamedMutex::GetError() { +porting::optional NamedMutex::GetError() { return storage_.GetError(name_); } diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/NamedMutex.h b/olp-cpp-sdk-dataservice-read/src/repositories/NamedMutex.h index 6c3bedd5b..1c24804ed 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/NamedMutex.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/NamedMutex.h @@ -28,7 +28,7 @@ #include #include -#include +#include namespace olp { namespace dataservice { @@ -63,10 +63,10 @@ class NamedMutexStorage { * * @param resource A name of a mutex to get an error for. * - * @return The stored `ApiError` instance or `boost::none` if no error has - * been stored for this resource. + * @return The stored `ApiError` instance or `olp::porting::none` if no error + * has been stored for this resource. */ - boost::optional GetError(const std::string& resource); + porting::optional GetError(const std::string& resource); private: class Impl; @@ -106,10 +106,10 @@ class NamedMutex final { /** * @brief Gets the stored error for this mutex. * - * @return The stored `ApiError` instance or `boost::none` if no error has - * been stored for this mutex. + * @return The stored `ApiError` instance or `olp::porting::none` if no error + * has been stored for this mutex. */ - boost::optional GetError(); + porting::optional GetError(); private: /// Notify waiting threads method. diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.cpp index 8904027fa..46b5f89a1 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.cpp @@ -65,8 +65,8 @@ PartitionsCacheRepository::PartitionsCacheRepository( client::ApiNoResponse PartitionsCacheRepository::Put( const model::Partitions& partitions, - const boost::optional& version, - const boost::optional& expiry, bool layer_metadata) { + const porting::optional& version, + const porting::optional& expiry, bool layer_metadata) { const auto& partitions_list = partitions.GetPartitions(); std::vector partition_ids; partition_ids.reserve(partitions_list.size()); @@ -78,7 +78,7 @@ client::ApiNoResponse PartitionsCacheRepository::Put( const auto put_result = cache_->Write(key, serializer::serialize_bytes(partition), - expiry.get_value_or(default_expiry_)); + porting::value_or(expiry, default_expiry_)); if (!put_result) { OLP_SDK_LOG_ERROR_F(kLogTag, "Failed to write -> '%s'", key.c_str()); @@ -97,7 +97,7 @@ client::ApiNoResponse PartitionsCacheRepository::Put( const auto put_result = cache_->Write(key, serializer::serialize_bytes(partition_ids), - expiry.get_value_or(default_expiry_)); + porting::value_or(expiry, default_expiry_)); if (!put_result) { OLP_SDK_LOG_ERROR_F(kLogTag, "Failed to write -> '%s'", key.c_str()); @@ -110,7 +110,7 @@ client::ApiNoResponse PartitionsCacheRepository::Put( model::Partitions PartitionsCacheRepository::Get( const std::vector& partition_ids, - const boost::optional& version) { + const porting::optional& version) { model::Partitions cached_partitions_model; auto& cached_partitions = cached_partitions_model.GetMutablePartitions(); cached_partitions.reserve(partition_ids.size()); @@ -132,11 +132,12 @@ model::Partitions PartitionsCacheRepository::Get( return cached_partitions_model; } -boost::optional PartitionsCacheRepository::Get( - const PartitionsRequest& request, const boost::optional& version) { +porting::optional PartitionsCacheRepository::Get( + const PartitionsRequest& request, + const porting::optional& version) { const auto key = cache::KeyGenerator::CreatePartitionsKey(catalog_, layer_id_, version); - boost::optional partitions; + porting::optional partitions; const auto& partition_ids = request.GetPartitionIds(); if (partition_ids.empty()) { @@ -146,14 +147,14 @@ boost::optional PartitionsCacheRepository::Get( parser::parse>(read_response.GetResult()); partitions = Get(cached_ids, version); } else { - partitions = boost::none; + partitions = olp::porting::none; } } else { auto available_partitions = Get(partition_ids, version); // In the case when not all partitions are available, we fail the cache // lookup. This can be enhanced in the future. if (available_partitions.GetPartitions().size() != partition_ids.size()) { - partitions = boost::none; + partitions = olp::porting::none; } else { partitions = std::move(available_partitions); } @@ -173,7 +174,7 @@ bool PartitionsCacheRepository::Put( default_expiry_); } -boost::optional PartitionsCacheRepository::Get( +porting::optional PartitionsCacheRepository::Get( int64_t catalog_version) { const auto key = cache::KeyGenerator::CreateLayerVersionsKey(catalog_, catalog_version); @@ -185,7 +186,7 @@ boost::optional PartitionsCacheRepository::Get( }); if (cached_layer_versions.empty()) { - return boost::none; + return olp::porting::none; } return std::move( @@ -194,7 +195,7 @@ boost::optional PartitionsCacheRepository::Get( client::ApiNoResponse PartitionsCacheRepository::Put( geo::TileKey tile_key, int32_t depth, const QuadTreeIndex& quad_tree, - const boost::optional& version) { + const porting::optional& version) { const auto key = cache::KeyGenerator::CreateQuadTreeKey( catalog_, layer_id_, tile_key, version, depth); @@ -217,7 +218,7 @@ client::ApiNoResponse PartitionsCacheRepository::Put( } bool PartitionsCacheRepository::Get(geo::TileKey tile_key, int32_t depth, - const boost::optional& version, + const porting::optional& version, QuadTreeIndex& tree) { const auto key = cache::KeyGenerator::CreateQuadTreeKey( catalog_, layer_id_, tile_key, version, depth); @@ -240,7 +241,7 @@ bool PartitionsCacheRepository::Clear() { bool PartitionsCacheRepository::ClearPartitions( const std::vector& partition_ids, - const boost::optional& version) { + const porting::optional& version) { OLP_SDK_LOG_TRACE_F(kLogTag, "ClearPartitions -> '%s'", catalog_.c_str()); auto cached_partitions = Get(partition_ids, version); bool passed = true; @@ -260,7 +261,7 @@ bool PartitionsCacheRepository::ClearPartitions( client::ApiNoResponse PartitionsCacheRepository::ClearQuadTree( geo::TileKey tile_key, int32_t depth, - const boost::optional& version) { + const porting::optional& version) { const auto key = cache::KeyGenerator::CreateQuadTreeKey( catalog_, layer_id_, tile_key, version, depth); OLP_SDK_LOG_TRACE_F(kLogTag, "ClearQuadTree -> '%s'", key.c_str()); @@ -270,8 +271,8 @@ client::ApiNoResponse PartitionsCacheRepository::ClearQuadTree( client::ApiNoResponse PartitionsCacheRepository::ClearPartitionMetadata( const std::string& partition_id, - const boost::optional& catalog_version, - boost::optional& out_partition) { + const porting::optional& catalog_version, + porting::optional& out_partition) { const auto key = cache::KeyGenerator::CreatePartitionKey( catalog_, layer_id_, partition_id, catalog_version); OLP_SDK_LOG_TRACE_F(kLogTag, "ClearPartitionMetadata -> '%s'", key.c_str()); @@ -289,7 +290,8 @@ client::ApiNoResponse PartitionsCacheRepository::ClearPartitionMetadata( bool PartitionsCacheRepository::GetPartitionHandle( const std::string& partition_id, - const boost::optional& catalog_version, std::string& data_handle) { + const porting::optional& catalog_version, + std::string& data_handle) { const auto key = cache::KeyGenerator::CreatePartitionKey( catalog_, layer_id_, partition_id, catalog_version); OLP_SDK_LOG_TRACE_F(kLogTag, "IsPartitionCached -> '%s'", key.c_str()); @@ -304,7 +306,7 @@ bool PartitionsCacheRepository::GetPartitionHandle( } bool PartitionsCacheRepository::FindQuadTree(geo::TileKey key, - boost::optional version, + porting::optional version, read::QuadTreeIndex& tree) { auto max_depth = std::min(key.Level(), kMaxQuadTreeIndexDepth); for (int32_t i = max_depth; i >= 0; i--) { @@ -328,14 +330,15 @@ bool PartitionsCacheRepository::FindQuadTree(geo::TileKey key, bool PartitionsCacheRepository::ContainsTree( geo::TileKey key, int32_t depth, - const boost::optional& version) const { + const porting::optional& version) const { return cache_->Contains(cache::KeyGenerator::CreateQuadTreeKey( catalog_, layer_id_, key, version, depth)); } cache::KeyValueCache::KeyListType PartitionsCacheRepository::CreatePartitionKeys( - const std::string& partition_id, const boost::optional& version) { + const std::string& partition_id, + const porting::optional& version) { std::string handle; if (GetPartitionHandle(partition_id, version, handle)) { @@ -350,7 +353,7 @@ PartitionsCacheRepository::CreatePartitionKeys( bool PartitionsCacheRepository::Protect( const std::vector& partition_ids, - const boost::optional& version) { + const porting::optional& version) { cache::KeyValueCache::KeyListType keys; keys.reserve(partition_ids.size() * 2u); std::for_each(partition_ids.cbegin(), partition_ids.cend(), @@ -370,7 +373,7 @@ bool PartitionsCacheRepository::Protect( bool PartitionsCacheRepository::Release( const std::vector& partition_ids, - const boost::optional& version) { + const porting::optional& version) { cache::KeyValueCache::KeyListType keys; keys.reserve(partition_ids.size() * 2u); std::for_each(partition_ids.cbegin(), partition_ids.cend(), diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.h b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.h index 26b098bae..2f39b90a9 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsCacheRepository.h @@ -24,9 +24,9 @@ #include #include +#include #include #include -#include #include "QuadTreeIndex.h" #include "generated/model/LayerVersions.h" @@ -48,60 +48,62 @@ class PartitionsCacheRepository final { ~PartitionsCacheRepository() = default; client::ApiNoResponse Put(const model::Partitions& partitions, - const boost::optional& version, - const boost::optional& expiry, + const porting::optional& version, + const porting::optional& expiry, bool layer_metadata = false); model::Partitions Get(const std::vector& partition_ids, - const boost::optional& version); + const porting::optional& version); - boost::optional Get( + porting::optional Get( const PartitionsRequest& request, - const boost::optional& version); + const porting::optional& version); bool Put(int64_t catalog_version, const model::LayerVersions& layer_versions); - boost::optional Get(int64_t catalog_version); + porting::optional Get(int64_t catalog_version); client::ApiNoResponse Put(geo::TileKey tile_key, int32_t depth, const QuadTreeIndex& quad_tree, - const boost::optional& version); + const porting::optional& version); bool Get(geo::TileKey tile_key, int32_t depth, - const boost::optional& version, QuadTreeIndex& tree); + const porting::optional& version, QuadTreeIndex& tree); bool Clear(); bool ClearPartitions(const std::vector& partition_ids, - const boost::optional& version); + const porting::optional& version); - client::ApiNoResponse ClearQuadTree(geo::TileKey tile_key, int32_t depth, - const boost::optional& version); + client::ApiNoResponse ClearQuadTree( + geo::TileKey tile_key, int32_t depth, + const porting::optional& version); client::ApiNoResponse ClearPartitionMetadata( const std::string& partition_id, - const boost::optional& catalog_version, - boost::optional& out_partition); + const porting::optional& catalog_version, + porting::optional& out_partition); bool GetPartitionHandle(const std::string& partition_id, - const boost::optional& catalog_version, + const porting::optional& catalog_version, std::string& data_handle); - bool FindQuadTree(geo::TileKey key, boost::optional version, + bool FindQuadTree(geo::TileKey key, porting::optional version, read::QuadTreeIndex& tree); bool ContainsTree(geo::TileKey key, int32_t depth, - const boost::optional& version) const; + const porting::optional& version) const; bool Protect(const std::vector& partition_ids, - const boost::optional& version); + const porting::optional& version); bool Release(const std::vector& partition_ids, - const boost::optional& version); + const porting::optional& version); private: cache::KeyValueCache::KeyListType CreatePartitionKeys( - const std::string& partition_id, const boost::optional& version); + const std::string& partition_id, + const porting::optional& version); const std::string catalog_; const std::string layer_id_; diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.cpp index de36fff53..d80c9f090 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.cpp @@ -40,18 +40,16 @@ namespace { namespace client = olp::client; namespace read = olp::dataservice::read; -namespace model = olp::dataservice::read::model; -namespace repository = olp::dataservice::read::repository; +namespace model = read::model; +namespace repository = read::repository; constexpr auto kLogTag = "PartitionsRepository"; constexpr auto kAggregateQuadTreeDepth = 4; constexpr auto kQueryRequestLimit = 100; -using LayerVersionReponse = client::ApiResponse; -using LayerVersionCallback = std::function; - -client::ApiResponse, client::ApiError> TtlForLayer( - const std::vector& layers, const std::string& layer_id) { +client::ApiResponse, client::ApiError> +TtlForLayer(const std::vector& layers, + const std::string& layer_id) { auto layer_it = std::find_if( std::begin(layers), std::end(layers), [&](const model::Layer& layer) { return layer.GetId() == layer_id; }); @@ -62,10 +60,11 @@ client::ApiResponse, client::ApiError> TtlForLayer( auto ttl = layer_it->GetTtl(); - return ttl ? boost::make_optional(ttl.value() / 1000) : boost::none; + return ttl ? olp::porting::make_optional(ttl.value() / 1000) + : olp::porting::none; } -boost::optional FindPartition( +olp::porting::optional FindPartition( const read::QuadTreeIndex& quad_tree, const read::TileRequest& request, bool aggregated) { const auto& tile_key = request.GetTileKey(); @@ -80,10 +79,10 @@ boost::optional FindPartition( "', aggregated='%s'", tile_key.ToHereTile().c_str(), kAggregateQuadTreeDepth, aggregated ? "true" : "false"); - return boost::none; + return olp::porting::none; } - const auto& index_data = found_index_data.get(); + const auto& index_data = *found_index_data; model::Partition partition; partition.SetDataHandle(index_data.data_handle); @@ -115,7 +114,7 @@ std::string HashPartitions( /// Check if all the requested additional fields are cached bool CheckAdditionalFields( - const boost::optional>& additional_fields, + const olp::porting::optional>& additional_fields, const read::QuadTreeIndex& cached_tree) { if (!additional_fields) { return true; @@ -193,7 +192,7 @@ PartitionsRepository::GetVersionedPartitionsExtendedResponse( const read::PartitionsRequest& request, std::int64_t version, client::CancellationContext context, const bool fail_on_cache_error) { return GetPartitionsExtendedResponse(request, version, std::move(context), - boost::none, fail_on_cache_error); + olp::porting::none, fail_on_cache_error); } PartitionsResponse PartitionsRepository::GetVolatilePartitions( @@ -216,14 +215,14 @@ PartitionsResponse PartitionsRepository::GetVolatilePartitions( return expiry_response.GetError(); } - return GetPartitionsExtendedResponse(request, boost::none, context, + return GetPartitionsExtendedResponse(request, olp::porting::none, context, expiry_response.MoveResult()); } QueryApi::PartitionsExtendedResponse PartitionsRepository::GetPartitionsExtendedResponse( - const PartitionsRequest& request, boost::optional version, - client::CancellationContext context, boost::optional expiry, + const PartitionsRequest& request, porting::optional version, + client::CancellationContext context, porting::optional expiry, const bool fail_on_cache_error) { auto fetch_option = request.GetFetchOption(); const auto key = request.CreateKey(layer_id_); @@ -253,7 +252,7 @@ PartitionsRepository::GetPartitionsExtendedResponse( OLP_SDK_LOG_TRACE_F(kLogTag, "GetPartitions found in cache, hrn='%s', key='%s'", catalog_str.c_str(), key.c_str()); - return cached_partitions.get(); + return *cached_partitions; } else if (fetch_option == CacheOnly) { OLP_SDK_LOG_TRACE_F( kLogTag, "GetPartitions not found in cache, hrn='%s', key='%s'", @@ -274,10 +273,10 @@ PartitionsRepository::GetPartitionsExtendedResponse( return metadata_api.GetError(); } - response = - MetadataApi::GetPartitions(metadata_api.GetResult(), layer_id_, version, - request.GetAdditionalFields(), boost::none, - request.GetBillingTag(), context); + response = MetadataApi::GetPartitions( + metadata_api.GetResult(), layer_id_, version, + request.GetAdditionalFields(), olp::porting::none, + request.GetBillingTag(), context); } else { auto query_api = lookup_client_.LookupApi( "query", "v1", static_cast(fetch_option), @@ -331,7 +330,7 @@ PartitionsRepository::GetPartitionsExtendedResponse( } PartitionsResponse PartitionsRepository::GetPartitionById( - const DataRequest& request, boost::optional version, + const DataRequest& request, porting::optional version, client::CancellationContext context) { const auto& partition_id = request.GetPartitionId(); if (!partition_id) { @@ -385,7 +384,7 @@ PartitionsResponse PartitionsRepository::GetPartitionById( "GetPartitionById put to cache, hrn='%s', key='%s'", catalog_.ToCatalogHRNString().c_str(), key.c_str()); const auto put_result = - cache_.Put(query_response.GetResult(), version, boost::none); + cache_.Put(query_response.GetResult(), version, olp::porting::none); if (!put_result.IsSuccessful()) { OLP_SDK_LOG_ERROR_F(kLogTag, "GetPartitionById failed to write data to cache, " @@ -428,7 +427,7 @@ model::Partition PartitionsRepository::PartitionFromSubQuad( } QuadTreeIndexResponse PartitionsRepository::GetQuadTreeIndexForTile( - const TileRequest& request, boost::optional version, + const TileRequest& request, porting::optional version, client::CancellationContext context, const std::vector& required_fields) { static const std::vector default_additional_fields = { @@ -501,13 +500,13 @@ QuadTreeIndexResponse PartitionsRepository::GetQuadTreeIndexForTile( request.GetBillingTag(), context); if (quadtree_response.GetStatus() != olp::http::HttpStatusCode::OK) { - OLP_SDK_LOG_WARNING_F(kLogTag, - "GetQuadTreeIndexForTile QuadTreeIndex failed, " - "hrn='%s', layer='%s', root='%s', " - "version='%" PRId64 "', depth='%" PRId32 "'", - catalog_.ToString().c_str(), layer_id_.c_str(), - root_tile_here.c_str(), version.get_value_or(-1), - kAggregateQuadTreeDepth); + OLP_SDK_LOG_WARNING_F( + kLogTag, + "GetQuadTreeIndexForTile QuadTreeIndex failed, " + "hrn='%s', layer='%s', root='%s', " + "version='%" PRId64 "', depth='%" PRId32 "'", + catalog_.ToString().c_str(), layer_id_.c_str(), root_tile_here.c_str(), + olp::porting::value_or(version, -1), kAggregateQuadTreeDepth); return {client::ApiError(quadtree_response.GetStatus(), quadtree_response.GetResponseAsString()), quadtree_response.GetNetworkStatistics()}; @@ -521,7 +520,7 @@ QuadTreeIndexResponse PartitionsRepository::GetQuadTreeIndexForTile( "GetQuadTreeIndexForTile QuadTreeIndex failed, hrn='%s', layer='%s', " "root='%s', version='%" PRId64 "', depth='%" PRId32 "'", catalog_.ToString().c_str(), layer_id_.c_str(), root_tile_here.c_str(), - version.get_value_or(-1), kAggregateQuadTreeDepth); + olp::porting::value_or(version, -1), kAggregateQuadTreeDepth); return {client::ApiError::Unknown("Failed to parse quad tree response"), quadtree_response.GetNetworkStatistics()}; } @@ -543,7 +542,7 @@ QuadTreeIndexResponse PartitionsRepository::GetQuadTreeIndexForTile( } PartitionResponse PartitionsRepository::GetAggregatedTile( - TileRequest request, boost::optional version, + TileRequest request, porting::optional version, const client::CancellationContext& context) { auto quad_tree_response = GetQuadTreeIndexForTile(request, version, context, {}); @@ -581,7 +580,7 @@ PartitionResponse PartitionsRepository::GetAggregatedTile( } PartitionResponse PartitionsRepository::GetTile( - const TileRequest& request, boost::optional version, + const TileRequest& request, porting::optional version, client::CancellationContext context, const std::vector& required_fields) { auto quad_tree_response = GetQuadTreeIndexForTile( @@ -604,9 +603,9 @@ QueryApi::PartitionsExtendedResponse PartitionsRepository::QueryPartitionsInBatches( const client::OlpClient& client, const PartitionsRequest::PartitionIds& partition_ids, - boost::optional version, + porting::optional version, const PartitionsRequest::AdditionalFields& additional_fields, - boost::optional billing_tag, + olp::porting::optional billing_tag, client::CancellationContext context) { std::vector aggregated_partitions; aggregated_partitions.reserve(partition_ids.size()); @@ -688,7 +687,7 @@ client::ApiNoResponse PartitionsRepository::ParsePartitionsStream( void PartitionsRepository::StreamPartitions( const std::shared_ptr& async_stream, std::int64_t version, const std::vector& additional_fields, - boost::optional billing_tag, + porting::optional billing_tag, const client::CancellationContext& context) { auto metadata_api = lookup_client_.LookupApi( "metadata", "v1", client::FetchOptions::OnlineIfNotFound, context); @@ -711,12 +710,12 @@ void PartitionsRepository::StreamPartitions( auto http_response = MetadataApi::GetPartitionsStream( metadata_api.GetResult(), layer_id_, version, additional_fields, - boost::none, std::move(billing_tag), data_callback, context); + porting::none, std::move(billing_tag), data_callback, context); auto error = - http_response.GetStatus() != olp::http::HttpStatusCode::OK - ? boost::make_optional(client::ApiError(http_response.GetStatus())) - : boost::none; + http_response.GetStatus() != http::HttpStatusCode::OK + ? porting::make_optional(client::ApiError(http_response.GetStatus())) + : porting::none; async_stream->CloseStream(error); } diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.h b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.h index 0509aef47..6cfb4028d 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/PartitionsRepository.h @@ -68,18 +68,18 @@ class PartitionsRepository { client::CancellationContext context, bool fail_on_cache_error = false); PartitionsResponse GetPartitionById(const DataRequest& request, - boost::optional version, + porting::optional version, client::CancellationContext context); static model::Partition PartitionFromSubQuad(const model::SubQuad& sub_quad, const std::string& partition); PartitionResponse GetAggregatedTile( - TileRequest request, boost::optional version, + TileRequest request, porting::optional version, const client::CancellationContext& context); PartitionResponse GetTile(const TileRequest& request, - boost::optional version, + porting::optional version, client::CancellationContext context, const std::vector& required_fields); @@ -91,28 +91,28 @@ class PartitionsRepository { void StreamPartitions(const std::shared_ptr& async_stream, std::int64_t version, const std::vector& additional_fields, - boost::optional billing_tag, + porting::optional billing_tag, const client::CancellationContext& context); private: QuadTreeIndexResponse GetQuadTreeIndexForTile( - const TileRequest& request, boost::optional version, + const TileRequest& request, porting::optional version, client::CancellationContext context, const std::vector& required_fields); QueryApi::PartitionsExtendedResponse GetPartitionsExtendedResponse( const read::PartitionsRequest& request, - boost::optional version, + porting::optional version, client::CancellationContext context, - boost::optional expiry = boost::none, + porting::optional expiry = porting::none, bool fail_on_cache_error = false); QueryApi::PartitionsExtendedResponse QueryPartitionsInBatches( const client::OlpClient& client, const PartitionsRequest::PartitionIds& partitions, - boost::optional version, + porting::optional version, const PartitionsRequest::AdditionalFields& additional_fields, - boost::optional billing_tag, + porting::optional billing_tag, client::CancellationContext context); const client::HRN catalog_; diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/PrefetchTilesRepository.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/PrefetchTilesRepository.cpp index 1eb0ccc95..24289e8cb 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/PrefetchTilesRepository.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/PrefetchTilesRepository.cpp @@ -65,7 +65,7 @@ SubQuadsResult FlattenTree(const QuadTreeIndex& tree) { PrefetchTilesRepository::PrefetchTilesRepository( client::HRN catalog, std::string layer_id, client::OlpClientSettings settings, client::ApiLookupClient client, - boost::optional billing_tag, NamedMutexStorage storage) + porting::optional billing_tag, NamedMutexStorage storage) : catalog_(std::move(catalog)), catalog_str_(catalog_.ToString()), layer_id_(std::move(layer_id)), @@ -275,7 +275,7 @@ SubQuadsResponse PrefetchTilesRepository::GetVolatileSubQuads( tile_key.c_str(), depth); auto quad_tree = QueryApi::QuadTreeIndexVolatile( - query_api.GetResult(), layer_id_, tile_key, depth, boost::none, + query_api.GetResult(), layer_id_, tile_key, depth, olp::porting::none, billing_tag_, context); if (!quad_tree.IsSuccessful()) { @@ -307,8 +307,8 @@ SubQuadsResponse PrefetchTilesRepository::GetVolatileSubQuads( subtile.ToHereTile())); } - const auto put_result = - cache_repository_.Put(partitions, boost::none, boost::none, false); + const auto put_result = cache_repository_.Put(partitions, olp::porting::none, + olp::porting::none, false); if (!put_result.IsSuccessful()) { OLP_SDK_LOG_ERROR_F(kLogTag, "GetVolatileSubQuads failed to write data to cache, " diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/PrefetchTilesRepository.h b/olp-cpp-sdk-dataservice-read/src/repositories/PrefetchTilesRepository.h index a971f740e..9359bbe8f 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/PrefetchTilesRepository.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/PrefetchTilesRepository.h @@ -56,7 +56,7 @@ class PrefetchTilesRepository { PrefetchTilesRepository( client::HRN catalog, std::string layer_id, client::OlpClientSettings settings, client::ApiLookupClient client, - boost::optional billing_tag = boost::none, + porting::optional billing_tag = olp::porting::none, NamedMutexStorage mutex_storage = NamedMutexStorage()); /** @@ -158,7 +158,7 @@ class PrefetchTilesRepository { client::OlpClientSettings settings_; client::ApiLookupClient lookup_client_; PartitionsCacheRepository cache_repository_; - boost::optional billing_tag_; + porting::optional billing_tag_; NamedMutexStorage storage_; }; diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp b/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp index 7de0ee8ea..6f9b30088 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp +++ b/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.cpp @@ -275,10 +275,10 @@ void QuadTreeIndex::CreateBlob(geo::TileKey root, int depth, } } -boost::optional QuadTreeIndex::Find( +porting::optional QuadTreeIndex::Find( const geo::TileKey& tile_key, bool aggregated_search) const { if (IsNull()) { - return boost::none; + return olp::porting::none; } const geo::TileKey& root_tile_key = geo::TileKey::FromQuadKey64(data_->root_tilekey); @@ -292,7 +292,8 @@ boost::optional QuadTreeIndex::Find( const SubEntry* entry = std::lower_bound(SubEntryBegin(), end, SubEntry{sub, 0}); if (entry == end || entry->sub_quadkey != sub) { - return aggregated_search ? FindNearestParent(tile_key) : boost::none; + return aggregated_search ? FindNearestParent(tile_key) + : olp::porting::none; } const auto offset = entry->tag_offset; @@ -311,7 +312,7 @@ boost::optional QuadTreeIndex::Find( }(); if (!ReadIndexData(data, offset, limit, All)) { - return boost::none; + return olp::porting::none; } data.tile_key = tile_key; return data; @@ -323,7 +324,7 @@ boost::optional QuadTreeIndex::Find( const ParentEntry* entry = std::lower_bound(ParentEntryBegin(), end, ParentEntry{key, 0}); if (entry == end || entry->key != key) { - return aggregated_search ? FindNearestParent(tile_key) : boost::none; + return aggregated_search ? FindNearestParent(tile_key) : olp::porting::none; } const auto offset = entry->tag_offset; @@ -334,12 +335,12 @@ boost::optional QuadTreeIndex::Find( }(); if (!ReadIndexData(data, offset, limit, All)) { - return boost::none; + return olp::porting::none; } data.tile_key = tile_key; return data; } -boost::optional QuadTreeIndex::FindNearestParent( +porting::optional QuadTreeIndex::FindNearestParent( geo::TileKey tile_key) const { const geo::TileKey& root_tile_key = geo::TileKey::FromQuadKey64(data_->root_tilekey); @@ -356,7 +357,7 @@ boost::optional QuadTreeIndex::FindNearestParent( IndexData data; data.tile_key = key; if (!ReadIndexData(data, it->tag_offset, limit, All)) { - return boost::none; + return olp::porting::none; } return data; } @@ -372,13 +373,13 @@ boost::optional QuadTreeIndex::FindNearestParent( IndexData data; data.tile_key = key; if (!ReadIndexData(data, it->tag_offset, limit, All)) { - return boost::none; + return olp::porting::none; } return data; } limit = it->tag_offset; } - return boost::none; + return olp::porting::none; } std::vector QuadTreeIndex::GetIndexData( diff --git a/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.h b/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.h index 8714c461f..7c8d4bdc1 100644 --- a/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.h +++ b/olp-cpp-sdk-dataservice-read/src/repositories/QuadTreeIndex.h @@ -72,8 +72,8 @@ class QuadTreeIndex { bool IsNull() const { return data_ == nullptr; } - boost::optional Find(const geo::TileKey& tile_key, - bool aggregated_search) const; + porting::optional Find(const geo::TileKey& tile_key, + bool aggregated_search) const; cache::KeyValueCache::ValueTypePtr GetRawData() const { return raw_data_; } @@ -115,7 +115,7 @@ class QuadTreeIndex { void CreateBlob(geo::TileKey root, int depth, std::vector parents, std::vector subs); - boost::optional FindNearestParent(geo::TileKey tile_key) const; + porting::optional FindNearestParent(geo::TileKey tile_key) const; const SubEntry* SubEntryBegin() const { return data_->entries; } const SubEntry* SubEntryEnd() const { diff --git a/olp-cpp-sdk-dataservice-read/tests/DataRepositoryTest.cpp b/olp-cpp-sdk-dataservice-read/tests/DataRepositoryTest.cpp index 281c1fc04..c1efd8aeb 100644 --- a/olp-cpp-sdk-dataservice-read/tests/DataRepositoryTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/DataRepositoryTest.cpp @@ -135,8 +135,8 @@ TEST_F(DataRepositoryTest, GetBlobData) { DataRepository repository(hrn, *settings_, lookup_client); auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); ASSERT_TRUE(response.IsSuccessful()); } @@ -157,8 +157,8 @@ TEST_F(DataRepositoryTest, GetBlobDataApiLookupFailed403) { DataRepository repository(hrn, *settings_, lookup_client); auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); ASSERT_FALSE(response.IsSuccessful()); } @@ -172,8 +172,8 @@ TEST_F(DataRepositoryTest, GetBlobDataNoDataHandle) { auto response = repository.GetBlobData( kLayerId, kService, olp::dataservice::read::model::Partition(), - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); ASSERT_FALSE(response.IsSuccessful()); } @@ -199,8 +199,8 @@ TEST_F(DataRepositoryTest, GetBlobDataFailedDataFetch403) { DataRepository repository(hrn, *settings_, lookup_client); auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); ASSERT_FALSE(response.IsSuccessful()); } @@ -228,8 +228,8 @@ TEST_F(DataRepositoryTest, GetBlobDataCache) { DataRepository repository(hrn, *settings_, lookup_client); auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); ASSERT_TRUE(response.IsSuccessful()); @@ -237,8 +237,8 @@ TEST_F(DataRepositoryTest, GetBlobDataCache) { // instead response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); ASSERT_TRUE(response.IsSuccessful()); } @@ -268,8 +268,8 @@ TEST_F(DataRepositoryTest, GetBlobDataImmediateCancel) { DataRepository repository(hrn, *settings_, lookup_client); auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); ASSERT_EQ(response.GetError().GetErrorCode(), olp::client::ErrorCode::Cancelled); @@ -303,8 +303,8 @@ TEST_F(DataRepositoryTest, GetBlobDataInProgressCancel) { DataRepository repository(hrn, *settings_, lookup_client); auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); ASSERT_EQ(response.GetError().GetErrorCode(), olp::client::ErrorCode::Cancelled); @@ -347,8 +347,8 @@ TEST_F(DataRepositoryTest, GetBlobDataSimultaniousFailedCalls) { std::thread first_request_thread([&]() { auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); EXPECT_FALSE(response.IsSuccessful()); }); @@ -365,8 +365,8 @@ TEST_F(DataRepositoryTest, GetBlobDataSimultaniousFailedCalls) { std::thread second_request_thread([&]() { auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); EXPECT_FALSE(response.IsSuccessful()); }); @@ -598,8 +598,8 @@ TEST_F(DataRepositoryTest, GetBlobDataCancelParralellRequest) { std::thread first_request_thread([&]() { auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); EXPECT_FALSE(response); EXPECT_EQ(response.GetError().GetErrorCode(), @@ -612,8 +612,8 @@ TEST_F(DataRepositoryTest, GetBlobDataCancelParralellRequest) { std::thread second_request_thread([&]() { auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, false); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, false); EXPECT_FALSE(response); EXPECT_EQ(response.GetError().GetErrorCode(), @@ -676,8 +676,8 @@ TEST_F(DataRepositoryTest, GetBlobDataFailedToCache) { DataRepository repository(hrn, *settings_, lookup_client); auto response = repository.GetBlobData( kLayerId, kService, partition, - olp::dataservice::read::FetchOptions::OnlineIfNotFound, boost::none, - context, true); + olp::dataservice::read::FetchOptions::OnlineIfNotFound, + olp::porting::none, context, true); ASSERT_FALSE(response); ASSERT_EQ(response.GetError().GetErrorCode(), diff --git a/olp-cpp-sdk-dataservice-read/tests/MetadataApiTest.cpp b/olp-cpp-sdk-dataservice-read/tests/MetadataApiTest.cpp index 8035e4ce6..598fc9e1a 100644 --- a/olp-cpp-sdk-dataservice-read/tests/MetadataApiTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/MetadataApiTest.cpp @@ -79,7 +79,7 @@ TEST_F(MetadataApiTest, GetListVersions) { kHttpVersionsListResponse)); auto index_response = olp::dataservice::read::MetadataApi::ListVersions( - *client_, kStartVersion, kEndVersion, boost::none, + *client_, kStartVersion, kEndVersion, olp::porting::none, olp::client::CancellationContext{}); ASSERT_TRUE(index_response.IsSuccessful()); @@ -120,7 +120,7 @@ TEST_F(MetadataApiTest, GetListVersions) { context.CancelOperation(); auto index_response = olp::dataservice::read::MetadataApi::ListVersions( - *client_, kStartVersion, kEndVersion, boost::none, context); + *client_, kStartVersion, kEndVersion, olp::porting::none, context); ASSERT_FALSE(index_response.IsSuccessful()); const auto& error = index_response.GetError(); @@ -129,12 +129,12 @@ TEST_F(MetadataApiTest, GetListVersions) { } struct TestParameters { - boost::optional version; + olp::porting::optional version; std::string layer; std::string url; std::vector additional_fields; - boost::optional billing_tag; - boost::optional range; + olp::porting::optional billing_tag; + olp::porting::optional range; }; class MetadataApiParamTest @@ -151,7 +151,7 @@ TEST_P(MetadataApiParamTest, GetPartitionsStream) { olp::client::CancellationContext context; - boost::optional received_offset; + olp::porting::optional received_offset; std::string received_stream_data; auto data_callback = [&](const std::uint8_t* data, std::uint64_t offset, @@ -163,11 +163,11 @@ TEST_P(MetadataApiParamTest, GetPartitionsStream) { const std::string ref_stream_data{"reference stream data"}; const std::uint64_t offset{7}; - const auto range_header = [&]() -> boost::optional { + const auto range_header = [&]() -> olp::porting::optional { if (test_params.range) { return olp::http::Header{"Range", test_params.range.value()}; } - return boost::none; + return olp::porting::none; }(); EXPECT_CALL(*network_mock_, Send(AllOf(IsGetRequest(test_params.url), @@ -194,27 +194,27 @@ std::vector GetPartitionsStreamParams() { std::vector config; TestParameters params; - params.billing_tag = boost::none; + params.billing_tag = olp::porting::none; params.layer = "testLayer"; - params.range = boost::none; - params.version = boost::none; + params.range = olp::porting::none; + params.version = olp::porting::none; params.url = std::string(kNodeBaseUrl) + R"(/layers/)" + params.layer + R"(/partitions)"; config.emplace_back(params); - params.billing_tag = boost::none; + params.billing_tag = olp::porting::none; params.layer = "testLayer"; - params.range = boost::none; + params.range = olp::porting::none; params.version = kStartVersion; params.url = std::string(kNodeBaseUrl) + R"(/layers/)" + params.layer + R"(/partitions?version=)" + std::to_string(params.version.value()); config.emplace_back(params); - params.billing_tag = boost::none; + params.billing_tag = olp::porting::none; params.layer = "testLayer"; params.range = "rangeReferenceValue"; - params.version = boost::none; + params.version = olp::porting::none; params.url = std::string(kNodeBaseUrl) + R"(/layers/)" + params.layer + R"(/partitions)"; config.emplace_back(params); @@ -222,25 +222,25 @@ std::vector GetPartitionsStreamParams() { params.billing_tag = "billingTagValue"; params.layer = "testLayer"; params.range = "rangeReferenceValue"; - params.version = boost::none; + params.version = olp::porting::none; params.url = std::string(kNodeBaseUrl) + R"(/layers/)" + params.layer + R"(/partitions?billingTag=)" + params.billing_tag.value(); config.emplace_back(params); params.additional_fields = {"checksum", "compressedDataSize"}; - params.billing_tag = boost::none; + params.billing_tag = olp::porting::none; params.layer = "testLayer"; - params.range = boost::none; - params.version = boost::none; + params.range = olp::porting::none; + params.version = olp::porting::none; params.url = std::string(kNodeBaseUrl) + R"(/layers/)" + params.layer + R"(/partitions?additionalFields=)" + olp::utils::Url::Encode(R"(checksum,compressedDataSize)"); config.emplace_back(params); params.additional_fields = {"compressedDataSize"}; - params.billing_tag = boost::none; + params.billing_tag = olp::porting::none; params.layer = "testLayer"; - params.range = boost::none; + params.range = olp::porting::none; params.version = kEndVersion; params.url = std::string(kNodeBaseUrl) + R"(/layers/)" + params.layer + R"(/partitions?additionalFields=)" + diff --git a/olp-cpp-sdk-dataservice-read/tests/ParserTest.cpp b/olp-cpp-sdk-dataservice-read/tests/ParserTest.cpp index f742aa5c2..0fffd77c3 100644 --- a/olp-cpp-sdk-dataservice-read/tests/ParserTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/ParserTest.cpp @@ -425,10 +425,10 @@ TEST(ParserTest, Index) { ASSERT_TRUE(optional->GetCompressedDataSize()); ASSERT_TRUE(optional->GetDataSize()); - ASSERT_EQ("add-meta", optional->GetAdditionalMetadata().get()); - ASSERT_EQ("checksum", optional->GetChecksum().get()); - ASSERT_EQ(10101, optional->GetCompressedDataSize().get()); - ASSERT_EQ(21212, optional->GetDataSize().get()); + ASSERT_EQ("add-meta", *optional->GetAdditionalMetadata()); + ASSERT_EQ("checksum", *optional->GetChecksum()); + ASSERT_EQ(10101, *optional->GetCompressedDataSize()); + ASSERT_EQ(21212, *optional->GetDataSize()); } ASSERT_EQ(2, index.GetSubQuads().size()); @@ -455,10 +455,10 @@ TEST(ParserTest, Index) { ASSERT_TRUE(optional->GetCompressedDataSize()); ASSERT_TRUE(optional->GetDataSize()); - ASSERT_EQ("add-meta", optional->GetAdditionalMetadata().get()); - ASSERT_EQ("checksum", optional->GetChecksum().get()); - ASSERT_EQ(10101, optional->GetCompressedDataSize().get()); - ASSERT_EQ(21212, optional->GetDataSize().get()); + ASSERT_EQ("add-meta", *optional->GetAdditionalMetadata()); + ASSERT_EQ("checksum", *optional->GetChecksum()); + ASSERT_EQ(10101, *optional->GetCompressedDataSize()); + ASSERT_EQ(21212, *optional->GetDataSize()); } } @@ -519,12 +519,12 @@ TEST(ParserTest, Messages) { ASSERT_TRUE(metadata.GetTimestamp()); EXPECT_EQ(std::string("ff7494d6f17da702862e550c907c0a91"), - metadata.GetChecksum().get()); - EXPECT_EQ(152417, metadata.GetCompressedDataSize().get()); - EXPECT_EQ(250110, metadata.GetDataSize().get()); + *metadata.GetChecksum()); + EXPECT_EQ(152417, *metadata.GetCompressedDataSize()); + EXPECT_EQ(250110, *metadata.GetDataSize()); EXPECT_EQ(std::string("bb76b7747e7523596e74a138b15d92ec"), - metadata.GetDataHandle().get()); - EXPECT_EQ(1517916706, metadata.GetTimestamp().get()); + *metadata.GetDataHandle()); + EXPECT_EQ(1517916706, *metadata.GetTimestamp()); } { diff --git a/olp-cpp-sdk-dataservice-read/tests/PartitionsCacheRepositoryTest.cpp b/olp-cpp-sdk-dataservice-read/tests/PartitionsCacheRepositoryTest.cpp index 1ddc52fac..d44495111 100644 --- a/olp-cpp-sdk-dataservice-read/tests/PartitionsCacheRepositoryTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/PartitionsCacheRepositoryTest.cpp @@ -73,11 +73,12 @@ TEST(PartitionsCacheRepositoryTest, DefaultExpiry) { repository::PartitionsCacheRepository repository(hrn, layer, cache, default_expiry); - repository.Put(partitions, boost::none, boost::none, true); + repository.Put(partitions, olp::porting::none, olp::porting::none, true); repository.Put(catalog_version, versions); - const auto partitions_result = repository.Get({kPartitionId}, boost::none); + const auto partitions_result = + repository.Get({kPartitionId}, olp::porting::none); const auto partitions_optional_result = - repository.Get(request, boost::none); + repository.Get(request, olp::porting::none); const auto versions_result = repository.Get(catalog_version); EXPECT_FALSE(partitions_result.GetPartitions().empty()); @@ -94,12 +95,13 @@ TEST(PartitionsCacheRepositoryTest, DefaultExpiry) { repository::PartitionsCacheRepository repository(hrn, layer, cache, default_expiry); - repository.Put(partitions, boost::none, boost::none, true); + repository.Put(partitions, olp::porting::none, olp::porting::none, true); repository.Put(catalog_version, versions); - const auto partitions_result = repository.Get({kPartitionId}, boost::none); + const auto partitions_result = + repository.Get({kPartitionId}, olp::porting::none); const auto partitions_optional_result = - repository.Get(request, boost::none); + repository.Get(request, olp::porting::none); const auto versions_result = repository.Get(catalog_version); EXPECT_TRUE(partitions_result.GetPartitions().empty()); @@ -117,9 +119,10 @@ TEST(PartitionsCacheRepositoryTest, DefaultExpiry) { repository::PartitionsCacheRepository repository(hrn, layer, cache, default_expiry); - repository.Put(partitions, boost::none, data_expiry, true); - const auto partitions_result = repository.Get({kPartitionId}, boost::none); - const auto optional_result = repository.Get(request, boost::none); + repository.Put(partitions, olp::porting::none, data_expiry, true); + const auto partitions_result = + repository.Get({kPartitionId}, olp::porting::none); + const auto optional_result = repository.Get(request, olp::porting::none); EXPECT_FALSE(partitions_result.GetPartitions().empty()); EXPECT_TRUE(optional_result); @@ -135,9 +138,10 @@ TEST(PartitionsCacheRepositoryTest, DefaultExpiry) { repository::PartitionsCacheRepository repository(hrn, layer, cache, default_expiry); - repository.Put(partitions, boost::none, data_expiry, true); - const auto partitions_result = repository.Get({kPartitionId}, boost::none); - const auto optional_result = repository.Get(request, boost::none); + repository.Put(partitions, olp::porting::none, data_expiry, true); + const auto partitions_result = + repository.Get({kPartitionId}, olp::porting::none); + const auto optional_result = repository.Get(request, olp::porting::none); EXPECT_TRUE(partitions_result.GetPartitions().empty()); EXPECT_FALSE(optional_result); @@ -215,9 +219,9 @@ TEST(PartitionsCacheRepositoryTest, GetPartitionHandle) { olp::client::OlpClientSettingsFactory::CreateDefaultCache({}); repository::PartitionsCacheRepository repository(hrn, layer, cache); std::string handle; - repository.Put(partitions, boost::none, true); - EXPECT_TRUE( - repository.GetPartitionHandle(kPartitionId, boost::none, handle)); + repository.Put(partitions, olp::porting::none, true); + EXPECT_TRUE(repository.GetPartitionHandle(kPartitionId, olp::porting::none, + handle)); } { @@ -227,8 +231,8 @@ TEST(PartitionsCacheRepositoryTest, GetPartitionHandle) { olp::client::OlpClientSettingsFactory::CreateDefaultCache({}); repository::PartitionsCacheRepository repository(hrn, layer, cache); std::string handle; - EXPECT_FALSE( - repository.GetPartitionHandle(kPartitionId, boost::none, handle)); + EXPECT_FALSE(repository.GetPartitionHandle(kPartitionId, olp::porting::none, + handle)); } } @@ -268,8 +272,9 @@ TEST(PartitionsCacheRepositoryTest, ClearPartitions) { .WillOnce(testing::Return(true)); repository::PartitionsCacheRepository repository(hrn, layer, cache); - repository.Put(partitions, boost::none, true); - EXPECT_FALSE(repository.ClearPartitions({kPartitionId}, boost::none)); + repository.Put(partitions, olp::porting::none, true); + EXPECT_FALSE( + repository.ClearPartitions({kPartitionId}, olp::porting::none)); } { @@ -281,8 +286,9 @@ TEST(PartitionsCacheRepositoryTest, ClearPartitions) { .WillOnce(testing::Return(false)); repository::PartitionsCacheRepository repository(hrn, layer, cache); - repository.Put(partitions, boost::none, true); - EXPECT_FALSE(repository.ClearPartitions({kPartitionId}, boost::none)); + repository.Put(partitions, olp::porting::none, true); + EXPECT_FALSE( + repository.ClearPartitions({kPartitionId}, olp::porting::none)); } { @@ -294,8 +300,8 @@ TEST(PartitionsCacheRepositoryTest, ClearPartitions) { .WillOnce(testing::Return(true)); repository::PartitionsCacheRepository repository(hrn, layer, cache); - repository.Put(partitions, boost::none, true); - EXPECT_TRUE(repository.ClearPartitions({kPartitionId}, boost::none)); + repository.Put(partitions, olp::porting::none, true); + EXPECT_TRUE(repository.ClearPartitions({kPartitionId}, olp::porting::none)); } } diff --git a/olp-cpp-sdk-dataservice-read/tests/PartitionsRepositoryTest.cpp b/olp-cpp-sdk-dataservice-read/tests/PartitionsRepositoryTest.cpp index 48a29f23b..964682b03 100644 --- a/olp-cpp-sdk-dataservice-read/tests/PartitionsRepositoryTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/PartitionsRepositoryTest.cpp @@ -267,7 +267,8 @@ TEST_F(PartitionsRepositoryTest, GetPartitionById) { client::CancellationContext context; auto response = repository.GetPartitionById( - DataRequest(request).WithPartitionId(boost::none), kVersion, context); + DataRequest(request).WithPartitionId(olp::porting::none), kVersion, + context); ASSERT_FALSE(response.IsSuccessful()); const auto& result = response.GetError(); @@ -320,8 +321,8 @@ TEST_F(PartitionsRepositoryTest, GetPartitionById) { EXPECT_CALL(*cache, Write(Eq(cache_key_no_version), _, _)).Times(0); auto response = repository.GetPartitionById( - DataRequest(request).WithFetchOption(read::OnlineOnly), boost::none, - context); + DataRequest(request).WithFetchOption(read::OnlineOnly), + olp::porting::none, context); ASSERT_TRUE(response.IsSuccessful()); const auto& partitions = response.GetResult().GetPartitions(); @@ -1244,7 +1245,8 @@ TEST_F(PartitionsRepositoryTest, GetTile) { auto request = read::TileRequest().WithTileKey(tile_key); const auto setup_get_cached_quad_expectations = - [&](const boost::optional& root_data = boost::none) { + [&](const olp::porting::optional& root_data = + olp::porting::none) { testing::InSequence sequence; for (int32_t i = depth; i > 0; --i) { @@ -1847,7 +1849,7 @@ TEST_F(PartitionsRepositoryTest, ParsePartitionsStream) { SCOPED_TRACE("Closed empty input stream"); auto async_stream = std::make_shared(); - async_stream->CloseStream(boost::none); + async_stream->CloseStream(olp::porting::none); const auto response = repository.ParsePartitionsStream(async_stream, {}, context); @@ -1912,7 +1914,7 @@ TEST_F(PartitionsRepositoryTest, ParsePartitionsStream) { olp::client::ErrorCode::Cancelled); // prevent stuck if the cancelation failed - async_stream->CloseStream(boost::none); + async_stream->CloseStream(olp::porting::none); } { @@ -1921,7 +1923,7 @@ TEST_F(PartitionsRepositoryTest, ParsePartitionsStream) { const std::string to_parse = "{\"partitions\":[]}"; auto async_stream = std::make_shared(); async_stream->AppendContent(to_parse.c_str(), to_parse.length()); - async_stream->CloseStream(boost::none); + async_stream->CloseStream(olp::porting::none); size_t callback_counter{0u}; const auto callback = [&](model::Partition) -> void { ++callback_counter; }; @@ -1939,7 +1941,7 @@ TEST_F(PartitionsRepositoryTest, ParsePartitionsStream) { R"({"partitions":[{"version":731,"partition":"just-a-random-value","dataHandle":"another-value-to-check"}]})"; auto async_stream = std::make_shared(); async_stream->AppendContent(to_parse.c_str(), to_parse.length()); - async_stream->CloseStream(boost::none); + async_stream->CloseStream(olp::porting::none); std::vector recieved_partitions; const auto callback = [&](model::Partition partition) -> void { @@ -1975,7 +1977,7 @@ TEST_F(PartitionsRepositoryTest, StreamPartitions) { settings, lookup_client); const std::vector additional_fields; - boost::optional billing_tag; + olp::porting::optional billing_tag; { SCOPED_TRACE("Failed to get metadata"); diff --git a/olp-cpp-sdk-dataservice-read/tests/PartitionsSaxHandlerTest.cpp b/olp-cpp-sdk-dataservice-read/tests/PartitionsSaxHandlerTest.cpp index 9126599d0..94c340392 100644 --- a/olp-cpp-sdk-dataservice-read/tests/PartitionsSaxHandlerTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/PartitionsSaxHandlerTest.cpp @@ -66,7 +66,8 @@ TEST(PartitionsSaxHandlerTest, NormalFlow) { ASSERT_TRUE(handler.String(kChecksumValue, len(kChecksumValue), true)); ASSERT_TRUE(handler.String(kDataSize, len(kDataSize), true)); ASSERT_TRUE(handler.Uint(150)); - ASSERT_TRUE(handler.String(kCompressedDataSize, len(kCompressedDataSize), true)); + ASSERT_TRUE( + handler.String(kCompressedDataSize, len(kCompressedDataSize), true)); ASSERT_TRUE(handler.Uint(100)); ASSERT_TRUE(handler.String(kVersion, len(kVersion), true)); ASSERT_TRUE(handler.Uint(6)); @@ -79,12 +80,14 @@ TEST(PartitionsSaxHandlerTest, NormalFlow) { EXPECT_EQ(parsed_partition.GetDataHandle(), std::string(kDataHandleValue)); EXPECT_EQ(parsed_partition.GetPartition(), std::string(kPartitionValue)); - EXPECT_EQ(parsed_partition.GetChecksum().get_value_or(""), + EXPECT_EQ(olp::porting::value_or(parsed_partition.GetChecksum(), ""), std::string(kChecksumValue)); - EXPECT_EQ(parsed_partition.GetCrc().get_value_or(""), std::string(kCrcValue)); - EXPECT_EQ(parsed_partition.GetDataSize().get_value_or(0), 150); - EXPECT_EQ(parsed_partition.GetCompressedDataSize().get_value_or(0), 100); - EXPECT_EQ(parsed_partition.GetVersion().get_value_or(0), 6); + EXPECT_EQ(olp::porting::value_or(parsed_partition.GetCrc(), ""), + std::string(kCrcValue)); + EXPECT_EQ(olp::porting::value_or(parsed_partition.GetDataSize(), 0), 150); + EXPECT_EQ(olp::porting::value_or(parsed_partition.GetCompressedDataSize(), 0), + 100); + EXPECT_EQ(olp::porting::value_or(parsed_partition.GetVersion(), 0), 6); } TEST(PartitionsSaxHandlerTest, WrongJSONStructure) { diff --git a/olp-cpp-sdk-dataservice-read/tests/QuadTreeIndexTest.cpp b/olp-cpp-sdk-dataservice-read/tests/QuadTreeIndexTest.cpp index b90f07045..8c86373b3 100644 --- a/olp-cpp-sdk-dataservice-read/tests/QuadTreeIndexTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/QuadTreeIndexTest.cpp @@ -44,34 +44,34 @@ TEST(QuadTreeIndexTest, ParseBlob) { SCOPED_TRACE("Parse json and store to blob"); auto data1 = index.Find(tile_key, false); - ASSERT_FALSE(data1 == boost::none); + ASSERT_FALSE(data1 == olp::porting::none); EXPECT_EQ(data1->data_handle, "BD53A6D60A34C20DC42ACAB2650FE361.48"); EXPECT_EQ(data1->tile_key, olp::geo::TileKey::FromHereTile("381")); EXPECT_EQ(data1->version, 48); auto data2 = index.Find(olp::geo::TileKey::FromHereTile("95"), false); - ASSERT_FALSE(data2 == boost::none); + ASSERT_FALSE(data2 == olp::porting::none); EXPECT_EQ(data2->data_handle, "B6F7614316BB8B81478ED7AE370B22A6.253"); EXPECT_EQ(data2->tile_key, olp::geo::TileKey::FromHereTile("95")); EXPECT_EQ(data2->version, 253); auto data3 = index.Find(tile_key.AddedSubHereTile("2"), false); - ASSERT_FALSE(data3 == boost::none); + ASSERT_FALSE(data3 == olp::porting::none); EXPECT_EQ(data3->data_handle, "9772F5E1822DFF25F48F150294B1ECF5.282"); EXPECT_EQ(data3->tile_key, olp::geo::TileKey::FromHereTile("1526")); EXPECT_EQ(data3->version, 282); auto data4 = index.Find(tile_key.AddedSubHereTile("4"), false); - ASSERT_FALSE(data4 == boost::none); + ASSERT_FALSE(data4 == olp::porting::none); EXPECT_EQ(data4->data_handle, "7636348E50215979A39B5F3A429EDDB4.282"); EXPECT_EQ(data4->tile_key, olp::geo::TileKey::FromHereTile("1524")); EXPECT_EQ(data4->version, 282); auto data5 = index.Find(olp::geo::TileKey::FromHereTile("1561298"), false); - EXPECT_TRUE(data5 == boost::none); + EXPECT_TRUE(data5 == olp::porting::none); auto data6 = index.Find(olp::geo::TileKey::FromHereTile("3"), false); - EXPECT_TRUE(data6 == boost::none); + EXPECT_TRUE(data6 == olp::porting::none); } { @@ -79,14 +79,14 @@ TEST(QuadTreeIndexTest, ParseBlob) { // Find in parents auto data1 = index.Find(olp::geo::TileKey::FromHereTile("5842"), true); - ASSERT_FALSE(data1 == boost::none); + ASSERT_FALSE(data1 == olp::porting::none); EXPECT_EQ(data1->data_handle, "13E2C624E0136C3357D092EE7F231E87.282"); EXPECT_EQ(data1->tile_key, olp::geo::TileKey::FromHereTile("5")); EXPECT_EQ(data1->version, 282); // Find in sub quads auto data2 = index.Find(olp::geo::TileKey::FromHereTile("1561298"), true); - ASSERT_FALSE(data2 == boost::none); + ASSERT_FALSE(data2 == olp::porting::none); EXPECT_EQ(data2->data_handle, "7636348E50215979A39B5F3A429EDDB4.282"); EXPECT_EQ(data2->tile_key, olp::geo::TileKey::FromHereTile("1524")); EXPECT_EQ(data2->version, 282); @@ -94,7 +94,7 @@ TEST(QuadTreeIndexTest, ParseBlob) { // Use bottom tile so the algorithm will try to look in childs and parents // and will fail due to no nearest parent present in data auto data3 = index.Find(olp::geo::TileKey::FromHereTile("4818"), true); - EXPECT_TRUE(data3 == boost::none); + EXPECT_TRUE(data3 == olp::porting::none); } { @@ -117,7 +117,7 @@ TEST(QuadTreeIndexTest, ParseBlob) { auto stream = std::stringstream(HTTP_RESPONSE_MAILFORMED); read::QuadTreeIndex index(tile_key, 1, stream); auto data = index.Find(tile_key, false); - EXPECT_TRUE(data == boost::none); + EXPECT_TRUE(data == olp::porting::none); } { @@ -136,7 +136,7 @@ TEST(QuadTreeIndexTest, ParseBlob) { auto stream = std::stringstream(HTTP_RESPONSE_WRONG_FORMAT); read::QuadTreeIndex index(tile_key, 1, stream); auto data = index.Find(tile_key, false); - EXPECT_TRUE(data == boost::none); + EXPECT_TRUE(data == olp::porting::none); } } @@ -198,34 +198,34 @@ TEST(QuadTreeIndexTest, BackwardsCompatibility) { SCOPED_TRACE("Parse json and store to blob"); auto data1 = index.Find(tile_key, false); - ASSERT_FALSE(data1 == boost::none); + ASSERT_FALSE(data1 == olp::porting::none); EXPECT_EQ(data1->data_handle, "BD53A6D60A34C20DC42ACAB2650FE361.48"); EXPECT_EQ(data1->tile_key, olp::geo::TileKey::FromHereTile("381")); EXPECT_EQ(data1->version, 48); auto data2 = index.Find(olp::geo::TileKey::FromHereTile("95"), false); - ASSERT_FALSE(data2 == boost::none); + ASSERT_FALSE(data2 == olp::porting::none); EXPECT_EQ(data2->data_handle, "B6F7614316BB8B81478ED7AE370B22A6.253"); EXPECT_EQ(data2->tile_key, olp::geo::TileKey::FromHereTile("95")); EXPECT_EQ(data2->version, 253); auto data3 = index.Find(tile_key.AddedSubHereTile("2"), false); - ASSERT_FALSE(data3 == boost::none); + ASSERT_FALSE(data3 == olp::porting::none); EXPECT_EQ(data3->data_handle, "9772F5E1822DFF25F48F150294B1ECF5.282"); EXPECT_EQ(data3->tile_key, olp::geo::TileKey::FromHereTile("1526")); EXPECT_EQ(data3->version, 282); auto data4 = index.Find(tile_key.AddedSubHereTile("4"), false); - ASSERT_FALSE(data4 == boost::none); + ASSERT_FALSE(data4 == olp::porting::none); EXPECT_EQ(data4->data_handle, "7636348E50215979A39B5F3A429EDDB4.282"); EXPECT_EQ(data4->tile_key, olp::geo::TileKey::FromHereTile("1524")); EXPECT_EQ(data4->version, 282); auto data5 = index.Find(olp::geo::TileKey::FromHereTile("1561298"), false); - EXPECT_TRUE(data5 == boost::none); + EXPECT_TRUE(data5 == olp::porting::none); auto data6 = index.Find(olp::geo::TileKey::FromHereTile("3"), false); - EXPECT_TRUE(data6 == boost::none); + EXPECT_TRUE(data6 == olp::porting::none); } { @@ -233,14 +233,14 @@ TEST(QuadTreeIndexTest, BackwardsCompatibility) { // Find in parents auto data1 = index.Find(olp::geo::TileKey::FromHereTile("5842"), true); - ASSERT_FALSE(data1 == boost::none); + ASSERT_FALSE(data1 == olp::porting::none); EXPECT_EQ(data1->data_handle, "13E2C624E0136C3357D092EE7F231E87.282"); EXPECT_EQ(data1->tile_key, olp::geo::TileKey::FromHereTile("5")); EXPECT_EQ(data1->version, 282); // Find in sub quads auto data2 = index.Find(olp::geo::TileKey::FromHereTile("1561298"), true); - ASSERT_FALSE(data2 == boost::none); + ASSERT_FALSE(data2 == olp::porting::none); EXPECT_EQ(data2->data_handle, "7636348E50215979A39B5F3A429EDDB4.282"); EXPECT_EQ(data2->tile_key, olp::geo::TileKey::FromHereTile("1524")); EXPECT_EQ(data2->version, 282); @@ -248,7 +248,7 @@ TEST(QuadTreeIndexTest, BackwardsCompatibility) { // Use bottom tile so the algorithm will try to look in childs and parents // and will fail due to no nearest parent present in data auto data3 = index.Find(olp::geo::TileKey::FromHereTile("4818"), true); - EXPECT_TRUE(data3 == boost::none); + EXPECT_TRUE(data3 == olp::porting::none); } { diff --git a/olp-cpp-sdk-dataservice-read/tests/QueryApiTest.cpp b/olp-cpp-sdk-dataservice-read/tests/QueryApiTest.cpp index e64bded9c..dcdb4dd93 100644 --- a/olp-cpp-sdk-dataservice-read/tests/QueryApiTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/QueryApiTest.cpp @@ -80,8 +80,8 @@ TEST_F(QueryApiTest, QuadTreeIndexVolatile) { int32_t depth = 2; auto index_response = olp::dataservice::read::QueryApi::QuadTreeIndexVolatile( - *client_, kLayerid, kQuadKey, depth, boost::none, boost::none, - olp::client::CancellationContext{}); + *client_, kLayerid, kQuadKey, depth, olp::porting::none, + olp::porting::none, olp::client::CancellationContext{}); ASSERT_TRUE(index_response.IsSuccessful()); auto result = index_response.GetResult(); @@ -123,8 +123,8 @@ TEST_F(QueryApiTest, QuadTreeIndexVolatile) { int32_t depth = 2; auto index_response = olp::dataservice::read::QueryApi::QuadTreeIndexVolatile( - *client_, kLayerid, kQuadKey, depth, boost::none, boost::none, - olp::client::CancellationContext{}); + *client_, kLayerid, kQuadKey, depth, olp::porting::none, + olp::porting::none, olp::client::CancellationContext{}); ASSERT_FALSE(index_response.IsSuccessful()); auto error = index_response.GetError(); @@ -137,8 +137,8 @@ TEST_F(QueryApiTest, QuadTreeIndexVolatile) { int32_t depth = 2; auto index_response = olp::dataservice::read::QueryApi::QuadTreeIndexVolatile( - client, kLayerid, kQuadKey, depth, boost::none, boost::none, - olp::client::CancellationContext{}); + client, kLayerid, kQuadKey, depth, olp::porting::none, + olp::porting::none, olp::client::CancellationContext{}); ASSERT_FALSE(index_response.IsSuccessful()); auto error = index_response.GetError(); @@ -154,8 +154,8 @@ TEST_F(QueryApiTest, QuadTreeIndexVolatile) { int32_t depth = 2; auto index_response = olp::dataservice::read::QueryApi::QuadTreeIndexVolatile( - *client_, {}, kQuadKey, depth, boost::none, boost::none, - olp::client::CancellationContext{}); + *client_, {}, kQuadKey, depth, olp::porting::none, + olp::porting::none, olp::client::CancellationContext{}); ASSERT_FALSE(index_response.IsSuccessful()); auto error = index_response.GetError(); @@ -171,8 +171,8 @@ TEST_F(QueryApiTest, QuadTreeIndexVolatile) { int32_t depth = 2; auto index_response = olp::dataservice::read::QueryApi::QuadTreeIndexVolatile( - *client_, kLayerid, {}, depth, boost::none, boost::none, - olp::client::CancellationContext{}); + *client_, kLayerid, {}, depth, olp::porting::none, + olp::porting::none, olp::client::CancellationContext{}); ASSERT_FALSE(index_response.IsSuccessful()); auto error = index_response.GetError(); @@ -188,8 +188,8 @@ TEST_F(QueryApiTest, QuadTreeIndexVolatile) { int32_t depth = -1; auto index_response = olp::dataservice::read::QueryApi::QuadTreeIndexVolatile( - *client_, kLayerid, kQuadKey, depth, boost::none, boost::none, - olp::client::CancellationContext{}); + *client_, kLayerid, kQuadKey, depth, olp::porting::none, + olp::porting::none, olp::client::CancellationContext{}); ASSERT_FALSE(index_response.IsSuccessful()); auto error = index_response.GetError(); @@ -207,8 +207,8 @@ TEST_F(QueryApiTest, QuadTreeIndexVolatile) { std::vector empty_fields; auto index_response = olp::dataservice::read::QueryApi::QuadTreeIndexVolatile( - *client_, kLayerid, kQuadKey, depth, empty_fields, boost::none, - olp::client::CancellationContext{}); + *client_, kLayerid, kQuadKey, depth, empty_fields, + olp::porting::none, olp::client::CancellationContext{}); ASSERT_FALSE(index_response.IsSuccessful()); auto error = index_response.GetError(); @@ -226,7 +226,7 @@ TEST_F(QueryApiTest, QuadTreeIndexVolatile) { std::string empty_tag; auto index_response = olp::dataservice::read::QueryApi::QuadTreeIndexVolatile( - *client_, kLayerid, kQuadKey, depth, boost::none, empty_tag, + *client_, kLayerid, kQuadKey, depth, olp::porting::none, empty_tag, olp::client::CancellationContext{}); ASSERT_FALSE(index_response.IsSuccessful()); @@ -242,8 +242,8 @@ TEST_F(QueryApiTest, QuadTreeIndexVolatile) { int32_t depth = 2; auto index_response = olp::dataservice::read::QueryApi::QuadTreeIndexVolatile( - *client_, kLayerid, kQuadKey, depth, boost::none, boost::none, - context); + *client_, kLayerid, kQuadKey, depth, olp::porting::none, + olp::porting::none, context); ASSERT_FALSE(index_response.IsSuccessful()); auto error = index_response.GetError(); diff --git a/olp-cpp-sdk-dataservice-read/tests/SerializerTest.cpp b/olp-cpp-sdk-dataservice-read/tests/SerializerTest.cpp index 2f9e914b5..531328712 100644 --- a/olp-cpp-sdk-dataservice-read/tests/SerializerTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/SerializerTest.cpp @@ -39,7 +39,27 @@ namespace { -using namespace olp::dataservice::read::model; +using olp::dataservice::read::model::Api; +using olp::dataservice::read::model::Catalog; +using olp::dataservice::read::model::Coverage; +using olp::dataservice::read::model::Creator; +using olp::dataservice::read::model::Encryption; +using olp::dataservice::read::model::IndexDefinition; +using olp::dataservice::read::model::IndexProperties; +using olp::dataservice::read::model::Layer; +using olp::dataservice::read::model::LayerVersion; +using olp::dataservice::read::model::LayerVersions; +using olp::dataservice::read::model::Notifications; +using olp::dataservice::read::model::Owner; +using olp::dataservice::read::model::Partition; +using olp::dataservice::read::model::Partitioning; +using olp::dataservice::read::model::Partitions; +using olp::dataservice::read::model::Schema; +using olp::dataservice::read::model::StreamOffset; +using olp::dataservice::read::model::StreamOffsets; +using olp::dataservice::read::model::StreamProperties; +using olp::dataservice::read::model::VersionResponse; +using olp::dataservice::read::model::Volume; void RemoveWhitespaceAndNewlines(std::string& s) { std::regex r("\\s+"); @@ -354,7 +374,7 @@ TEST(SerializerTest, Partitions) { Partition partition; partition.SetChecksum( - boost::optional("291f66029c232400e3403cd6e9cfd36e")); + olp::porting::optional("291f66029c232400e3403cd6e9cfd36e")); partition.SetCompressedDataSize(1024); partition.SetDataHandle("1b2ca68f-d4a0-4379-8120-cd025640510c"); partition.SetDataSize(1024); diff --git a/olp-cpp-sdk-dataservice-read/tests/StreamApiTest.cpp b/olp-cpp-sdk-dataservice-read/tests/StreamApiTest.cpp index 8328f46b9..89d58372b 100644 --- a/olp-cpp-sdk-dataservice-read/tests/StreamApiTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/StreamApiTest.cpp @@ -155,8 +155,8 @@ TEST_F(StreamApiTest, Subscribe) { std::string x_correlation_id; client::CancellationContext context; const auto subscribe_response = read::StreamApi::Subscribe( - olp_client_, kLayerId, boost::none, boost::none, boost::none, - boost::none, context, x_correlation_id); + olp_client_, kLayerId, olp::porting::none, olp::porting::none, + olp::porting::none, olp::porting::none, context, x_correlation_id); EXPECT_TRUE(subscribe_response.IsSuccessful()) << ApiErrorToString(subscribe_response.GetError()); @@ -212,8 +212,8 @@ TEST_F(StreamApiTest, Subscribe) { std::string x_correlation_id; client::CancellationContext context; const auto subscribe_response = read::StreamApi::Subscribe( - olp_client_, kLayerId, boost::none, boost::none, boost::none, - boost::none, context, x_correlation_id); + olp_client_, kLayerId, olp::porting::none, olp::porting::none, + olp::porting::none, olp::porting::none, context, x_correlation_id); EXPECT_FALSE(subscribe_response.IsSuccessful()); EXPECT_EQ(subscribe_response.GetError().GetHttpStatusCode(), @@ -239,9 +239,9 @@ TEST_F(StreamApiTest, ConsumeData) { std::string x_correlation_id = kCorrelationId; client::CancellationContext context; - const auto consume_data_response = - read::StreamApi::ConsumeData(olp_client_, kLayerId, boost::none, - boost::none, context, x_correlation_id); + const auto consume_data_response = read::StreamApi::ConsumeData( + olp_client_, kLayerId, olp::porting::none, olp::porting::none, context, + x_correlation_id); EXPECT_TRUE(consume_data_response.IsSuccessful()) << ApiErrorToString(consume_data_response.GetError()); @@ -287,9 +287,9 @@ TEST_F(StreamApiTest, ConsumeData) { std::string x_correlation_id = kCorrelationId; client::CancellationContext context; - const auto consume_data_response = - read::StreamApi::ConsumeData(olp_client_, kLayerId, boost::none, - boost::none, context, x_correlation_id); + const auto consume_data_response = read::StreamApi::ConsumeData( + olp_client_, kLayerId, olp::porting::none, olp::porting::none, context, + x_correlation_id); EXPECT_FALSE(consume_data_response.IsSuccessful()); EXPECT_EQ(consume_data_response.GetError().GetHttpStatusCode(), @@ -321,8 +321,8 @@ TEST_F(StreamApiTest, CommitOffsets) { std::string x_correlation_id = kCorrelationId; client::CancellationContext context; const auto commit_offsets_response = read::StreamApi::CommitOffsets( - olp_client_, kLayerId, stream_offsets, boost::none, boost::none, - context, x_correlation_id); + olp_client_, kLayerId, stream_offsets, olp::porting::none, + olp::porting::none, context, x_correlation_id); EXPECT_TRUE(commit_offsets_response.IsSuccessful()) << ApiErrorToString(commit_offsets_response.GetError()); @@ -371,8 +371,8 @@ TEST_F(StreamApiTest, CommitOffsets) { std::string x_correlation_id = kCorrelationId; client::CancellationContext context; const auto commit_offsets_response = read::StreamApi::CommitOffsets( - olp_client_, kLayerId, stream_offsets, boost::none, boost::none, - context, x_correlation_id); + olp_client_, kLayerId, stream_offsets, olp::porting::none, + olp::porting::none, context, x_correlation_id); EXPECT_FALSE(commit_offsets_response.IsSuccessful()); EXPECT_EQ(commit_offsets_response.GetError().GetHttpStatusCode(), @@ -403,8 +403,8 @@ TEST_F(StreamApiTest, SeekToOffset) { std::string x_correlation_id = kCorrelationId; client::CancellationContext context; const auto seek_to_offset_response = read::StreamApi::SeekToOffset( - olp_client_, kLayerId, stream_offsets, boost::none, boost::none, - context, x_correlation_id); + olp_client_, kLayerId, stream_offsets, olp::porting::none, + olp::porting::none, context, x_correlation_id); EXPECT_TRUE(seek_to_offset_response.IsSuccessful()) << ApiErrorToString(seek_to_offset_response.GetError()); @@ -454,8 +454,8 @@ TEST_F(StreamApiTest, SeekToOffset) { std::string x_correlation_id = kCorrelationId; client::CancellationContext context; const auto commit_offsets_response = read::StreamApi::SeekToOffset( - olp_client_, kLayerId, stream_offsets, boost::none, boost::none, - context, x_correlation_id); + olp_client_, kLayerId, stream_offsets, olp::porting::none, + olp::porting::none, context, x_correlation_id); EXPECT_FALSE(commit_offsets_response.IsSuccessful()); EXPECT_EQ(commit_offsets_response.GetError().GetHttpStatusCode(), diff --git a/olp-cpp-sdk-dataservice-read/tests/StreamLayerClientImplTest.cpp b/olp-cpp-sdk-dataservice-read/tests/StreamLayerClientImplTest.cpp index ccb221f42..02fddf843 100644 --- a/olp-cpp-sdk-dataservice-read/tests/StreamLayerClientImplTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/StreamLayerClientImplTest.cpp @@ -19,6 +19,8 @@ #include +#include + #include #include #include @@ -1118,11 +1120,11 @@ TEST(SubscribeRequestTest, SubscribeRequest) { EXPECT_EQ(sub_req.GetSubscriptionMode(), read::SubscribeRequest::SubscriptionMode::kParallel); - EXPECT_EQ(sub_req.GetSubscriptionId().get(), kSubscriptionId); - EXPECT_EQ(sub_req.GetConsumerId().get(), kConsumerID); + EXPECT_EQ(sub_req.GetSubscriptionId(), kSubscriptionId); + EXPECT_EQ(sub_req.GetConsumerId(), kConsumerID); const auto& consumer_properties = - sub_req.GetConsumerProperties().get().GetProperties(); + sub_req.GetConsumerProperties()->GetProperties(); EXPECT_EQ(consumer_properties.size(), kConsumerProperties.GetProperties().size()); for (size_t idx = 0; idx < consumer_properties.size(); ++idx) { diff --git a/olp-cpp-sdk-dataservice-read/tests/VersionedLayerClientImplTest.cpp b/olp-cpp-sdk-dataservice-read/tests/VersionedLayerClientImplTest.cpp index 7fa61927a..f7d6cf791 100644 --- a/olp-cpp-sdk-dataservice-read/tests/VersionedLayerClientImplTest.cpp +++ b/olp-cpp-sdk-dataservice-read/tests/VersionedLayerClientImplTest.cpp @@ -72,9 +72,11 @@ constexpr auto kUrlLookup = R"(https://api-lookup.data.api.platform.here.com/lookup/v1/resources/hrn:here:data::olp-here-test:hereos-internal-test-v2/apis)"; TEST(VersionedLayerClientTest, CanBeMoved) { - read::VersionedLayerClient client_a(olp::client::HRN(), "", boost::none, {}); + read::VersionedLayerClient client_a(olp::client::HRN(), "", + olp::porting::none, {}); read::VersionedLayerClient client_b(std::move(client_a)); - read::VersionedLayerClient client_c(olp::client::HRN(), "", boost::none, {}); + read::VersionedLayerClient client_c(olp::client::HRN(), "", + olp::porting::none, {}); client_c = std::move(client_b); } @@ -85,7 +87,8 @@ TEST(VersionedLayerClientTest, GetData) { settings.network_request_handler = network_mock; settings.cache = cache_mock; - read::VersionedLayerClient client(kHrn, kLayerId, boost::none, settings); + read::VersionedLayerClient client(kHrn, kLayerId, olp::porting::none, + settings); { SCOPED_TRACE("Get Data with PartitionId and DataHandle"); std::promise promise; @@ -484,7 +487,7 @@ TEST(VersionedLayerClientTest, ProtectThenReleasePartition) { { SCOPED_TRACE("invalid version"); read::VersionedLayerClient client_without_version( - kHrn, kLayerId, boost::none, olp::client::OlpClientSettings()); + kHrn, kLayerId, olp::porting::none, olp::client::OlpClientSettings()); ASSERT_FALSE(client_without_version.Protect(kPartitionId)); ASSERT_FALSE(client_without_version.Release(kPartitionId)); } @@ -524,7 +527,8 @@ TEST(VersionedLayerClientTest, ProtectThenRelease) { ReadDefaultResponses::GenerateDataHandle(kOtherHereTile)); ASSERT_FALSE(other_tile_path.empty()); - read::VersionedLayerClientImpl client(kHrn, kLayerId, boost::none, settings); + read::VersionedLayerClientImpl client(kHrn, kLayerId, olp::porting::none, + settings); { SCOPED_TRACE("Cache tile key"); @@ -702,7 +706,8 @@ TEST(VersionedLayerClientTest, PrefetchPartitionsSplitted) { std::vector partitions = partitions1; partitions.insert(partitions.end(), partitions2.begin(), partitions2.end()); - read::VersionedLayerClientImpl client(kHrn, kLayerId, boost::none, settings); + read::VersionedLayerClientImpl client(kHrn, kLayerId, olp::porting::none, + settings); { SCOPED_TRACE("Prefetch multiple partitions"); @@ -833,7 +838,8 @@ TEST(VersionedLayerClientTest, PrefetchPartitionsSomeFail) { ReadDefaultResponses::GeneratePartitionsResponse(partitions_count); const auto request = read::PrefetchPartitionsRequest().WithPartitionIds(partitions); - read::VersionedLayerClientImpl client(kHrn, kLayerId, boost::none, settings); + read::VersionedLayerClientImpl client(kHrn, kLayerId, olp::porting::none, + settings); auto partitions_path = generator.PartitionsQuery(partitions, version); ASSERT_FALSE(partitions_path.empty()); { @@ -963,7 +969,8 @@ TEST(VersionedLayerClientTest, PrefetchPartitionsFail) { const auto request = read::PrefetchPartitionsRequest().WithPartitionIds(partitions); - read::VersionedLayerClientImpl client(kHrn, kLayerId, boost::none, settings); + read::VersionedLayerClientImpl client(kHrn, kLayerId, olp::porting::none, + settings); auto partitions_path = generator.PartitionsQuery(partitions, version); ASSERT_FALSE(partitions_path.empty()); { @@ -1127,7 +1134,8 @@ TEST(VersionedLayerClientTest, PrefetchPartitionsCancel) { } const auto request = read::PrefetchPartitionsRequest().WithPartitionIds(partitions); - read::VersionedLayerClientImpl client(kHrn, kLayerId, boost::none, settings); + read::VersionedLayerClientImpl client(kHrn, kLayerId, olp::porting::none, + settings); { SCOPED_TRACE("Cancel request"); std::promise block_promise; @@ -1368,7 +1376,7 @@ TEST(VersionedLayerClientTest, QuadTreeIndex) { const auto tile_key = olp::geo::TileKey::FromHereTile(kHereTile); auto client = std::make_shared( - kHrn, kLayerId, boost::none, settings); + kHrn, kLayerId, olp::porting::none, settings); { SCOPED_TRACE("Invalid tile key"); @@ -1473,7 +1481,8 @@ TEST(VersionedLayerClientTest, PropagateAllCacheErrors) { const auto kVersion = 4u; - read::VersionedLayerClientImpl client(kHrn, kLayerId, boost::none, settings); + read::VersionedLayerClientImpl client(kHrn, kLayerId, olp::porting::none, + settings); auto apis = ApiDefaultResponses::GenerateResourceApisResponse(kCatalog); auto api_response = ResponseGenerator::ResourceApis(apis);