26 #include <olp/core/thread/TaskScheduler.h>
27 #include <olp/dataservice/read/DataServiceReadApi.h>
28 #include <olp/dataservice/read/FetchOptions.h>
29 #include <boost/optional.hpp>
32 namespace dataservice {
65 boost::optional<std::string> partition_id) {
66 partition_id_ = std::move(partition_id);
81 partition_id_ = std::move(partition_id);
113 data_handle_ = std::move(data_handle);
130 data_handle_ = std::move(data_handle);
158 billing_tag_ = std::move(tag);
173 billing_tag_ = std::move(tag);
198 fetch_option_ = fetch_option;
219 priority_ = priority;
231 inline std::string
CreateKey(
const std::string& layer_id,
232 boost::optional<int64_t> version)
const {
233 std::stringstream out;
234 out << layer_id <<
"[";
235 if (GetPartitionId()) {
236 out << GetPartitionId().get();
237 }
else if (GetDataHandle()) {
238 out << GetDataHandle().get();
242 out <<
"@" << version.get();
244 if (GetBillingTag()) {
245 out <<
"$" << GetBillingTag().get();
247 out <<
"^" << GetFetchOption();
252 boost::optional<std::string> partition_id_;
253 boost::optional<int64_t> catalog_version_;
254 boost::optional<std::string> data_handle_;
255 boost::optional<std::string> billing_tag_;
256 FetchOptions fetch_option_{OnlineIfNotFound};
257 uint32_t priority_{thread::NORMAL};
Encapsulates the fields required to request data for the given catalog, layer, and partition.
Definition: DataRequest.h:43
const boost::optional< std::string > & GetDataHandle() const
Get the partition data handle.
Definition: DataRequest.h:96
DataRequest & WithBillingTag(std::string &&tag)
Sets the billing tag for the request.
Definition: DataRequest.h:172
DataRequest & WithPartitionId(boost::optional< std::string > partition_id)
Sets the partition ID.
Definition: DataRequest.h:64
DataRequest & WithBillingTag(boost::optional< std::string > tag)
Sets the billing tag for the request.
Definition: DataRequest.h:157
std::string CreateKey(const std::string &layer_id, boost::optional< int64_t > version) const
Creates a readable format for the request.
Definition: DataRequest.h:231
DataRequest & WithPriority(uint32_t priority)
Sets the priority of the request.
Definition: DataRequest.h:218
FetchOptions GetFetchOption() const
Gets the fetch option that controls how requests are handled.
Definition: DataRequest.h:185
const boost::optional< std::string > & GetPartitionId() const
Gets the ID of the requested partition.
Definition: DataRequest.h:50
const boost::optional< std::string > & GetBillingTag() const
Gets the billing tag to group billing records together.
Definition: DataRequest.h:144
DataRequest & WithDataHandle(boost::optional< std::string > data_handle)
Sets the partition data handle.
Definition: DataRequest.h:112
DataRequest & WithDataHandle(std::string &&data_handle)
Sets the partition data handle.
Definition: DataRequest.h:129
DataRequest & WithFetchOption(FetchOptions fetch_option)
Sets the fetch option that you can use to set the source from which data should be fetched.
Definition: DataRequest.h:197
DataRequest & WithPartitionId(std::string &&partition_id)
Sets the partition ID.
Definition: DataRequest.h:80
uint32_t GetPriority() const
Gets the request priority.
Definition: DataRequest.h:209
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24