Skip to content

Commit b854f45

Browse files
Improve Doxygen for VersionedLayerClient
- add additional info about versions - add usage example - add info about saving request when version is provided Resolves: OLPEDGE-854 Signed-off-by: Diachenko Mykahilo <[email protected]>
1 parent 15d241f commit b854f45

File tree

1 file changed

+94
-45
lines changed

1 file changed

+94
-45
lines changed

olp-cpp-sdk-dataservice-read/include/olp/dataservice/read/VersionedLayerClient.h

Lines changed: 94 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -40,87 +40,136 @@ namespace read {
4040
class VersionedLayerClientImpl;
4141

4242
/**
43-
* @brief The VersionedLayerClient aimed to acquire data from OLP services.
43+
* @brief Client that acquires data from an OLP versioned layer. The versioned
44+
* layer stores slowly-changing data that must remain logically consistent with
45+
* other layers in a catalog.
46+
*
47+
* @note When you request a particular version of data from a versioned layer,
48+
* the partition that gets returned may have a lower version number than you
49+
* requested. Only those layers and partitions that are updated have their
50+
* version updated to the catalog new version number. The version of a
51+
* layer or partition represents the catalog version in which the layer or
52+
* partition was last updated.
53+
*
54+
* @note If a catalog version is not specified, the latest version is used. To
55+
* query the latest version of a catalog, an additional request to OLP is
56+
* needed.
57+
*
58+
* Example with version provided that saves one network request:
59+
* @code{.cpp}
60+
* auto task_scheduler =
61+
* olp::client::OlpClientSettingsFactory::CreateDefaultTaskScheduler(1u);
62+
* auto http_client = olp::client::
63+
* OlpClientSettingsFactory::CreateDefaultNetworkRequestHandler();
64+
*
65+
* olp::authentication::Settings settings{"Your.Key.Id", "Your.Key.Secret"};
66+
* settings.task_scheduler = task_scheduler;
67+
* settings.network_request_handler = http_client;
68+
*
69+
* olp::client::AuthenticationSettings auth_settings;
70+
* auth_settings.provider =
71+
* olp::authentication::TokenProviderDefault(std::move(settings));
72+
*
73+
* auto client_settings = olp::client::OlpClientSettings();
74+
* client_settings.authentication_settings = auth_settings;
75+
* client_settings.task_scheduler = std::move(task_scheduler);
76+
* client_settings.network_request_handler = std::move(http_client);
77+
*
78+
* VersionedLayerClient client{"hrn:here:data:::your-catalog-hrn" "your-layer-id", client_settings};
79+
* auto callback = [](olp::client::ApiResponse<olp::model::Data, olp::client::ApiError> response) {};
80+
* auto request = DataRequest().WithVersion(100).WithPartitionId("269");
81+
* auto token = client.GetData(request, callback);
82+
* @endcode
83+
*
84+
* @see
85+
* https://developer.here.com/olp/documentation/data-api/data_dev_guide/shared_content/topics/olp/concepts/layers.html
86+
* @see
87+
* https://developer.here.com/olp/documentation/data-api/data_dev_guide/rest/getting-data-versioned.html
4488
*/
4589
class DATASERVICE_READ_API VersionedLayerClient final {
4690
public:
4791
/**
4892
* @brief VersionedLayerClient constructor
49-
* @param catalog a catalog that the versioned layer client uses during
50-
* requests.
51-
* @param layer_id a layer id that the versioned layer client uses during
93+
* @param catalog HRN of the catalog to which this layer belongs.
94+
* @param layer_id Layer ID of the versioned layer that is used for all
5295
* requests.
53-
* @param settings settings used to control the client instance behavior.
96+
* @param settings Settings used to control the client instance behavior.
5497
*/
5598
VersionedLayerClient(client::HRN catalog, std::string layer_id,
5699
client::OlpClientSettings settings);
57100

58101
~VersionedLayerClient();
59102

60103
/**
61-
* @brief Fetches data for a partition or data handle asynchronously. If the
62-
* specified partition or data handle cannot be found in the layer, the
63-
* callback will be invoked with an empty DataResponse (nullptr for result and
64-
* error). If neither Partition Id or Data Handle were set in the request, the
65-
* callback will be invoked with an error with ErrorCode::InvalidRequest.
66-
* @param data_request contains the complete set of request parameters.
67-
* \note \c DataRequest's GetLayerId value will be ignored and the parameter
68-
* from the constructor will be used instead.
69-
* @param callback will be invoked once the DataResult is available, or an
70-
* error is encountered.
71-
* @return A token that can be used to cancel this request.
104+
* @brief Fetches data for a partition ID or data handle asynchronously.
105+
*
106+
* If the specified partition ID or data handle cannot be found in the layer,
107+
* the callback is invoked with an empty DataResponse (a nullptr result and
108+
* error). If the partition ID or data handle are not set in the request, the
109+
* callback is invoked with the error ErrorCode::InvalidRequest. If the
110+
* version is not specified, an additional request to OLP is created to
111+
* retrieve the latest available partition version.
112+
*
113+
* @param data_request Contains the complete set of the request parameters.
114+
* @note GetLayerId value of the \c DataRequest is ignored, and the parameter
115+
* from the constructor is used instead.
116+
* @param callback Is invoked once the DataResult is available or an error is
117+
* encountered.
118+
* @return Token that can be used to cancel the GetData request.
72119
*/
73120
client::CancellationToken GetData(DataRequest data_request,
74121
DataResponseCallback callback);
75122

76123
/**
77-
* @brief fetches a list partitions for given generic layer asynchronously.
78-
* @param request contains the complete set of request parameters.
79-
* \note \c PartitionsRequest's GetLayerId value will be ignored and the
80-
* parameter from the constructor will be used instead.
81-
* @param callback will be invoked once the list of partitions is available,
82-
* or an error is encountered.
83-
* @return A token that can be used to cancel this request
124+
* @brief Fetches a list of partitions for the given generic layer
125+
* asynchronously.
126+
* @param partitions_request Contains the complete set of the request
127+
* parameters.
128+
* @note GetLayerId value of the \c PartitionsRequest is ignored, and the
129+
* parameter from the constructor is used instead.
130+
* @param callback Is invoked once the list of partitions is available or an
131+
* error is encountered.
132+
* @return Token that can be used to cancel the GetPartitions request.
84133
*/
85134
client::CancellationToken GetPartitions(PartitionsRequest partitions_request,
86135
PartitionsResponseCallback callback);
87136

88137
/**
89138
* @brief Pre-fetches a set of tiles asychronously.
90139
*
91-
* This method recursively downloads all tilekeys from minLevel to maxLevel
92-
* specified in the \c PrefetchTilesRequest's properties. This will help to
93-
* reduce the network load by using the pre-fetched tiles' data from cache.
140+
* This method recursively downloads all tilekeys from the minLevel to
141+
* maxLevel parameters of the \c PrefetchTilesRequest. It helps to reduce the
142+
* network load by using the pre-fetched tiles data from cache.
94143
*
95-
* \note - this does not guarantee that all tiles are available offline, as
96-
* the cache might overflow and data might be evicted at any point.
144+
* @note This does not guarantee that all tiles are available offline as the
145+
* cache might overflow and data might be evicted at any point.
97146
*
98-
* @param request contains the complete set of request parameters.
99-
* \note The \c PrefetchTilesRequest's GetLayerId value will be ignored and
100-
* the parameter from constructore will be used instead.
101-
* @param callback will be invoked once the \c PrefetchTilesResult is
102-
* available, or an error is encountered.
103-
* @return A token that can be used to cancel this request.
147+
* @param request Contains the complete set of the request parameters.
148+
* @note GetLayerId value of the \c PrefetchTilesRequest is ignored, and the
149+
* parameter from the constructor is used instead.
150+
* @param callback Is invoked once the \c PrefetchTilesResult is available or
151+
* an error is encountered.
152+
* @return Token that can be used to cancel this request.
104153
*/
105154
client::CancellationToken PrefetchTiles(
106155
PrefetchTilesRequest request, PrefetchTilesResponseCallback callback);
107156

108157
/**
109158
* @brief Pre-fetches a set of tiles asychronously.
110159
*
111-
* This method recursively downloads all tilekeys from minLevel to maxLevel
112-
* specified in the \c PrefetchTilesRequest's properties. This will help to
113-
* reduce the network load by using the pre-fetched tiles' data from cache.
160+
* This method recursively downloads all tilekeys from the minLevel to
161+
* maxLevel specified in the \c PrefetchTilesRequest properties. This helps to
162+
* reduce the network load by using the pre-fetched tiles data from cache.
114163
*
115-
* \note - this does not guarantee that all tiles are available offline, as
116-
* the cache might overflow and data might be evicted at any point.
164+
* @note This does not guarantee that all tiles are available offline as the
165+
* cache might overflow and data might be evicted at any point.
117166
*
118-
* @param request contains the complete set of request parameters.
119-
* \note The \c PrefetchTilesRequest's GetLayerId value will be ignored and
120-
* the parameter from constructore will be used instead.
121-
* @return CancellableFuture of type \c PrefetchTilesResponse, which when
122-
* complete will contain the data or an error. Alternatively, the
123-
* \c CancellableFuture can be used to cancel this request.
167+
* @param request Contains the complete set of the request parameters.
168+
* @note GetLayerId value of the \c PrefetchTilesRequest is ignored, and
169+
* the parameter from the constructor is used instead.
170+
* @return CancellableFuture of the \c PrefetchTilesResponse type. When
171+
* completed, the CancellableFuture contains data or an error. Alternatively,
172+
* the \c CancellableFuture can be used to cancel this request.
124173
*/
125174
client::CancellableFuture<PrefetchTilesResponse> PrefetchTiles(
126175
PrefetchTilesRequest request);

0 commit comments

Comments
 (0)