From 95a7eb439100b945c0f60a1fa35261c047203be5 Mon Sep 17 00:00:00 2001 From: Alexander Sopov Date: Fri, 8 Aug 2025 09:46:01 +0200 Subject: [PATCH 1/2] 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 second part of the task: olp-cpp-sdk-write. Relates-To: NLAM-23 Signed-off-by: sopov --- .../olp/dataservice/write/StreamLayerClient.h | 4 +- .../dataservice/write/generated/model/Index.h | 22 ++++---- .../write/generated/model/Publication.h | 32 +++++------ .../write/model/PublishDataRequest.h | 22 ++++---- .../write/model/PublishIndexRequest.h | 18 +++---- .../write/model/PublishPartitionDataRequest.h | 22 ++++---- .../write/model/PublishSdiiRequest.h | 22 ++++---- .../write/model/StartBatchRequest.h | 26 ++++----- .../write/model/UpdateIndexRequest.h | 18 +++---- .../src/CatalogSettings.h | 2 +- .../src/IndexLayerClientImpl.cpp | 16 +++--- .../src/IndexLayerClientImpl.h | 2 +- .../src/StreamLayerClient.cpp | 2 +- .../src/StreamLayerClientImpl.cpp | 24 ++++----- .../src/StreamLayerClientImpl.h | 7 +-- .../src/VersionedLayerClientImpl.cpp | 40 +++++++------- .../src/VersionedLayerClientImpl.h | 6 +-- .../src/VolatileLayerClientImpl.cpp | 52 +++++++++--------- .../src/VolatileLayerClientImpl.h | 8 +-- .../src/generated/BlobApi.cpp | 25 ++++----- .../src/generated/BlobApi.h | 8 +-- .../src/generated/ConfigApi.cpp | 32 +++++------ .../src/generated/ConfigApi.h | 7 +-- .../src/generated/IndexApi.cpp | 22 ++++---- .../src/generated/IndexApi.h | 14 ++--- .../src/generated/IngestApi.cpp | 51 +++++++++--------- .../src/generated/IngestApi.h | 23 ++++---- .../src/generated/MetadataApi.cpp | 47 ++++++++-------- .../src/generated/MetadataApi.h | 14 ++--- .../src/generated/PublishApi.cpp | 40 ++++++-------- .../src/generated/PublishApi.h | 16 +++--- .../src/generated/QueryApi.cpp | 38 ++++++------- .../src/generated/QueryApi.h | 14 ++--- .../src/generated/model/Partitions.h | 36 +++++++------ .../src/generated/model/PublishPartition.h | 42 ++++++++------- .../src/generated/model/PublishPartitions.h | 9 ++-- .../src/generated/parser/PartitionsParser.cpp | 10 ++-- .../serializer/IndexInfoSerializer.cpp | 17 +++--- .../serializer/PublicationSerializer.cpp | 9 ++-- .../PublishDataRequestSerializer.cpp | 8 ++- .../serializer/PublishPartitionSerializer.cpp | 14 +++-- .../PublishPartitionsSerializer.cpp | 2 +- .../UpdateIndexRequestSerializer.cpp | 19 ++++--- .../tests/ParserTest.cpp | 53 +++++++++++-------- .../tests/StreamLayerClientImplTest.cpp | 11 ++-- ...ionedLayerClientImplPublishToBatchTest.cpp | 2 +- .../tests/VersionedLayerClientImplTest.cpp | 15 +++--- 47 files changed, 481 insertions(+), 462 deletions(-) diff --git a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/StreamLayerClient.h b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/StreamLayerClient.h index 8245f0f82..1d61b4649 100644 --- a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/StreamLayerClient.h +++ b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/StreamLayerClient.h @@ -124,10 +124,10 @@ class DATASERVICE_WRITE_API StreamLayerClient { * * @param request The `PublishDataRequest` object. * - * @return An optional boost that is `boost::none` if the queue call is + * @return An optional boost that is `olp::porting::none` if the queue call is * successful. Otherwise, it contains a string with error details. */ - boost::optional Queue(model::PublishDataRequest request); + porting::optional Queue(model::PublishDataRequest request); /** * @brief Flushes `PublishDataRequests` that are queued via the Queue API. diff --git a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/generated/model/Index.h b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/generated/model/Index.h index e34701117..299b18c8f 100644 --- a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/generated/model/Index.h +++ b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/generated/model/Index.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -324,9 +324,9 @@ class DATASERVICE_WRITE_API Index final { : id_(std::move(uuid)), indexFields_(std::move(indexFields)) {} private: - boost::optional checksum_; - boost::optional> metadata_; - boost::optional size_; + porting::optional checksum_; + porting::optional> metadata_; + porting::optional size_; std::string id_; std::map> indexFields_; @@ -336,14 +336,16 @@ class DATASERVICE_WRITE_API Index final { * * @return The checksum. */ - const boost::optional& GetCheckSum() const { return checksum_; } + const porting::optional& GetCheckSum() const { + return checksum_; + } /** * @brief Gets a mutable reference to the checksum of the index layer. * * @return The mutable reference to the checksum. */ - boost::optional& GetMutableCheckSum() { return checksum_; } + porting::optional& GetMutableCheckSum() { return checksum_; } /** * @brief Sets the checksum. @@ -357,7 +359,7 @@ class DATASERVICE_WRITE_API Index final { * * @return The metadata of the index layer. */ - const boost::optional>& GetMetadata() + const porting::optional>& GetMetadata() const { return metadata_; } @@ -367,7 +369,7 @@ class DATASERVICE_WRITE_API Index final { * * @return The mutable reference to the metadata. */ - boost::optional>& GetMutableMetadata() { + porting::optional>& GetMutableMetadata() { return metadata_; } @@ -435,14 +437,14 @@ class DATASERVICE_WRITE_API Index final { * * @return The size of the index layer. */ - const boost::optional& GetSize() const { return size_; } + const porting::optional& GetSize() const { return size_; } /** * @brief Gets a mutable reference to the size of the index layer. * * @return The mutable reference to the size of the index layer. */ - boost::optional& GetMutableSize() { return size_; } + porting::optional& GetMutableSize() { return size_; } /** * @brief Sets the size of the index layer. diff --git a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/generated/model/Publication.h b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/generated/model/Publication.h index e97ebbfc6..36a64e143 100644 --- a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/generated/model/Publication.h +++ b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/generated/model/Publication.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -44,11 +44,11 @@ class DATASERVICE_WRITE_API Publication { virtual ~Publication() = default; private: - boost::optional id_; - boost::optional
details_; - boost::optional> layer_ids_; - boost::optional catalog_version_; - boost::optional> version_dependencies_; + porting::optional id_; + porting::optional
details_; + porting::optional> layer_ids_; + porting::optional catalog_version_; + porting::optional> version_dependencies_; public: /** @@ -56,14 +56,14 @@ class DATASERVICE_WRITE_API Publication { * * @return The publication ID. */ - const boost::optional& GetId() const { return id_; } + const porting::optional& GetId() const { return id_; } /** * @brief Gets a mutable reference to the publication ID. * * @return The mutable reference to the publication ID. */ - boost::optional& GetMutableId() { return id_; } + porting::optional& GetMutableId() { return id_; } /** * @brief Sets the publication ID. @@ -77,14 +77,14 @@ class DATASERVICE_WRITE_API Publication { * * @return The details of the publication. */ - const boost::optional
& GetDetails() const { return details_; } + const porting::optional
& GetDetails() const { return details_; } /** * @brief Gets a mutable reference to the details of the publication. * * @return The mutable reference to the details of the publication. */ - boost::optional
& GetMutableDetails() { return details_; } + porting::optional
& GetMutableDetails() { return details_; } /** * @brief Sets the details of the publication. @@ -98,7 +98,7 @@ class DATASERVICE_WRITE_API Publication { * * @return The layer ID. */ - const boost::optional>& GetLayerIds() const { + const porting::optional>& GetLayerIds() const { return layer_ids_; } @@ -108,7 +108,7 @@ class DATASERVICE_WRITE_API Publication { * * @return The mutable reference to the layer ID. */ - boost::optional>& GetMutableLayerIds() { + porting::optional>& GetMutableLayerIds() { return layer_ids_; } @@ -126,7 +126,7 @@ class DATASERVICE_WRITE_API Publication { * * @return The catalog version. */ - const boost::optional& GetCatalogVersion() const { + const porting::optional& GetCatalogVersion() const { return catalog_version_; } @@ -137,7 +137,7 @@ class DATASERVICE_WRITE_API Publication { * @return The mutable reference to the version of the catalog to be * published. */ - boost::optional& GetMutableCatalogVersion() { + porting::optional& GetMutableCatalogVersion() { return catalog_version_; } @@ -155,7 +155,7 @@ class DATASERVICE_WRITE_API Publication { * * @return The version dependencies. */ - const boost::optional>& + const porting::optional>& GetVersionDependencies() const { return version_dependencies_; } @@ -165,7 +165,7 @@ class DATASERVICE_WRITE_API Publication { * * @return The mutable reference to the version dependencies. */ - boost::optional>& + porting::optional>& GetMutableVersionDependencies() { return version_dependencies_; } diff --git a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishDataRequest.h b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishDataRequest.h index 3e47cf8f3..850aca3b4 100644 --- a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishDataRequest.h +++ b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishDataRequest.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -113,7 +113,7 @@ class DATASERVICE_WRITE_API PublishDataRequest { * * @return The trace ID of the request. */ - inline const boost::optional& GetTraceId() const { + inline const porting::optional& GetTraceId() const { return trace_id_; } @@ -152,10 +152,10 @@ class DATASERVICE_WRITE_API PublishDataRequest { * 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 { + inline const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -164,7 +164,7 @@ class DATASERVICE_WRITE_API PublishDataRequest { * * @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`. */ inline PublishDataRequest& WithBillingTag(const std::string& billing_tag) { billing_tag_ = billing_tag; @@ -177,7 +177,7 @@ class DATASERVICE_WRITE_API PublishDataRequest { * @see `GetBillingTag()` for information on usage and format. * * @param billing_tag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * `olp::porting::none`. */ inline PublishDataRequest& WithBillingTag(std::string&& billing_tag) { billing_tag_ = std::move(billing_tag); @@ -195,7 +195,7 @@ class DATASERVICE_WRITE_API PublishDataRequest { * * @return The request checksum. */ - inline const boost::optional& GetChecksum() const { + inline const porting::optional& GetChecksum() const { return checksum_; } @@ -228,11 +228,11 @@ class DATASERVICE_WRITE_API PublishDataRequest { std::string layer_id_; - boost::optional trace_id_; + porting::optional trace_id_; - boost::optional billing_tag_; + porting::optional billing_tag_; - boost::optional checksum_; + porting::optional checksum_; }; } // namespace model diff --git a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishIndexRequest.h b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishIndexRequest.h index d83871927..8ead25231 100644 --- a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishIndexRequest.h +++ b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishIndexRequest.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -112,10 +112,10 @@ class DATASERVICE_WRITE_API PublishIndexRequest { * 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 { + inline const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -125,7 +125,7 @@ class DATASERVICE_WRITE_API PublishIndexRequest { * @see `GetBillingTag()` for information on usage and format. * * @param billing_tag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * `olp::porting::none`. */ inline PublishIndexRequest& WithBillingTag(const std::string& billing_tag) { billing_tag_ = billing_tag; @@ -138,7 +138,7 @@ class DATASERVICE_WRITE_API PublishIndexRequest { * @see `GetBillingTag()` for information on usage and format. * * @param billing_tag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * `olp::porting::none`. */ inline PublishIndexRequest& WithBillingTag(std::string&& billing_tag) { billing_tag_ = std::move(billing_tag); @@ -156,7 +156,7 @@ class DATASERVICE_WRITE_API PublishIndexRequest { * * @return The request checksum. */ - inline const boost::optional& GetChecksum() const { + inline const porting::optional& GetChecksum() const { return checksum_; } @@ -226,9 +226,9 @@ class DATASERVICE_WRITE_API PublishIndexRequest { std::string layer_id_; - boost::optional billing_tag_; + porting::optional billing_tag_; - boost::optional checksum_; + porting::optional checksum_; Index index_; }; diff --git a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishPartitionDataRequest.h b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishPartitionDataRequest.h index 9580e3a9a..613f5a105 100644 --- a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishPartitionDataRequest.h +++ b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishPartitionDataRequest.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -111,7 +111,7 @@ class DATASERVICE_WRITE_API PublishPartitionDataRequest { * * @return The partition ID. */ - inline const boost::optional& GetPartitionId() const { + inline const porting::optional& GetPartitionId() const { return partition_id_; } @@ -150,10 +150,10 @@ class DATASERVICE_WRITE_API PublishPartitionDataRequest { * 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 { + inline const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -162,7 +162,7 @@ class DATASERVICE_WRITE_API PublishPartitionDataRequest { * * @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`. */ inline PublishPartitionDataRequest& WithBillingTag( const std::string& billing_tag) { @@ -176,7 +176,7 @@ class DATASERVICE_WRITE_API PublishPartitionDataRequest { * @see `GetBillingTag()` for information on usage and format. * * @param billing_tag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * `olp::porting::none`. */ inline PublishPartitionDataRequest& WithBillingTag( std::string&& billing_tag) { @@ -195,7 +195,7 @@ class DATASERVICE_WRITE_API PublishPartitionDataRequest { * * @return The request checksum. */ - inline const boost::optional& GetChecksum() const { + inline const porting::optional& GetChecksum() const { return checksum_; } @@ -229,11 +229,11 @@ class DATASERVICE_WRITE_API PublishPartitionDataRequest { std::string layer_id_; - boost::optional partition_id_; + porting::optional partition_id_; - boost::optional billing_tag_; + porting::optional billing_tag_; - boost::optional checksum_; + porting::optional checksum_; }; } // namespace model diff --git a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishSdiiRequest.h b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishSdiiRequest.h index 3cb126566..0f3d08273 100644 --- a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishSdiiRequest.h +++ b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/PublishSdiiRequest.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include @@ -127,7 +127,7 @@ class DATASERVICE_WRITE_API PublishSdiiRequest { * * @return The trace ID of the request. */ - inline const boost::optional& GetTraceId() const { + inline const porting::optional& GetTraceId() const { return trace_id_; } @@ -166,10 +166,10 @@ class DATASERVICE_WRITE_API PublishSdiiRequest { * 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 { + inline const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -178,7 +178,7 @@ class DATASERVICE_WRITE_API PublishSdiiRequest { * * @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`. */ inline PublishSdiiRequest& WithBillingTag(const std::string& billing_tag) { billing_tag_ = billing_tag; @@ -191,7 +191,7 @@ class DATASERVICE_WRITE_API PublishSdiiRequest { * @see `GetBillingTag()` for information on usage and format. * * @param billing_tag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * `olp::porting::none`. */ inline PublishSdiiRequest& WithBillingTag(std::string&& billing_tag) { billing_tag_ = std::move(billing_tag); @@ -209,7 +209,7 @@ class DATASERVICE_WRITE_API PublishSdiiRequest { * * @return The request checksum. */ - inline const boost::optional& GetChecksum() const { + inline const porting::optional& GetChecksum() const { return checksum_; } @@ -242,11 +242,11 @@ class DATASERVICE_WRITE_API PublishSdiiRequest { std::string layer_id_; - boost::optional trace_id_; + porting::optional trace_id_; - boost::optional billing_tag_; + porting::optional billing_tag_; - boost::optional checksum_; + porting::optional checksum_; }; } // namespace model diff --git a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/StartBatchRequest.h b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/StartBatchRequest.h index 4157e6a7b..e3e928d4f 100644 --- a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/StartBatchRequest.h +++ b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/StartBatchRequest.h @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -48,7 +48,7 @@ class DATASERVICE_WRITE_API StartBatchRequest { * * @param layers The layer IDs. */ - inline StartBatchRequest& WithLayers(std::vector layers) { + StartBatchRequest& WithLayers(std::vector layers) { layers_ = std::move(layers); return *this; } @@ -58,7 +58,7 @@ class DATASERVICE_WRITE_API StartBatchRequest { * * @return The layer IDs. */ - inline const boost::optional>& GetLayers() const { + const porting::optional>& GetLayers() const { return layers_; } @@ -67,7 +67,7 @@ class DATASERVICE_WRITE_API StartBatchRequest { * * @param versionDependencies The version dependencies. */ - inline StartBatchRequest& WithVersionDependencies( + StartBatchRequest& WithVersionDependencies( std::vector versionDependencies) { versionDependencies_ = std::move(versionDependencies); return *this; @@ -78,7 +78,7 @@ class DATASERVICE_WRITE_API StartBatchRequest { * * @return The version dependencies. */ - inline const boost::optional>& + const porting::optional>& GetVersionDependencies() const { return versionDependencies_; } @@ -90,10 +90,10 @@ class DATASERVICE_WRITE_API StartBatchRequest { * 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_; } @@ -102,17 +102,17 @@ class DATASERVICE_WRITE_API StartBatchRequest { * * @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`. */ - inline StartBatchRequest& WithBillingTag(std::string billing_tag) { + StartBatchRequest& WithBillingTag(std::string billing_tag) { billing_tag_ = std::move(billing_tag); return *this; } private: - boost::optional> layers_; - boost::optional> versionDependencies_; - boost::optional billing_tag_; + porting::optional> layers_; + porting::optional> versionDependencies_; + porting::optional billing_tag_; }; } // namespace model diff --git a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/UpdateIndexRequest.h b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/UpdateIndexRequest.h index fcb202070..21e5ede93 100644 --- a/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/UpdateIndexRequest.h +++ b/olp-cpp-sdk-dataservice-write/include/olp/dataservice/write/model/UpdateIndexRequest.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include @@ -80,10 +80,10 @@ class DATASERVICE_WRITE_API UpdateIndexRequest { * 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 { + inline const porting::optional& GetBillingTag() const { return billing_tag_; } @@ -92,7 +92,7 @@ class DATASERVICE_WRITE_API UpdateIndexRequest { * * @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`. */ inline UpdateIndexRequest& WithBillingTag(const std::string& billing_tag) { billing_tag_ = billing_tag; @@ -105,7 +105,7 @@ class DATASERVICE_WRITE_API UpdateIndexRequest { * @see `GetBillingTag()` for information on usage and format. * * @param billing_tag The rvalue reference to the `BillingTag` string or - * `boost::none`. + * `olp::porting::none`. */ inline UpdateIndexRequest& WithBillingTag(std::string&& billing_tag) { billing_tag_ = std::move(billing_tag); @@ -123,7 +123,7 @@ class DATASERVICE_WRITE_API UpdateIndexRequest { * * @return The request checksum. */ - inline const boost::optional& GetChecksum() const { + inline const porting::optional& GetChecksum() const { return checksum_; } @@ -222,9 +222,9 @@ class DATASERVICE_WRITE_API UpdateIndexRequest { private: std::string layer_id_; - boost::optional billing_tag_; + porting::optional billing_tag_; - boost::optional checksum_; + porting::optional checksum_; std::vector indexAdditions_; diff --git a/olp-cpp-sdk-dataservice-write/src/CatalogSettings.h b/olp-cpp-sdk-dataservice-write/src/CatalogSettings.h index 7fc797d38..4bcf53e13 100644 --- a/olp-cpp-sdk-dataservice-write/src/CatalogSettings.h +++ b/olp-cpp-sdk-dataservice-write/src/CatalogSettings.h @@ -38,7 +38,7 @@ class Catalog; class CatalogSettings { public: - using BillingTag = boost::optional; + using BillingTag = porting::optional; struct LayerSettings { std::string content_type; diff --git a/olp-cpp-sdk-dataservice-write/src/IndexLayerClientImpl.cpp b/olp-cpp-sdk-dataservice-write/src/IndexLayerClientImpl.cpp index c016ee329..0ee6b00f1 100644 --- a/olp-cpp-sdk-dataservice-write/src/IndexLayerClientImpl.cpp +++ b/olp-cpp-sdk-dataservice-write/src/IndexLayerClientImpl.cpp @@ -74,7 +74,7 @@ olp::client::CancellationToken IndexLayerClientImpl::InitApiClients( ul.lock(); } if (apiclient_index_ && !apiclient_index_->GetBaseUrl().empty()) { - callback(boost::none); + callback(olp::porting::none); return {}; } @@ -97,7 +97,7 @@ olp::client::CancellationToken IndexLayerClientImpl::InitApiClients( self->cond_var_.notify_one(); } else { self->apiclient_index_->SetBaseUrl(apis.GetResult().at(0).GetBaseUrl()); - callback(boost::none); + callback(olp::porting::none); self->cond_var_.notify_all(); } }; @@ -250,7 +250,7 @@ client::CancellationToken IndexLayerClientImpl::DeleteIndexData( auto delete_index_data_function = [=]() -> client::CancellationToken { return BlobApi::deleteBlob( - *self->apiclient_blob_, layer_id, index_id, boost::none, + *self->apiclient_blob_, layer_id, index_id, olp::porting::none, [=](DeleteBlobRespone response) { self->tokenList_.RemoveTask(op_id); if (!response.IsSuccessful()) { @@ -262,10 +262,10 @@ client::CancellationToken IndexLayerClientImpl::DeleteIndexData( }; auto init_api_client_callback = - [=](boost::optional init_api_error) { + [=](porting::optional init_api_error) { if (init_api_error) { self->tokenList_.RemoveTask(op_id); - callback(DeleteBlobRespone(init_api_error.get())); + callback(DeleteBlobRespone(*init_api_error)); return; } @@ -319,16 +319,16 @@ client::CancellationToken IndexLayerClientImpl::UpdateIndex( auto UpdateIndex_function = [=]() -> client::CancellationToken { return IndexApi::performUpdate(*self->apiclient_index_, request, - boost::none, updateIndex_callback); + olp::porting::none, updateIndex_callback); }; cancel_context->ExecuteOrCancelled( [=]() -> client::CancellationToken { return self->InitApiClients( - cancel_context, [=](boost::optional api_error) { + cancel_context, [=](porting::optional api_error) { if (api_error) { self->tokenList_.RemoveTask(op_id); - callback(UpdateIndexResponse(api_error.get())); + callback(UpdateIndexResponse(*api_error)); return; } cancel_context->ExecuteOrCancelled(UpdateIndex_function, diff --git a/olp-cpp-sdk-dataservice-write/src/IndexLayerClientImpl.h b/olp-cpp-sdk-dataservice-write/src/IndexLayerClientImpl.h index e06bc06bc..b15df3c11 100644 --- a/olp-cpp-sdk-dataservice-write/src/IndexLayerClientImpl.h +++ b/olp-cpp-sdk-dataservice-write/src/IndexLayerClientImpl.h @@ -43,7 +43,7 @@ class PublishDataRequest; } using InitApiClientsCallback = - std::function)>; + std::function)>; class IndexLayerClientImpl final : public std::enable_shared_from_this { diff --git a/olp-cpp-sdk-dataservice-write/src/StreamLayerClient.cpp b/olp-cpp-sdk-dataservice-write/src/StreamLayerClient.cpp index 8ce0c5b86..a27b725f0 100644 --- a/olp-cpp-sdk-dataservice-write/src/StreamLayerClient.cpp +++ b/olp-cpp-sdk-dataservice-write/src/StreamLayerClient.cpp @@ -53,7 +53,7 @@ olp::client::CancellationToken StreamLayerClient::PublishData( return impl_->PublishData(request, std::move(callback)); } -boost::optional StreamLayerClient::Queue( +porting::optional StreamLayerClient::Queue( model::PublishDataRequest request) { return impl_->Queue(request); } diff --git a/olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.cpp b/olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.cpp index 7446ca049..e24908dc8 100644 --- a/olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.cpp +++ b/olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.cpp @@ -101,26 +101,26 @@ size_t StreamLayerClientImpl::QueueSize() const { return 0; } -boost::optional StreamLayerClientImpl::Queue( +porting::optional StreamLayerClientImpl::Queue( const model::PublishDataRequest& request) { if (!cache_) { - return boost::make_optional( + return olp::porting::make_optional( "No cache provided to StreamLayerClient"); } if (!request.GetData()) { - return boost::make_optional( + return olp::porting::make_optional( "PublishDataRequest does not contain any Data"); } if (request.GetLayerId().empty()) { - return boost::make_optional( + return olp::porting::make_optional( "PublishDataRequest does not contain a Layer ID"); } if (!(StreamLayerClientImpl::QueueSize() < stream_client_settings_.maximum_requests)) { - return boost::make_optional( + return olp::porting::make_optional( "Maximum number of requests has reached"); } @@ -143,10 +143,10 @@ boost::optional StreamLayerClientImpl::Queue( [&uuid_list]() { return uuid_list; }); } - return boost::none; + return olp::porting::none; } -boost::optional +porting::optional StreamLayerClientImpl::PopFromQueue() { std::lock_guard lock(cache_mutex_); @@ -155,14 +155,14 @@ StreamLayerClientImpl::PopFromQueue() { if (uuid_list_any.empty()) { OLP_SDK_LOG_ERROR(kLogTag, "Unable to Restore UUID list from Cache"); - return boost::none; + return olp::porting::none; } auto uuid_list = boost::any_cast(uuid_list_any); auto pos = uuid_list.find(","); if (pos == std::string::npos) { - return boost::none; + return olp::porting::none; } const auto publish_data_key = uuid_list.substr(0, pos); @@ -179,7 +179,7 @@ StreamLayerClientImpl::PopFromQueue() { if (publish_data_any.empty()) { OLP_SDK_LOG_ERROR(kLogTag, "Unable to Restore PublishData Request from Cache"); - return boost::none; + return olp::porting::none; } return boost::any_cast(publish_data_any); @@ -225,7 +225,7 @@ olp::client::CancellationToken StreamLayerClientImpl::Flush( while ((!maximum_events_number || counter < maximum_events_number) && (this->QueueSize() > 0) && !context.IsCancelled()) { auto publish_request = this->PopFromQueue(); - if (publish_request == boost::none) { + if (publish_request == olp::porting::none) { continue; } @@ -412,7 +412,7 @@ PublishDataResponse StreamLayerClientImpl::PublishDataGreaterThanTwentyMib( "doesn't contain any publication")); } const std::string publication_id = - init_publicaion_response.GetResult().GetId().get(); + *init_publicaion_response.GetResult().GetId(); // 2. Put blob API: const auto data_handle = GenerateUuid(); diff --git a/olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.h b/olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.h index b97a872ec..3aeae9be4 100644 --- a/olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.h +++ b/olp-cpp-sdk-dataservice-write/src/StreamLayerClientImpl.h @@ -21,7 +21,7 @@ #include -#include +#include #include #include @@ -54,13 +54,14 @@ class StreamLayerClientImpl { olp::client::CancellationToken PublishData(model::PublishDataRequest request, PublishDataCallback callback); - boost::optional Queue(const model::PublishDataRequest& request); + porting::optional Queue( + const model::PublishDataRequest& request); olp::client::CancellableFuture Flush( model::FlushRequest request); olp::client::CancellationToken Flush( model::FlushRequest request, StreamLayerClient::FlushCallback callback); size_t QueueSize() const; - boost::optional PopFromQueue(); + porting::optional PopFromQueue(); client::CancellableFuture PublishSdii( model::PublishSdiiRequest request); diff --git a/olp-cpp-sdk-dataservice-write/src/VersionedLayerClientImpl.cpp b/olp-cpp-sdk-dataservice-write/src/VersionedLayerClientImpl.cpp index 4dc4b46d2..ecefefa47 100644 --- a/olp-cpp-sdk-dataservice-write/src/VersionedLayerClientImpl.cpp +++ b/olp-cpp-sdk-dataservice-write/src/VersionedLayerClientImpl.cpp @@ -74,7 +74,7 @@ olp::client::CancellationToken VersionedLayerClientImpl::InitApiClients( ul.lock(); } if (apiclient_publish_ && !apiclient_publish_->GetBaseUrl().empty()) { - callback(boost::none); + callback(olp::porting::none); return {}; } @@ -99,7 +99,7 @@ olp::client::CancellationToken VersionedLayerClientImpl::InitApiClients( self->cond_var_.notify_one(); } else { self->apiclient_publish_->SetBaseUrl(apis.GetResult().at(0).GetBaseUrl()); - callback(boost::none); + callback(olp::porting::none); self->cond_var_.notify_all(); } }; @@ -248,17 +248,18 @@ olp::client::CancellationToken VersionedLayerClientImpl::GetBaseVersion( }; auto getBaseVersion_function = [=]() -> client::CancellationToken { - return MetadataApi::GetLatestCatalogVersion( - *self->apiclient_metadata_, -1, boost::none, getBaseVersion_callback); + return MetadataApi::GetLatestCatalogVersion(*self->apiclient_metadata_, -1, + olp::porting::none, + getBaseVersion_callback); }; cancel_context->ExecuteOrCancelled( [=]() -> client::CancellationToken { return self->InitApiClients( - cancel_context, [=](boost::optional err) { + cancel_context, [=](porting::optional err) { if (err) { self->tokenList_.RemoveTask(id); - callback(err.get()); + callback(*err); return; } cancel_context->ExecuteOrCancelled(getBaseVersion_function, @@ -315,16 +316,17 @@ olp::client::CancellationToken VersionedLayerClientImpl::GetBatch( auto getPublication_function = [=]() -> client::CancellationToken { return PublishApi::GetPublication(*self->apiclient_publish_, publicationId, - boost::none, getPublication_callback); + olp::porting::none, + getPublication_callback); }; cancel_context->ExecuteOrCancelled( [=]() -> client::CancellationToken { return self->InitApiClients( - cancel_context, [=](boost::optional err) { + cancel_context, [=](porting::optional err) { if (err) { self->tokenList_.RemoveTask(id); - callback(err.get()); + callback(*err); return; } cancel_context->ExecuteOrCancelled(getPublication_function, @@ -360,7 +362,7 @@ olp::client::CancellationToken VersionedLayerClientImpl::CompleteBatch( if (!publication.GetId()) { return {{client::ErrorCode::InvalidArgument, "Invalid publication"}}; } - const auto& id = publication.GetId().get(); + const auto& id = *publication.GetId(); auto olp_client_response = ApiClientLookup::LookupApiClient( catalog, context, "publish", "v2", settings); @@ -370,7 +372,8 @@ olp::client::CancellationToken VersionedLayerClientImpl::CompleteBatch( auto olp_client = olp_client_response.MoveResult(); - return PublishApi::SubmitPublication(olp_client, id, boost::none, context); + return PublishApi::SubmitPublication(olp_client, id, olp::porting::none, + context); }; return AddTask(settings_.task_scheduler, pending_requests_, std::move(task), @@ -406,7 +409,8 @@ olp::client::CancellationToken VersionedLayerClientImpl::CancelBatch( } return PublishApi::CancelPublication(client_response.GetResult(), - publication_id, boost::none, context); + publication_id, olp::porting::none, + context); }; return AddTask(settings_.task_scheduler, pending_requests_, @@ -441,7 +445,7 @@ olp::client::CancellationToken VersionedLayerClientImpl::PublishToBatch( return {{client::ErrorCode::InvalidArgument, "Invalid publication: publication ID missing", true}}; } - const auto& publication_id = pub.GetId().get(); + const auto& publication_id = *pub.GetId(); const auto& layer_id = request.GetLayerId(); if (layer_id.empty()) { @@ -513,8 +517,8 @@ UploadPartitionResponse VersionedLayerClientImpl::UploadPartition( partitions.SetPartitions({publish_partition}); return PublishApi::UploadPartitions(publish_client, partitions, - publication_id, layer_id, boost::none, - context); + publication_id, layer_id, + olp::porting::none, context); } UploadBlobResponse VersionedLayerClientImpl::UploadBlob( @@ -574,7 +578,7 @@ client::CancellationToken VersionedLayerClientImpl::CheckDataExists( auto check_data_exists_function = [=]() -> client::CancellationToken { return BlobApi::checkBlobExists(*self->apiclient_blob_, layer_id, - data_handle, boost::none, + data_handle, olp::porting::none, check_data_exists_callback); }; @@ -586,9 +590,9 @@ client::CancellationToken VersionedLayerClientImpl::CheckDataExists( cancel_context->ExecuteOrCancelled( [=]() -> client::CancellationToken { return self->InitApiClients( - cancel_context, [=](boost::optional err) { + cancel_context, [=](porting::optional err) { if (err) { - callback(err.get()); + callback(*err); return; } cancel_context->ExecuteOrCancelled(check_data_exists_function, diff --git a/olp-cpp-sdk-dataservice-write/src/VersionedLayerClientImpl.h b/olp-cpp-sdk-dataservice-write/src/VersionedLayerClientImpl.h index e65805758..35ca30121 100644 --- a/olp-cpp-sdk-dataservice-write/src/VersionedLayerClientImpl.h +++ b/olp-cpp-sdk-dataservice-write/src/VersionedLayerClientImpl.h @@ -39,9 +39,9 @@ namespace dataservice { namespace write { using InitApiClientsCallback = - std::function)>; + std::function)>; using InitCatalogModelCallback = - std::function)>; + std::function)>; using UploadPartitionResult = client::ApiNoResult; using UploadPartitionResponse = @@ -109,7 +109,7 @@ class VersionedLayerClientImpl CheckDataExistsCallback callback); private: - using BillingTag = boost::optional; + using BillingTag = porting::optional; client::CancellationToken InitApiClients( std::shared_ptr cancel_context, diff --git a/olp-cpp-sdk-dataservice-write/src/VolatileLayerClientImpl.cpp b/olp-cpp-sdk-dataservice-write/src/VolatileLayerClientImpl.cpp index 276d999dc..332d7c043 100644 --- a/olp-cpp-sdk-dataservice-write/src/VolatileLayerClientImpl.cpp +++ b/olp-cpp-sdk-dataservice-write/src/VolatileLayerClientImpl.cpp @@ -68,7 +68,7 @@ client::CancellationToken VolatileLayerClientImpl::InitApiClients( ul.lock(); } if (apiclient_publish_ && !apiclient_publish_->GetBaseUrl().empty()) { - callback(boost::none); + callback(olp::porting::none); return {}; } @@ -93,7 +93,7 @@ client::CancellationToken VolatileLayerClientImpl::InitApiClients( self->cond_var_.notify_one(); } else { self->apiclient_publish_->SetBaseUrl(apis.GetResult().at(0).GetBaseUrl()); - callback(boost::none); + callback(olp::porting::none); self->cond_var_.notify_all(); } }; @@ -210,17 +210,18 @@ client::CancellationToken VolatileLayerClientImpl::GetBaseVersion( }; auto getBaseVersion_function = [=]() -> client::CancellationToken { - return MetadataApi::GetLatestCatalogVersion( - *self->apiclient_metadata_, -1, boost::none, getBaseVersion_callback); + return MetadataApi::GetLatestCatalogVersion(*self->apiclient_metadata_, -1, + olp::porting::none, + getBaseVersion_callback); }; cancel_context->ExecuteOrCancelled( [=]() -> client::CancellationToken { return self->InitApiClients( - cancel_context, [=](boost::optional api_error) { + cancel_context, [=](porting::optional api_error) { if (api_error) { self->tokenList_.RemoveTask(id); - callback(GetBaseVersionResponse(api_error.get())); + callback(GetBaseVersionResponse(*api_error)); return; } cancel_context->ExecuteOrCancelled(getBaseVersion_function, @@ -283,10 +284,10 @@ client::CancellationToken VolatileLayerClientImpl::StartBatch( cancel_context->ExecuteOrCancelled( [=]() -> client::CancellationToken { return self->InitApiClients( - cancel_context, [=](boost::optional api_error) { + cancel_context, [=](porting::optional api_error) { if (api_error) { self->tokenList_.RemoveTask(id); - callback(StartBatchResponse(api_error.get())); + callback(StartBatchResponse(*api_error)); return; } cancel_context->ExecuteOrCancelled(init_publication_function, @@ -325,13 +326,13 @@ client::CancellationToken VolatileLayerClientImpl::PublishPartitionData( auto publish_task = [=](client::CancellationContext context) -> PublishPartitionDataResponse { - auto partition_id = request.GetPartitionId().get(); + auto partition_id = *request.GetPartitionId(); - auto data_handle_response = - GetDataHandleMap(request.GetLayerId(), - std::vector{ - request.GetPartitionId().value_or(std::string())}, - boost::none, boost::none, boost::none, context); + auto data_handle_response = GetDataHandleMap( + request.GetLayerId(), + std::vector{ + request.GetPartitionId().value_or(std::string())}, + olp::porting::none, olp::porting::none, olp::porting::none, context); if (!data_handle_response.IsSuccessful()) { return data_handle_response.GetError(); @@ -436,17 +437,18 @@ client::CancellationToken VolatileLayerClientImpl::GetBatch( auto getPublication_function = [=]() -> client::CancellationToken { return PublishApi::GetPublication(*self->apiclient_publish_, publicationId, - boost::none, getPublication_callback); + olp::porting::none, + getPublication_callback); }; cancel_context->ExecuteOrCancelled( [=]() -> client::CancellationToken { return self->InitApiClients( cancel_context, - [=](boost::optional init_api_error) { + [=](porting::optional init_api_error) { if (init_api_error) { self->tokenList_.RemoveTask(id); - callback(GetPublicationResponse(init_api_error.get())); + callback(GetPublicationResponse(*init_api_error)); return; } cancel_context->ExecuteOrCancelled(getPublication_function, @@ -463,9 +465,9 @@ client::CancellationToken VolatileLayerClientImpl::GetBatch( DataHandleMapResponse VolatileLayerClientImpl::GetDataHandleMap( const std::string& layer_id, const std::vector& partition_ids, - boost::optional version, - boost::optional> additional_fields, - boost::optional billing_tag, + porting::optional version, + porting::optional> additional_fields, + porting::optional billing_tag, client::CancellationContext context) { if (partition_ids.empty() || layer_id.empty()) { return client::ApiError(client::ErrorCode::InvalidArgument, @@ -611,10 +613,10 @@ client::CancellationToken VolatileLayerClientImpl::PublishToBatch( cancel_context->ExecuteOrCancelled( [=]() -> client::CancellationToken { return self->InitApiClients( - cancel_context, [=](boost::optional api_error) { + cancel_context, [=](porting::optional api_error) { if (api_error) { self->tokenList_.RemoveTask(id); - callback(api_error.get()); + callback(*api_error); return; } cancel_context->ExecuteOrCancelled(upload_partitions_function, @@ -670,17 +672,17 @@ client::CancellationToken VolatileLayerClientImpl::CompleteBatch( auto completePublication_function = [=]() -> client::CancellationToken { return PublishApi::SubmitPublication(*self->apiclient_publish_, - publicationId, boost::none, + publicationId, olp::porting::none, completePublication_callback); }; cancel_context->ExecuteOrCancelled( [=]() -> client::CancellationToken { return self->InitApiClients( - cancel_context, [=](boost::optional api_error) { + cancel_context, [=](porting::optional api_error) { if (api_error) { self->tokenList_.RemoveTask(id); - callback(CompleteBatchResponse(api_error.get())); + callback(CompleteBatchResponse(*api_error)); return; } cancel_context->ExecuteOrCancelled(completePublication_function, diff --git a/olp-cpp-sdk-dataservice-write/src/VolatileLayerClientImpl.h b/olp-cpp-sdk-dataservice-write/src/VolatileLayerClientImpl.h index bf332a2af..40b7c0812 100644 --- a/olp-cpp-sdk-dataservice-write/src/VolatileLayerClientImpl.h +++ b/olp-cpp-sdk-dataservice-write/src/VolatileLayerClientImpl.h @@ -43,7 +43,7 @@ class Partition; } // namespace model using InitApiClientsCallback = - std::function)>; + std::function)>; using DataHandleMap = std::map; using DataHandleMapResponse = client::ApiResponse; @@ -106,9 +106,9 @@ class VolatileLayerClientImpl final DataHandleMapResponse GetDataHandleMap( const std::string& layerId, const std::vector& partitionIds, - boost::optional version, - boost::optional> additionalFields, - boost::optional billingTag, + porting::optional version, + porting::optional> additionalFields, + porting::optional billingTag, const client::CancellationContext context); private: diff --git a/olp-cpp-sdk-dataservice-write/src/generated/BlobApi.cpp b/olp-cpp-sdk-dataservice-write/src/generated/BlobApi.cpp index dfe9e62fa..3ce1e2c44 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/BlobApi.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/BlobApi.cpp @@ -43,7 +43,8 @@ client::CancellationToken BlobApi::PutBlob( const std::string& content_type, const std::string& content_encoding, const std::string& data_handle, const std::shared_ptr>& data, - const boost::optional& billing_tag, PutBlobCallback callback) { + const porting::optional& billing_tag, + PutBlobCallback callback) { std::multimap header_params; std::multimap query_params; std::multimap form_params; @@ -54,8 +55,7 @@ client::CancellationToken BlobApi::PutBlob( } if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string put_blob_uri = "/layers/" + layer_id + "/data/" + data_handle; @@ -81,7 +81,7 @@ PutBlobResponse BlobApi::PutBlob( const std::string& content_type, const std::string& content_encoding, const std::string& data_handle, const std::shared_ptr>& data, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext cancel_context) { std::multimap header_params; std::multimap query_params; @@ -94,8 +94,7 @@ PutBlobResponse BlobApi::PutBlob( } if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string put_blob_uri = "/layers/" + layer_id + "/data/" + data_handle; @@ -107,8 +106,8 @@ PutBlobResponse BlobApi::PutBlob( if (http_response.GetStatus() != olp::http::HttpStatusCode::OK && http_response.GetStatus() != olp::http::HttpStatusCode::NO_CONTENT) { - return PutBlobResponse( - client::ApiError(http_response.GetStatus(), http_response.GetResponseAsString())); + return PutBlobResponse(client::ApiError( + http_response.GetStatus(), http_response.GetResponseAsString())); } return PutBlobResponse(client::ApiNoResult()); @@ -117,7 +116,7 @@ PutBlobResponse BlobApi::PutBlob( client::CancellationToken BlobApi::deleteBlob( const client::OlpClient& client, const std::string& layer_id, const std::string& data_handle, - const boost::optional& billing_tag, + const porting::optional& billing_tag, const DeleteBlobCallback& callback) { std::multimap header_params; std::multimap query_params; @@ -126,8 +125,7 @@ client::CancellationToken BlobApi::deleteBlob( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string delete_blob_uri = "/layers/" + layer_id + "/data/" + data_handle; @@ -148,7 +146,7 @@ client::CancellationToken BlobApi::deleteBlob( client::CancellationToken BlobApi::checkBlobExists( const client::OlpClient& client, const std::string& layer_id, const std::string& data_handle, - const boost::optional& billing_tag, + const porting::optional& billing_tag, const CheckBlobCallback& callback) { std::multimap header_params; std::multimap query_params; @@ -157,8 +155,7 @@ client::CancellationToken BlobApi::checkBlobExists( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string check_blob_uri = "/layers/" + layer_id + "/data/" + data_handle; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/BlobApi.h b/olp-cpp-sdk-dataservice-write/src/generated/BlobApi.h index b9c887b6a..73f602dc1 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/BlobApi.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/BlobApi.h @@ -84,7 +84,7 @@ class BlobApi { const std::string& content_type, const std::string& content_encoding, const std::string& data_handle, const std::shared_ptr>& data, - const boost::optional& billing_tag, + const porting::optional& billing_tag, PutBlobCallback callback); /** @@ -95,7 +95,7 @@ class BlobApi { const std::string& content_type, const std::string& content_encoding, const std::string& data_handle, const std::shared_ptr>& data, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext cancel_contex); /** @@ -118,7 +118,7 @@ class BlobApi { static client::CancellationToken deleteBlob( const client::OlpClient& client, const std::string& layer_id, const std::string& data_handle, - const boost::optional& billing_tag, + const porting::optional& billing_tag, const DeleteBlobCallback& callback); /** @@ -138,7 +138,7 @@ class BlobApi { static client::CancellationToken checkBlobExists( const client::OlpClient& client, const std::string& layer_id, const std::string& data_handle, - const boost::optional& billing_tag, + const porting::optional& billing_tag, const CheckBlobCallback& callback); }; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.cpp b/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.cpp index cf8534f08..a7cd081a6 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.cpp @@ -39,7 +39,7 @@ namespace client = olp::client; client::CancellationToken ConfigApi::GetCatalog( std::shared_ptr client, const std::string& catalog_hrn, - boost::optional billing_tag, + porting::optional billing_tag, const CatalogCallback& catalogCallback) { std::multimap headerParams; headerParams.insert(std::make_pair("Accept", "application/json")); @@ -51,24 +51,25 @@ client::CancellationToken ConfigApi::GetCatalog( std::string catalogUri = "/catalogs/" + catalog_hrn; - client::NetworkAsyncCallback callback = [catalogCallback]( - client::HttpResponse response) { - if (response.GetStatus() != http::HttpStatusCode::OK) { - catalogCallback(CatalogResponse( - client::ApiError(response.GetStatus(), response.GetResponseAsString()))); - } else { - catalogCallback(parser::parse_result(response.GetRawResponse())); - } - }; + client::NetworkAsyncCallback callback = + [catalogCallback](client::HttpResponse response) { + if (response.GetStatus() != http::HttpStatusCode::OK) { + catalogCallback(CatalogResponse(client::ApiError( + response.GetStatus(), response.GetResponseAsString()))); + } else { + catalogCallback( + parser::parse_result(response.GetRawResponse())); + } + }; return client->CallApi(catalogUri, "GET", queryParams, headerParams, formParams, nullptr, "", callback); } -CatalogResponse ConfigApi::GetCatalog(const client::OlpClient& client, - const std::string& catalog_hrn, - boost::optional billing_tag, - client::CancellationContext context) { +CatalogResponse ConfigApi::GetCatalog( + const client::OlpClient& client, const std::string& catalog_hrn, + porting::optional billing_tag, + client::CancellationContext context) { std::multimap header_params; header_params.insert(std::make_pair("Accept", "application/json")); std::multimap query_params; @@ -81,7 +82,8 @@ CatalogResponse ConfigApi::GetCatalog(const client::OlpClient& client, 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()); } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.h b/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.h index 42c847210..e7c54ed05 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include @@ -51,6 +51,7 @@ class ConfigApi { * @param billing_tag An optional free-form tag which is used for grouping * billing records together. If supplied, it must be between 4 - 16 * characters, contain only alpha/numeric ASCII characters [A-Za-z0-9]. + * @param callback * @param A callback function to invoke with the catalog configuration * response. * @@ -58,7 +59,7 @@ class ConfigApi { */ static client::CancellationToken GetCatalog( std::shared_ptr client, const std::string& catalog_hrn, - boost::optional billing_tag, + porting::optional billing_tag, const CatalogCallback& callback); /** @@ -75,7 +76,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-write/src/generated/IndexApi.cpp b/olp-cpp-sdk-dataservice-write/src/generated/IndexApi.cpp index a0cedb2ce..68824413a 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/IndexApi.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/IndexApi.cpp @@ -41,7 +41,7 @@ namespace write { client::CancellableFuture IndexApi::insertIndexes( const client::OlpClient& client, const model::Index& indexes, const std::string& layer_id, - const boost::optional& billing_tag) { + const porting::optional& billing_tag) { auto promise = std::make_shared>(); auto cancel_token = insertIndexes(client, indexes, layer_id, billing_tag, [promise](InsertIndexesResponse response) { @@ -54,7 +54,7 @@ client::CancellableFuture IndexApi::insertIndexes( client::CancellationToken IndexApi::insertIndexes( const client::OlpClient& client, const model::Index& indexes, const std::string& layer_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, InsertIndexesCallback callback) { std::multimap header_params; std::multimap query_params; @@ -63,8 +63,7 @@ client::CancellationToken IndexApi::insertIndexes( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string insert_indexes_uri = "/layers/" + layer_id; @@ -90,7 +89,7 @@ client::CancellationToken IndexApi::insertIndexes( InsertIndexesResponse IndexApi::InsertIndexes( const client::OlpClient& client, const model::Index& indexes, const std::string& layer_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext context) { std::multimap header_params; std::multimap query_params; @@ -99,8 +98,7 @@ InsertIndexesResponse IndexApi::InsertIndexes( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string insert_indexes_uri = "/layers/" + layer_id; @@ -113,7 +111,8 @@ InsertIndexesResponse IndexApi::InsertIndexes( client.CallApi(insert_indexes_uri, "POST", query_params, header_params, form_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()); } return client::ApiNoResult(); @@ -121,7 +120,7 @@ InsertIndexesResponse IndexApi::InsertIndexes( client::CancellableFuture IndexApi::performUpdate( const client::OlpClient& client, const model::UpdateIndexRequest& request, - const boost::optional& billing_tag) { + const porting::optional& billing_tag) { auto promise = std::make_shared>(); auto cancel_token = performUpdate(client, request, billing_tag, [promise](InsertIndexesResponse response) { @@ -133,7 +132,7 @@ client::CancellableFuture IndexApi::performUpdate( client::CancellationToken IndexApi::performUpdate( const client::OlpClient& client, const model::UpdateIndexRequest& request, - const boost::optional& billing_tag, + const porting::optional& billing_tag, InsertIndexesCallback callback) { std::multimap header_params; std::multimap query_params; @@ -142,8 +141,7 @@ client::CancellationToken IndexApi::performUpdate( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string update_indexes_uri = "/layers/" + request.GetLayerId(); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/IndexApi.h b/olp-cpp-sdk-dataservice-write/src/generated/IndexApi.h index 29bdec911..37ecccfef 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/IndexApi.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/IndexApi.h @@ -71,7 +71,7 @@ class IndexApi { static client::CancellableFuture insertIndexes( const client::OlpClient& client, const model::Index& indexes, const std::string& layer_id, - const boost::optional& billing_tag = boost::none); + const porting::optional& billing_tag = olp::porting::none); /** * @brief Inserts index data to an index layer @@ -93,16 +93,16 @@ class IndexApi { static client::CancellationToken insertIndexes( const client::OlpClient& client, const model::Index& indexes, const std::string& layer_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, InsertIndexesCallback callback); /** - * @brief Synchronous version of \c insertIndexes method. - */ + * @brief Synchronous version of \c insertIndexes method. + */ static InsertIndexesResponse InsertIndexes( const client::OlpClient& client, const model::Index& indexes, const std::string& layer_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext context); /** @@ -120,7 +120,7 @@ class IndexApi { */ static client::CancellableFuture performUpdate( const client::OlpClient& client, const model::UpdateIndexRequest& request, - const boost::optional& billing_tag = boost::none); + const porting::optional& billing_tag = olp::porting::none); /** * @brief Updates index layer partitions @@ -140,7 +140,7 @@ class IndexApi { */ static client::CancellationToken performUpdate( const client::OlpClient& client, const model::UpdateIndexRequest& request, - const boost::optional& billing_tag, + const porting::optional& billing_tag, UpdateIndexesCallback callback); }; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/IngestApi.cpp b/olp-cpp-sdk-dataservice-write/src/generated/IngestApi.cpp index 6455890db..df5cef287 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/IngestApi.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/IngestApi.cpp @@ -54,24 +54,24 @@ client::CancellationToken IngestApi::IngestData( const client::OlpClient& client, const std::string& layer_id, const std::string& content_type, const std::shared_ptr>& data, - const boost::optional& trace_id, - const boost::optional& billing_tag, - const boost::optional& checksum, IngestDataCallback callback) { + const porting::optional& trace_id, + const porting::optional& billing_tag, + const porting::optional& checksum, + IngestDataCallback callback) { std::multimap query_params; std::multimap form_params; std::multimap header_params; header_params.insert(std::make_pair("Accept", "application/json")); if (trace_id) { - header_params.insert(std::make_pair(kHeaderParamTraceId, trace_id.get())); + header_params.insert(std::make_pair(kHeaderParamTraceId, *trace_id)); } if (checksum) { - header_params.insert(std::make_pair(kHeaderParamChecksum, checksum.get())); + header_params.insert(std::make_pair(kHeaderParamChecksum, *checksum)); } if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string ingest_uri = "/layers/" + layer_id; @@ -85,8 +85,8 @@ client::CancellationToken IngestApi::IngestData( return; } - callback( - parser::parse_result(http_response.GetRawResponse())); + callback(parser::parse_result( + http_response.GetRawResponse())); }); return cancel_token; @@ -96,9 +96,9 @@ IngestDataResponse IngestApi::IngestData( const client::OlpClient& client, const std::string& layer_id, const std::string& content_type, const std::string& content_encoding, const std::shared_ptr>& data, - const boost::optional& trace_id, - const boost::optional& billing_tag, - const boost::optional& checksum, + const porting::optional& trace_id, + const porting::optional& billing_tag, + const porting::optional& checksum, client::CancellationContext context) { std::multimap query_params; std::multimap form_params; @@ -112,16 +112,15 @@ IngestDataResponse IngestApi::IngestData( } if (trace_id) { - header_params.insert(std::make_pair(kHeaderParamTraceId, trace_id.get())); + header_params.insert(std::make_pair(kHeaderParamTraceId, *trace_id)); } if (checksum) { - header_params.insert(std::make_pair(kHeaderParamChecksum, checksum.get())); + header_params.insert(std::make_pair(kHeaderParamChecksum, *checksum)); } if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } const std::string ingest_uri = "/layers/" + layer_id; @@ -133,19 +132,20 @@ IngestDataResponse IngestApi::IngestData( OLP_SDK_LOG_ERROR_F( kLogTag, "Error during OlpClient::CallApi call, uri=%s, status=%i", ingest_uri.c_str(), http_response.GetStatus()); - return IngestDataResponse{ - client::ApiError(http_response.GetStatus(), http_response.GetResponseAsString())}; + return IngestDataResponse{client::ApiError( + http_response.GetStatus(), http_response.GetResponseAsString())}; } - return parser::parse_result(http_response.GetRawResponse()); + return parser::parse_result( + http_response.GetRawResponse()); } IngestSdiiResponse IngestApi::IngestSdii( const client::OlpClient& client, const std::string& layer_id, const std::shared_ptr>& sdii_message_list, - const boost::optional& trace_id, - const boost::optional& billing_tag, - const boost::optional& checksum, + const porting::optional& trace_id, + const porting::optional& billing_tag, + const porting::optional& checksum, client::CancellationContext context) { std::multimap header_params; std::multimap query_params; @@ -153,15 +153,14 @@ IngestSdiiResponse IngestApi::IngestSdii( header_params.insert(std::make_pair("Accept", "application/json")); if (trace_id) { - header_params.insert(std::make_pair(kHeaderParamTraceId, trace_id.get())); + header_params.insert(std::make_pair(kHeaderParamTraceId, *trace_id)); } if (checksum) { - header_params.insert(std::make_pair(kHeaderParamChecksum, checksum.get())); + header_params.insert(std::make_pair(kHeaderParamChecksum, *checksum)); } if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string ingest_uri = "/layers/" + layer_id + "/sdiiMessageList"; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/IngestApi.h b/olp-cpp-sdk-dataservice-write/src/generated/IngestApi.h index 314817dd6..a567b126c 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/IngestApi.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/IngestApi.h @@ -21,7 +21,7 @@ #include -#include +#include #include #include @@ -83,9 +83,9 @@ class IngestApi { const client::OlpClient& client, const std::string& layer_id, const std::string& content_type, const std::shared_ptr>& data, - const boost::optional& trace_id, - const boost::optional& billing_tag, - const boost::optional& checksum, + const porting::optional& trace_id, + const porting::optional& billing_tag, + const porting::optional& checksum, IngestDataCallback callback); /** @@ -94,7 +94,8 @@ class IngestApi { * @param layer_id Layer of the catalog where you want to store the data. The * layer type must be Stream. * @param content_type The content type configured for the target layer. - * @param content_encoding The content encoding configured for the target layer. + * @param content_encoding The content encoding configured for the target + * layer. * @param data Content to be uploaded to OLP. * @param trace_id Optional. A unique message ID, such as a UUID. This can be * included in the request if you want to use an ID that you define. If you do @@ -117,9 +118,9 @@ class IngestApi { const client::OlpClient& client, const std::string& layer_id, const std::string& content_type, const std::string& content_encoding, const std::shared_ptr>& data, - const boost::optional& trace_id, - const boost::optional& billing_tag, - const boost::optional& checksum, + const porting::optional& trace_id, + const porting::optional& billing_tag, + const porting::optional& checksum, client::CancellationContext context); /** @@ -152,9 +153,9 @@ class IngestApi { static IngestSdiiResponse IngestSdii( const client::OlpClient& client, const std::string& layer_id, const std::shared_ptr>& sdii_message_list, - const boost::optional& trace_id, - const boost::optional& billing_tag, - const boost::optional& checksum, + const porting::optional& trace_id, + const porting::optional& billing_tag, + const porting::optional& checksum, client::CancellationContext context); }; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/MetadataApi.cpp b/olp-cpp-sdk-dataservice-write/src/generated/MetadataApi.cpp index 91c26cf8f..4867c69d1 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/MetadataApi.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/MetadataApi.cpp @@ -57,7 +57,7 @@ namespace client = olp::client; client::CancellationToken MetadataApi::GetLayerVersions( const client::OlpClient& client, int64_t version, - boost::optional billingTag, + porting::optional billingTag, const LayerVersionsCallback& layerVersionsCallback) { std::multimap headerParams; headerParams.insert(std::make_pair("Accept", "application/json")); @@ -75,11 +75,11 @@ client::CancellationToken MetadataApi::GetLayerVersions( client::NetworkAsyncCallback callback = [layerVersionsCallback](client::HttpResponse response) { if (response.GetStatus() != http::HttpStatusCode::OK) { - layerVersionsCallback( - client::ApiError(response.GetStatus(), response.GetResponseAsString())); + layerVersionsCallback(client::ApiError( + response.GetStatus(), response.GetResponseAsString())); } else { - layerVersionsCallback( - parser::parse_result(response.GetRawResponse())); + layerVersionsCallback(parser::parse_result( + response.GetRawResponse())); } }; @@ -89,9 +89,10 @@ client::CancellationToken MetadataApi::GetLayerVersions( client::CancellationToken MetadataApi::GetPartitions( const client::OlpClient& client, const std::string& layerId, - boost::optional version, - boost::optional> additionalFields, - boost::optional range, boost::optional billingTag, + porting::optional version, + porting::optional> additionalFields, + porting::optional range, + porting::optional billingTag, const PartitionsCallback& partitionsCallback) { std::multimap headerParams; headerParams.insert(std::make_pair("Accept", "application/json")); @@ -115,16 +116,16 @@ client::CancellationToken MetadataApi::GetPartitions( std::string metadataUri = "/layers/" + layerId + "/partitions"; - client::NetworkAsyncCallback callback = - [partitionsCallback](client::HttpResponse response) { - if (response.GetStatus() != http::HttpStatusCode::OK) { - partitionsCallback( - client::ApiError(response.GetStatus(), response.GetResponseAsString())); - } else { - partitionsCallback( - parser::parse_result(response.GetRawResponse())); - } - }; + client::NetworkAsyncCallback callback = [partitionsCallback]( + client::HttpResponse response) { + if (response.GetStatus() != http::HttpStatusCode::OK) { + partitionsCallback(client::ApiError(response.GetStatus(), + response.GetResponseAsString())); + } else { + partitionsCallback( + parser::parse_result(response.GetRawResponse())); + } + }; return client.CallApi(metadataUri, "GET", queryParams, headerParams, formParams, nullptr, "", callback); @@ -132,7 +133,7 @@ client::CancellationToken MetadataApi::GetPartitions( client::CancellationToken MetadataApi::GetLatestCatalogVersion( const client::OlpClient& client, int64_t startVersion, - boost::optional billingTag, + porting::optional billingTag, const CatalogVersionCallback& catalogVersionCallback) { std::multimap headerParams; headerParams.insert(std::make_pair("Accept", "application/json")); @@ -151,11 +152,11 @@ client::CancellationToken MetadataApi::GetLatestCatalogVersion( client::NetworkAsyncCallback callback = [catalogVersionCallback](client::HttpResponse response) { if (response.GetStatus() != http::HttpStatusCode::OK) { - catalogVersionCallback( - client::ApiError(response.GetStatus(), response.GetResponseAsString())); + catalogVersionCallback(client::ApiError( + response.GetStatus(), response.GetResponseAsString())); } else { - catalogVersionCallback( - parser::parse_result(response.GetRawResponse())); + catalogVersionCallback(parser::parse_result( + response.GetRawResponse())); } }; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/MetadataApi.h b/olp-cpp-sdk-dataservice-write/src/generated/MetadataApi.h index 42aa2c89b..a2258b294 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/MetadataApi.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/MetadataApi.h @@ -24,7 +24,7 @@ #include #include -#include +#include #include "generated/model/LayerVersions.h" #include "generated/model/Partitions.h" #include "olp/dataservice/write/model/VersionResponse.h" @@ -68,7 +68,7 @@ class MetadataApi { */ static client::CancellationToken GetLayerVersions( const client::OlpClient& client, int64_t version, - boost::optional billingTag, + porting::optional billingTag, const LayerVersionsCallback& callback); /** @@ -97,10 +97,10 @@ class MetadataApi { */ static client::CancellationToken GetPartitions( const client::OlpClient& client, const std::string& layerId, - boost::optional version, - boost::optional> additionalFields, - boost::optional range, - boost::optional billingTag, + porting::optional version, + porting::optional> additionalFields, + porting::optional range, + porting::optional billingTag, const PartitionsCallback& callback); /** @@ -121,7 +121,7 @@ class MetadataApi { */ static client::CancellationToken GetLatestCatalogVersion( const client::OlpClient& client, int64_t startVersion, - boost::optional billingTag, + porting::optional billingTag, const CatalogVersionCallback& callback); }; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/PublishApi.cpp b/olp-cpp-sdk-dataservice-write/src/generated/PublishApi.cpp index b82f10102..c64275337 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/PublishApi.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/PublishApi.cpp @@ -45,7 +45,7 @@ namespace write { client::CancellationToken PublishApi::InitPublication( const client::OlpClient& client, const model::Publication& publication, - const boost::optional& billing_tag, + const porting::optional& billing_tag, InitPublicationCallback callback) { std::multimap header_params; std::multimap query_params; @@ -54,8 +54,7 @@ client::CancellationToken PublishApi::InitPublication( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string init_publication_uri = "/publications"; @@ -82,7 +81,7 @@ client::CancellationToken PublishApi::InitPublication( InitPublicationResponse PublishApi::InitPublication( const client::OlpClient& client, const model::Publication& publication, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext cancellation_context) { std::multimap header_params; std::multimap query_params; @@ -91,8 +90,7 @@ InitPublicationResponse PublishApi::InitPublication( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string init_publication_uri = "/publications"; @@ -117,7 +115,7 @@ client::CancellationToken PublishApi::UploadPartitions( const client::OlpClient& client, const model::PublishPartitions& publish_partitions, const std::string& publication_id, const std::string& layer_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, UploadPartitionsCallback callback) { std::multimap header_params; std::multimap query_params; @@ -126,8 +124,7 @@ client::CancellationToken PublishApi::UploadPartitions( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string upload_partitions_uri = @@ -159,7 +156,7 @@ UploadPartitionsResponse PublishApi::UploadPartitions( const client::OlpClient& client, const model::PublishPartitions& publish_partitions, const std::string& publication_id, const std::string& layer_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext cancellation_context) { std::multimap header_params; std::multimap query_params; @@ -168,8 +165,7 @@ UploadPartitionsResponse PublishApi::UploadPartitions( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string upload_partitions_uri = @@ -195,7 +191,7 @@ UploadPartitionsResponse PublishApi::UploadPartitions( client::CancellationToken PublishApi::SubmitPublication( const client::OlpClient& client, const std::string& publication_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, SubmitPublicationCallback callback) { std::multimap header_params; std::multimap query_params; @@ -204,8 +200,7 @@ client::CancellationToken PublishApi::SubmitPublication( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string submit_publication_uri = "/publications/" + publication_id; @@ -229,7 +224,7 @@ client::CancellationToken PublishApi::SubmitPublication( SubmitPublicationResponse PublishApi::SubmitPublication( const client::OlpClient& client, const std::string& publication_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext cancellation_context) { std::multimap header_params; std::multimap query_params; @@ -238,8 +233,7 @@ SubmitPublicationResponse PublishApi::SubmitPublication( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string submit_publication_uri = "/publications/" + publication_id; @@ -258,7 +252,7 @@ SubmitPublicationResponse PublishApi::SubmitPublication( client::CancellationToken PublishApi::GetPublication( const client::OlpClient& client, const std::string& publication_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, GetPublicationCallback callback) { std::multimap header_params; std::multimap query_params; @@ -267,8 +261,7 @@ client::CancellationToken PublishApi::GetPublication( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string get_publication_uri = "/publications/" + publication_id; @@ -292,7 +285,7 @@ client::CancellationToken PublishApi::GetPublication( SubmitPublicationResponse PublishApi::CancelPublication( const client::OlpClient& client, const std::string& publication_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext context) { std::multimap header_params; std::multimap query_params; @@ -301,8 +294,7 @@ SubmitPublicationResponse PublishApi::CancelPublication( header_params.insert(std::make_pair("Accept", "application/json")); if (billing_tag) { - query_params.insert( - std::make_pair(kQueryParamBillingTag, billing_tag.get())); + query_params.insert(std::make_pair(kQueryParamBillingTag, *billing_tag)); } std::string submit_publication_uri = "/publications/" + publication_id; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/PublishApi.h b/olp-cpp-sdk-dataservice-write/src/generated/PublishApi.h index eb8b5b9cd..fb511be66 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/PublishApi.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/PublishApi.h @@ -88,13 +88,13 @@ class PublishApi { */ static client::CancellationToken InitPublication( const client::OlpClient& client, const model::Publication& publication, - const boost::optional& billing_tag, + const porting::optional& billing_tag, InitPublicationCallback callback); /** @brief Sync version of \c InitPublication method. */ static InitPublicationResponse InitPublication( const client::OlpClient& client, const model::Publication& publication, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext cancellation_context); /** @@ -124,7 +124,7 @@ class PublishApi { const client::OlpClient& client, const model::PublishPartitions& publish_partitions, const std::string& publication_id, const std::string& layer_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, UploadPartitionsCallback callback); /** @brief Sync version of \c UploadPartitions method. */ @@ -132,7 +132,7 @@ class PublishApi { const client::OlpClient& client, const model::PublishPartitions& publish_partitions, const std::string& publication_id, const std::string& layer_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext cancellation_context); /** @@ -157,13 +157,13 @@ class PublishApi { */ static client::CancellationToken SubmitPublication( const client::OlpClient& client, const std::string& publication_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, SubmitPublicationCallback callback); /** @brief Sync version of \c SubmitPublication method. */ static SubmitPublicationResponse SubmitPublication( const client::OlpClient& client, const std::string& publication_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext cancellation_context); /** @@ -186,7 +186,7 @@ class PublishApi { */ static client::CancellationToken GetPublication( const client::OlpClient& client, const std::string& publication_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, GetPublicationCallback callback); /** @@ -205,7 +205,7 @@ class PublishApi { */ static SubmitPublicationResponse CancelPublication( const client::OlpClient& client, const std::string& publication_id, - const boost::optional& billing_tag, + const porting::optional& billing_tag, client::CancellationContext context); }; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/QueryApi.cpp b/olp-cpp-sdk-dataservice-write/src/generated/QueryApi.cpp index 4648b756d..7bb3f19ff 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/QueryApi.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/QueryApi.cpp @@ -55,9 +55,9 @@ namespace client = olp::client; client::CancellationToken QueryApi::GetPartitionsById( const client::OlpClient& client, const std::string& layerId, const std::vector& partitionIds, - boost::optional version, - boost::optional> additionalFields, - boost::optional billingTag, + porting::optional version, + porting::optional> additionalFields, + porting::optional billingTag, const PartitionsCallback& partitionsCallback) { std::multimap headerParams; headerParams.insert(std::make_pair("Accept", "application/json")); @@ -80,16 +80,16 @@ client::CancellationToken QueryApi::GetPartitionsById( std::string queryUri = "/layers/" + layerId + "/partitions"; - client::NetworkAsyncCallback callback = - [partitionsCallback](client::HttpResponse response) { - if (response.GetStatus() != http::HttpStatusCode::OK) { - partitionsCallback( - client::ApiError(response.GetStatus(), response.GetResponseAsString())); - } else { - partitionsCallback( - parser::parse_result(response.GetRawResponse())); - } - }; + client::NetworkAsyncCallback callback = [partitionsCallback]( + client::HttpResponse response) { + if (response.GetStatus() != http::HttpStatusCode::OK) { + partitionsCallback(client::ApiError(response.GetStatus(), + response.GetResponseAsString())); + } else { + partitionsCallback( + parser::parse_result(response.GetRawResponse())); + } + }; return client.CallApi(queryUri, "GET", queryParams, headerParams, formParams, nullptr, "", callback); @@ -98,9 +98,9 @@ client::CancellationToken QueryApi::GetPartitionsById( QueryApi::PartitionsResponse QueryApi::GetPartitionsById( const client::OlpClient& client, const std::string& layer_id, const std::vector& partition_ids, - boost::optional version, - boost::optional> additional_fields, - boost::optional billing_tag, + porting::optional version, + porting::optional> additional_fields, + porting::optional billing_tag, client::CancellationContext context) { std::multimap header_params; header_params.insert(std::make_pair("Accept", "application/json")); @@ -128,9 +128,11 @@ QueryApi::PartitionsResponse QueryApi::GetPartitionsById( nullptr, "", 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()); } - return parser::parse_result(http_response.GetRawResponse()); + return parser::parse_result( + http_response.GetRawResponse()); } } // namespace write diff --git a/olp-cpp-sdk-dataservice-write/src/generated/QueryApi.h b/olp-cpp-sdk-dataservice-write/src/generated/QueryApi.h index 229d83a0c..b0c4bf903 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/QueryApi.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/QueryApi.h @@ -25,7 +25,7 @@ #include #include #include -#include +#include #include "generated/model/Partitions.h" namespace olp { @@ -49,17 +49,17 @@ class QueryApi { static client::CancellationToken GetPartitionsById( const client::OlpClient& client, const std::string& layerId, const std::vector& partitionIds, - boost::optional version, - boost::optional> additionalFields, - boost::optional billingTag, + porting::optional version, + porting::optional> additionalFields, + porting::optional billingTag, const PartitionsCallback& callback); static PartitionsResponse GetPartitionsById( const client::OlpClient& client, const std::string& layerId, const std::vector& partition_ids, - boost::optional version, - boost::optional> additional_fields, - boost::optional billing_tag, + porting::optional version, + porting::optional> additional_fields, + porting::optional billing_tag, client::CancellationContext context); }; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/model/Partitions.h b/olp-cpp-sdk-dataservice-write/src/generated/model/Partitions.h index 1c20663c8..85b26e54c 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/model/Partitions.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/model/Partitions.h @@ -22,7 +22,7 @@ #include #include -#include +#include namespace olp { namespace dataservice { @@ -42,27 +42,29 @@ class 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_; + porting::optional data_size_; std::string partition_; - boost::optional version_; + porting::optional version_; public: - const boost::optional& GetChecksum() const { return checksum_; } - boost::optional& GetMutableChecksum() { return checksum_; } - void SetChecksum(const boost::optional& value) { + const porting::optional& GetChecksum() const { + return checksum_; + } + porting::optional& GetMutableChecksum() { return checksum_; } + void SetChecksum(const porting::optional& value) { this->checksum_ = value; } - const boost::optional& GetCompressedDataSize() const { + const porting::optional& GetCompressedDataSize() const { return compressed_data_size_; } - boost::optional& GetMutableCompressedDataSize() { + porting::optional& GetMutableCompressedDataSize() { return compressed_data_size_; } - void SetCompressedDataSize(const boost::optional& value) { + void SetCompressedDataSize(const porting::optional& value) { this->compressed_data_size_ = value; } @@ -70,9 +72,9 @@ class Partition { std::string& GetMutableDataHandle() { return data_handle_; } void SetDataHandle(const std::string& value) { this->data_handle_ = value; } - const boost::optional& GetDataSize() const { return data_size_; } - boost::optional& GetMutableDataSize() { return data_size_; } - void SetDataSize(const boost::optional& value) { + const porting::optional& GetDataSize() const { return data_size_; } + porting::optional& GetMutableDataSize() { return data_size_; } + void SetDataSize(const porting::optional& value) { this->data_size_ = value; } @@ -80,9 +82,9 @@ class Partition { std::string& GetMutablePartition() { return partition_; } void SetPartition(const std::string& value) { this->partition_ = value; } - const boost::optional& GetVersion() const { return version_; } - boost::optional& GetMutableVersion() { return version_; } - void SetVersion(const boost::optional& value) { + const porting::optional& GetVersion() const { return version_; } + porting::optional& GetMutableVersion() { return version_; } + void SetVersion(const porting::optional& value) { this->version_ = value; } }; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/model/PublishPartition.h b/olp-cpp-sdk-dataservice-write/src/generated/model/PublishPartition.h index 1046d01ca..4c899355e 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/model/PublishPartition.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/model/PublishPartition.h @@ -23,7 +23,7 @@ #include #include -#include +#include namespace olp { namespace dataservice { @@ -40,37 +40,39 @@ class PublishPartition { virtual ~PublishPartition() = default; private: - boost::optional partition_; - boost::optional checksum_; - boost::optional compressed_data_size_; - boost::optional data_size_; + porting::optional partition_; + porting::optional checksum_; + porting::optional compressed_data_size_; + porting::optional data_size_; std::shared_ptr> data_; - boost::optional data_handle_; - boost::optional timestamp_; + porting::optional data_handle_; + porting::optional timestamp_; public: - const boost::optional& GetPartition() const { + const porting::optional& GetPartition() const { return partition_; } - boost::optional& GetMutablePartition() { return partition_; } + porting::optional& GetMutablePartition() { return partition_; } void SetPartition(const std::string& value) { this->partition_ = value; } - const boost::optional& GetChecksum() const { return checksum_; } - boost::optional& GetMutableChecksum() { return checksum_; } + const porting::optional& GetChecksum() const { + return checksum_; + } + porting::optional& GetMutableChecksum() { return checksum_; } void SetChecksum(const std::string& value) { this->checksum_ = value; } - const boost::optional& GetCompressedDataSize() const { + const porting::optional& GetCompressedDataSize() const { return compressed_data_size_; } - boost::optional& GetMutableCompressedDataSize() { + porting::optional& GetMutableCompressedDataSize() { return compressed_data_size_; } void SetCompressedDataSize(const int64_t& value) { this->compressed_data_size_ = value; } - const boost::optional& GetDataSize() const { return data_size_; } - boost::optional& GetMutableDataSize() { return data_size_; } + const porting::optional& GetDataSize() const { return data_size_; } + porting::optional& GetMutableDataSize() { return data_size_; } void SetDataSize(const int64_t& value) { this->data_size_ = value; } const std::shared_ptr>& GetData() const { @@ -83,14 +85,16 @@ class PublishPartition { this->data_ = value; } - const boost::optional& GetDataHandle() const { + const porting::optional& GetDataHandle() const { + return data_handle_; + } + porting::optional& GetMutableDataHandle() { return data_handle_; } - boost::optional& GetMutableDataHandle() { return data_handle_; } void SetDataHandle(const std::string& value) { this->data_handle_ = value; } - const boost::optional& GetTimestamp() const { return timestamp_; } - boost::optional& GetMutableTimestamp() { return timestamp_; } + const porting::optional& GetTimestamp() const { return timestamp_; } + porting::optional& GetMutableTimestamp() { return timestamp_; } void SetTimestamp(const int64_t& value) { this->timestamp_ = value; } }; diff --git a/olp-cpp-sdk-dataservice-write/src/generated/model/PublishPartitions.h b/olp-cpp-sdk-dataservice-write/src/generated/model/PublishPartitions.h index c45de1e61..8299b8521 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/model/PublishPartitions.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/model/PublishPartitions.h @@ -22,7 +22,7 @@ #include #include -#include +#include #include @@ -41,13 +41,14 @@ class PublishPartitions { virtual ~PublishPartitions() = default; private: - boost::optional> partitions_; + porting::optional> partitions_; public: - const boost::optional>& GetPartitions() const { + const porting::optional>& GetPartitions() + const { return partitions_; } - boost::optional>& GetMutablePartitions() { + porting::optional>& GetMutablePartitions() { return partitions_; } void SetPartitions(const std::vector& value) { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp index 600341425..8e3420373 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/parser/PartitionsParser.cpp @@ -23,16 +23,16 @@ namespace olp { namespace parser { -using namespace olp::dataservice::write; +namespace model = dataservice::write::model; void from_json(const rapidjson::Value& value, model::Partition& x) { - x.SetChecksum(parse>(value, "checksum")); + x.SetChecksum(parse>(value, "checksum")); x.SetCompressedDataSize( - parse>(value, "compressedDataSize")); + parse>(value, "compressedDataSize")); x.SetDataHandle(parse(value, "dataHandle")); - x.SetDataSize(parse>(value, "dataSize")); + x.SetDataSize(parse>(value, "dataSize")); 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) { diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.cpp index c9b0ca34c..f95c7a0f7 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/IndexInfoSerializer.cpp @@ -29,7 +29,13 @@ void to_json(const dataservice::write::model::Index &x, rapidjson::Value &value, rapidjson::Value indexFields(rapidjson::kObjectType); for (auto &field_pair : x.GetIndexFields()) { - using namespace dataservice::write::model; + using dataservice::write::model::BooleanIndexValue; + using dataservice::write::model::HereTileIndexValue; + using dataservice::write::model::IndexType; + using dataservice::write::model::IntIndexValue; + using dataservice::write::model::StringIndexValue; + using dataservice::write::model::TimeWindowIndexValue; + const auto &field = field_pair.second; const auto key = rapidjson::StringRef(field_pair.first.c_str()); auto index_type = field->getIndexType(); @@ -59,7 +65,7 @@ void to_json(const dataservice::write::model::Index &x, rapidjson::Value &value, // by another model. if (x.GetMetadata()) { rapidjson::Value metadatas(rapidjson::kObjectType); - for (auto metadata : x.GetMetadata().get()) { + for (const auto &metadata : *x.GetMetadata()) { auto metadata_value = metadata.second; auto metadata_key = metadata.first.c_str(); indexFields.AddMember( @@ -70,13 +76,12 @@ void to_json(const dataservice::write::model::Index &x, rapidjson::Value &value, } if (x.GetCheckSum()) { - jsonValue.AddMember("checksum", - rapidjson::StringRef(x.GetCheckSum().get().c_str()), - allocator); + jsonValue.AddMember( + "checksum", rapidjson::StringRef(x.GetCheckSum()->c_str()), allocator); } if (x.GetSize()) { - jsonValue.AddMember("size", x.GetSize().get(), allocator); + jsonValue.AddMember("size", *x.GetSize(), allocator); } value.PushBack(jsonValue, allocator); } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.cpp index aa8de56c3..ee1df67fa 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublicationSerializer.cpp @@ -25,8 +25,7 @@ void to_json(const dataservice::write::model::Publication& x, rapidjson::Value& value, rapidjson::Document::AllocatorType& allocator) { if (x.GetId()) { - value.AddMember("id", rapidjson::StringRef(x.GetId().get().c_str()), - allocator); + value.AddMember("id", rapidjson::StringRef(x.GetId()->c_str()), allocator); } // TODO: Separate Details Model serializtion into it's own file when needed by @@ -47,19 +46,19 @@ void to_json(const dataservice::write::model::Publication& x, if (x.GetLayerIds()) { rapidjson::Value layer_ids(rapidjson::kArrayType); - for (auto& layer_id : x.GetLayerIds().get()) { + for (auto& layer_id : *x.GetLayerIds()) { layer_ids.PushBack(rapidjson::StringRef(layer_id.c_str()), allocator); } value.AddMember("layerIds", layer_ids, allocator); } if (x.GetCatalogVersion()) { - value.AddMember("catalogVersion", x.GetCatalogVersion().get(), allocator); + value.AddMember("catalogVersion", *x.GetCatalogVersion(), allocator); } if (x.GetVersionDependencies()) { rapidjson::Value version_dependencies(rapidjson::kArrayType); - for (auto& version_dependency : x.GetVersionDependencies().get()) { + for (auto& version_dependency : *x.GetVersionDependencies()) { // TODO: Separate VersionDependency Model serializtion into it's own file // when needed by another model. rapidjson::Value version_dependency_json(rapidjson::kObjectType); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.cpp index d5814e351..c23abe886 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishDataRequestSerializer.cpp @@ -35,20 +35,18 @@ void to_json(const dataservice::write::model::PublishDataRequest& x, allocator); if (x.GetTraceId()) { - value.AddMember("traceId", - rapidjson::StringRef(x.GetTraceId().get().c_str()), + value.AddMember("traceId", rapidjson::StringRef(x.GetTraceId()->c_str()), allocator); } if (x.GetBillingTag()) { value.AddMember("billingTag", - rapidjson::StringRef(x.GetBillingTag().get().c_str()), + rapidjson::StringRef(x.GetBillingTag()->c_str()), allocator); } if (x.GetChecksum()) { - value.AddMember("checksum", - rapidjson::StringRef(x.GetChecksum().get().c_str()), + value.AddMember("checksum", rapidjson::StringRef(x.GetChecksum()->c_str()), allocator); } } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.cpp index bf5a2aa6b..875fc73da 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionSerializer.cpp @@ -26,23 +26,21 @@ void to_json(const dataservice::write::model::PublishPartition& x, rapidjson::Document::AllocatorType& allocator) { if (x.GetPartition()) { value.AddMember("partition", - rapidjson::StringRef(x.GetPartition().get().c_str()), - allocator); + rapidjson::StringRef(x.GetPartition()->c_str()), allocator); } if (x.GetChecksum()) { - value.AddMember("checksum", - rapidjson::StringRef(x.GetChecksum().get().c_str()), + value.AddMember("checksum", rapidjson::StringRef(x.GetChecksum()->c_str()), allocator); } if (x.GetCompressedDataSize()) { - value.AddMember("compressedDataSize", x.GetCompressedDataSize().get(), + value.AddMember("compressedDataSize", *x.GetCompressedDataSize(), allocator); } if (x.GetDataSize()) { - value.AddMember("dataSize", x.GetDataSize().get(), allocator); + value.AddMember("dataSize", *x.GetDataSize(), allocator); } if (x.GetData()) { @@ -54,12 +52,12 @@ void to_json(const dataservice::write::model::PublishPartition& x, if (x.GetDataHandle()) { value.AddMember("dataHandle", - rapidjson::StringRef(x.GetDataHandle().get().c_str()), + rapidjson::StringRef(x.GetDataHandle()->c_str()), allocator); } if (x.GetTimestamp()) { - value.AddMember("timestamp", x.GetTimestamp().get(), allocator); + value.AddMember("timestamp", *x.GetTimestamp(), allocator); } } diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.cpp index f88315014..96fa18438 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/PublishPartitionsSerializer.cpp @@ -28,7 +28,7 @@ void to_json(const dataservice::write::model::PublishPartitions& x, rapidjson::Document::AllocatorType& allocator) { if (x.GetPartitions()) { rapidjson::Value partitions(rapidjson::kArrayType); - for (auto& partition : x.GetPartitions().get()) { + for (auto& partition : *x.GetPartitions()) { rapidjson::Value partition_value(rapidjson::kObjectType); to_json(partition, partition_value, allocator); partitions.PushBack(partition_value, allocator); diff --git a/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.cpp b/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.cpp index 7886e7af5..d9ce5729e 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.cpp +++ b/olp-cpp-sdk-dataservice-write/src/generated/serializer/UpdateIndexRequestSerializer.cpp @@ -32,7 +32,13 @@ void to_json(const dataservice::write::model::UpdateIndexRequest &x, rapidjson::Value indexFields(rapidjson::kObjectType); for (const auto &field_pair : addition.GetIndexFields()) { - using namespace dataservice::write::model; + using dataservice::write::model::BooleanIndexValue; + using dataservice::write::model::HereTileIndexValue; + using dataservice::write::model::IndexType; + using dataservice::write::model::IntIndexValue; + using dataservice::write::model::StringIndexValue; + using dataservice::write::model::TimeWindowIndexValue; + const auto &field = field_pair.second; const auto key = rapidjson::StringRef(field_pair.first.c_str()); auto index_type = field->getIndexType(); @@ -63,9 +69,9 @@ void to_json(const dataservice::write::model::UpdateIndexRequest &x, // by another model. if (addition.GetMetadata()) { rapidjson::Value metadatas(rapidjson::kObjectType); - for (const auto& metadata : addition.GetMetadata().get()) { - const auto& metadata_value = metadata.second; - const auto& metadata_key = metadata.first.c_str(); + for (const auto &metadata : *addition.GetMetadata()) { + const auto &metadata_value = metadata.second; + const auto &metadata_key = metadata.first.c_str(); indexFields.AddMember( rapidjson::StringRef(metadata_key), rapidjson::StringRef(metadata_value.c_str(), metadata_value.size()), @@ -75,13 +81,12 @@ void to_json(const dataservice::write::model::UpdateIndexRequest &x, if (addition.GetCheckSum()) { additionValue.AddMember( - "checksum", - rapidjson::StringRef(addition.GetCheckSum().get().c_str()), + "checksum", rapidjson::StringRef(addition.GetCheckSum()->c_str()), allocator); } if (addition.GetSize()) { - additionValue.AddMember("size", addition.GetSize().get(), allocator); + additionValue.AddMember("size", *addition.GetSize(), allocator); } additions.PushBack(additionValue, allocator); diff --git a/olp-cpp-sdk-dataservice-write/tests/ParserTest.cpp b/olp-cpp-sdk-dataservice-write/tests/ParserTest.cpp index 54f87239f..746ec330f 100644 --- a/olp-cpp-sdk-dataservice-write/tests/ParserTest.cpp +++ b/olp-cpp-sdk-dataservice-write/tests/ParserTest.cpp @@ -41,7 +41,13 @@ namespace { -using namespace olp::dataservice::write::model; +using olp::dataservice::write::model::Details; +using olp::dataservice::write::model::Publication; +using olp::dataservice::write::model::PublishPartition; +using olp::dataservice::write::model::PublishPartitions; +using olp::dataservice::write::model::ResponseOk; +using olp::dataservice::write::model::ResponseOkSingle; +using olp::dataservice::write::model::VersionDependency; TEST(ParserTest, ResponseOkSingle) { auto json = R"( @@ -472,11 +478,11 @@ TEST(ParserTest, PublishPartition) { auto response = olp::parser::parse(json); - EXPECT_STREQ("314010583", response.GetPartition().get().c_str()); + EXPECT_STREQ("314010583", response.GetPartition()->c_str()); EXPECT_STREQ("ff7494d6f17da702862e550c907c0a91", - response.GetChecksum().get().c_str()); - EXPECT_EQ(152417, response.GetCompressedDataSize().get()); - EXPECT_EQ(250110, response.GetDataSize().get()); + response.GetChecksum()->c_str()); + EXPECT_EQ(152417, *response.GetCompressedDataSize()); + EXPECT_EQ(250110, *response.GetDataSize()); auto data = response.GetData(); EXPECT_STREQ( "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/" @@ -485,8 +491,8 @@ TEST(ParserTest, PublishPartition) { "3zHYufF1Lf9HdIZBfNEiKAAAAAElFTkSuQmCC", std::string(data->begin(), data->end()).c_str()); EXPECT_STREQ("1b2ca68f-d4a0-4379-8120-cd025640510c", - response.GetDataHandle().get().c_str()); - EXPECT_EQ(1519219235, response.GetTimestamp().get()); + response.GetDataHandle()->c_str()); + EXPECT_EQ(1519219235, *response.GetTimestamp()); } TEST(ParserTest, PublishPartitions) { @@ -507,15 +513,15 @@ TEST(ParserTest, PublishPartitions) { )"; auto response = olp::parser::parse(json); - ASSERT_EQ(1, response.GetPartitions().get().size()); + ASSERT_EQ(1, response.GetPartitions()->size()); - auto partition = response.GetPartitions().get().at(0); + auto partition = response.GetPartitions()->at(0); - EXPECT_STREQ("314010583", partition.GetPartition().get().c_str()); + EXPECT_STREQ("314010583", partition.GetPartition()->c_str()); EXPECT_STREQ("ff7494d6f17da702862e550c907c0a91", - partition.GetChecksum().get().c_str()); - EXPECT_EQ(152417, partition.GetCompressedDataSize().get()); - EXPECT_EQ(250110, partition.GetDataSize().get()); + partition.GetChecksum()->c_str()); + EXPECT_EQ(152417, *partition.GetCompressedDataSize()); + EXPECT_EQ(250110, *partition.GetDataSize()); auto data = partition.GetData(); EXPECT_STREQ( "iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAABGdBTUEAALGPC/" @@ -524,8 +530,8 @@ TEST(ParserTest, PublishPartitions) { "3zHYufF1Lf9HdIZBfNEiKAAAAAElFTkSuQmCC", std::string(data->begin(), data->end()).c_str()); EXPECT_STREQ("1b2ca68f-d4a0-4379-8120-cd025640510c", - partition.GetDataHandle().get().c_str()); - EXPECT_EQ(1519219235, partition.GetTimestamp().get()); + partition.GetDataHandle()->c_str()); + EXPECT_EQ(1519219235, *partition.GetTimestamp()); } TEST(ParserTest, Details) { @@ -560,7 +566,8 @@ TEST(ParserTest, VersionDependency) { auto response = olp::parser::parse(json); EXPECT_TRUE(response.GetDirect()); - EXPECT_STREQ("hrn:here:data::olp-here-test:my-catalog", response.GetHrn().c_str()); + EXPECT_STREQ("hrn:here:data::olp-here-test:my-catalog", + response.GetHrn().c_str()); EXPECT_EQ(1, response.GetVersion()); } @@ -592,22 +599,22 @@ TEST(ParserTest, Publication) { auto response = olp::parser::parse(json); EXPECT_STREQ("34bc2a16-0373-4157-8ccc-19ba08a6672b", - response.GetId().get().c_str()); + response.GetId()->c_str()); - auto details = response.GetDetails().get(); + auto details = *response.GetDetails(); EXPECT_STREQ("initialized", details.GetState().c_str()); EXPECT_STREQ("Publication initialized", details.GetMessage().c_str()); EXPECT_EQ(1523459129829, details.GetStarted()); EXPECT_EQ(1523459129829, details.GetModified()); EXPECT_EQ(1523459129829, details.GetExpires()); - ASSERT_EQ(1, response.GetLayerIds().get().size()); - EXPECT_STREQ("my-layer", response.GetLayerIds().get().at(0).c_str()); + ASSERT_EQ(1, response.GetLayerIds()->size()); + EXPECT_STREQ("my-layer", response.GetLayerIds()->at(0).c_str()); - EXPECT_EQ(1, response.GetCatalogVersion().get()); + EXPECT_EQ(1, *response.GetCatalogVersion()); - ASSERT_EQ(1, response.GetVersionDependencies().get().size()); - auto version_dependency = response.GetVersionDependencies().get().at(0); + ASSERT_EQ(1, response.GetVersionDependencies()->size()); + auto version_dependency = response.GetVersionDependencies()->at(0); EXPECT_TRUE(version_dependency.GetDirect()); EXPECT_STREQ("hrn:here:data::olp-here-test:my-catalog", diff --git a/olp-cpp-sdk-dataservice-write/tests/StreamLayerClientImplTest.cpp b/olp-cpp-sdk-dataservice-write/tests/StreamLayerClientImplTest.cpp index 1fba77a66..54edc8a88 100644 --- a/olp-cpp-sdk-dataservice-write/tests/StreamLayerClientImplTest.cpp +++ b/olp-cpp-sdk-dataservice-write/tests/StreamLayerClientImplTest.cpp @@ -373,9 +373,8 @@ TEST_F(StreamLayerClientImplTest, CancelPublishDataLessThanTwentyMib) { olp::http::Network::Callback, olp::http::Network::HeaderCallback, olp::http::Network::DataCallback) { - std::thread([cancel_context]() { - cancel_context->CancelOperation(); - }).detach(); + std::thread([cancel_context]() { cancel_context->CancelOperation(); }) + .detach(); constexpr auto unused_request_id = 5; return olp::http::SendOutcome(unused_request_id); @@ -742,7 +741,7 @@ TEST_F(StreamLayerClientImplTest, QueueAndFlush) { client::CancellationContext /*context*/) -> write::PublishDataResponse { write::PublishDataResult result; - result.SetTraceID(request.GetTraceId().get()); + result.SetTraceID(*request.GetTraceId()); return write::PublishDataResponse{result}; }); ON_CALL(*client, GenerateUuid) @@ -761,8 +760,8 @@ TEST_F(StreamLayerClientImplTest, QueueAndFlush) { .WithData(std::make_shared>(1, 'z')) .WithLayerId("layer"); - auto error = client->Queue(std::move(request)); - EXPECT_EQ(boost::none, error) << *error; + auto error = client->Queue(request); + EXPECT_EQ(olp::porting::none, error) << *error; } EXPECT_EQ(client->QueueSize(), kBatchSize); diff --git a/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplPublishToBatchTest.cpp b/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplPublishToBatchTest.cpp index c59b934bf..bb3fb83f4 100644 --- a/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplPublishToBatchTest.cpp +++ b/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplPublishToBatchTest.cpp @@ -135,7 +135,7 @@ class VersionedLayerClientImplPublishToBatchTest : public ::testing::Test { int status = olp::http::HttpStatusCode::NO_CONTENT) { auto api = MockApiRequest("publish"); const std::string url = api.GetBaseUrl() + "/layers/" + layer + - "/publications/" + publication.GetId().get() + + "/publications/" + *publication.GetId() + "/partitions"; EXPECT_CALL(*network_, Send(IsPostRequest(url), _, _, _, _)) diff --git a/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplTest.cpp b/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplTest.cpp index 53d7e8f25..4a68f378b 100644 --- a/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplTest.cpp +++ b/olp-cpp-sdk-dataservice-write/tests/VersionedLayerClientImplTest.cpp @@ -154,8 +154,8 @@ TEST_F(VersionedLayerClientImplTest, StartBatch) { ASSERT_TRUE(result.GetId()); ASSERT_TRUE(result.GetDetails()); ASSERT_TRUE(result.GetLayerIds()); - ASSERT_EQ(result.GetLayerIds().get().size(), 1); - ASSERT_EQ(result.GetLayerIds().get().front(), kLayer); + ASSERT_EQ(result.GetLayerIds()->size(), 1); + ASSERT_EQ(result.GetLayerIds()->front(), kLayer); ASSERT_NE("", response.GetResult().GetId().value()); Mock::VerifyAndClearExpectations(network_.get()); Mock::VerifyAndClearExpectations(cache_.get()); @@ -196,8 +196,8 @@ TEST_F(VersionedLayerClientImplTest, StartBatch) { ASSERT_TRUE(result.GetId()); ASSERT_TRUE(result.GetDetails()); ASSERT_TRUE(result.GetLayerIds()); - ASSERT_EQ(result.GetLayerIds().get().size(), 1); - ASSERT_EQ(result.GetLayerIds().get().front(), kLayer); + ASSERT_EQ(result.GetLayerIds()->size(), 1); + ASSERT_EQ(result.GetLayerIds()->front(), kLayer); ASSERT_NE("", response.GetResult().GetId().value()); Mock::VerifyAndClearExpectations(network_.get()); Mock::VerifyAndClearExpectations(cache_.get()); @@ -228,8 +228,8 @@ TEST_F(VersionedLayerClientImplTest, StartBatch) { ASSERT_TRUE(result.GetId()); ASSERT_TRUE(result.GetDetails()); ASSERT_TRUE(result.GetLayerIds()); - ASSERT_EQ(result.GetLayerIds().get().size(), 1); - ASSERT_EQ(result.GetLayerIds().get().front(), kLayer); + ASSERT_EQ(result.GetLayerIds()->size(), 1); + ASSERT_EQ(result.GetLayerIds()->front(), kLayer); ASSERT_NE("", response.GetResult().GetId().value()); Mock::VerifyAndClearExpectations(network_.get()); Mock::VerifyAndClearExpectations(cache_.get()); @@ -417,8 +417,7 @@ TEST_F(VersionedLayerClientImplTest, CompleteBatch) { ASSERT_FALSE(api.empty()); ASSERT_TRUE(publication.GetId()); - const auto publication_publish_url = - kPublishUrl + "/" + publication.GetId().get(); + const auto publication_publish_url = kPublishUrl + "/" + *publication.GetId(); // auth token should be valid till the end of all tests EXPECT_CALL( From c555d6f63f236abd9ec17eb2ca46eae5874714ad Mon Sep 17 00:00:00 2001 From: Alexander Sopov Date: Fri, 8 Aug 2025 10:48:16 +0200 Subject: [PATCH 2/2] 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 second part of the task: olp-cpp-sdk-write. Relates-To: NLAM-23 Signed-off-by: sopov --- olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.h b/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.h index e7c54ed05..b0bc570ef 100644 --- a/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.h +++ b/olp-cpp-sdk-dataservice-write/src/generated/ConfigApi.h @@ -51,9 +51,8 @@ class ConfigApi { * @param billing_tag An optional free-form tag which is used for grouping * billing records together. If supplied, it must be between 4 - 16 * characters, contain only alpha/numeric ASCII characters [A-Za-z0-9]. - * @param callback - * @param A callback function to invoke with the catalog configuration - * response. + * @param callback A callback function to invoke with the catalog + * configuration response. * * @return The cancellation token. */