-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathVersionedLayerClientImpl.h
More file actions
104 lines (84 loc) · 3.41 KB
/
VersionedLayerClientImpl.h
File metadata and controls
104 lines (84 loc) · 3.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
* Copyright (C) 2019 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
* License-Filename: LICENSE
*/
#pragma once
#include <memory>
#include <olp/core/client/CancellationContext.h>
#include <olp/core/client/CancellationToken.h>
#include <olp/core/client/HRN.h>
#include <olp/core/client/OlpClientSettings.h>
#include <olp/core/client/PendingRequests.h>
#include <olp/dataservice/read/DataRequest.h>
#include <olp/dataservice/read/PartitionsRequest.h>
#include <olp/dataservice/read/PrefetchTileResult.h>
#include <olp/dataservice/read/PrefetchTilesRequest.h>
#include <olp/dataservice/read/TileRequest.h>
#include <olp/dataservice/read/Types.h>
#include <boost/optional.hpp>
#include "RequestBroker.h"
#include "repositories/ExecuteOrSchedule.inl"
namespace olp {
namespace thread {
class TaskScheduler;
}
namespace dataservice {
namespace read {
namespace repository {
class PartitionsRepository;
class PrefetchTilesRepository;
} // namespace repository
class VersionedLayerClientImpl {
public:
VersionedLayerClientImpl(client::HRN catalog, std::string layer_id,
boost::optional<int64_t> catalog_version,
client::OlpClientSettings settings);
virtual ~VersionedLayerClientImpl();
virtual bool CancelPendingRequests();
virtual client::CancellationToken GetData(DataRequest data_request,
DataResponseCallback callback);
virtual client::CancellableFuture<DataResponse> GetData(
DataRequest data_request);
virtual client::CancellationToken GetData(TileRequest tile_request,
DataResponseCallback callback);
virtual client::CancellableFuture<DataResponse> GetData(
TileRequest tile_request);
virtual client::CancellationToken GetPartitions(
PartitionsRequest partitions_request,
PartitionsResponseCallback callback);
virtual client::CancellableFuture<PartitionsResponse> GetPartitions(
PartitionsRequest partitions_request);
virtual client::CancellationToken PrefetchTiles(
PrefetchTilesRequest request, PrefetchTilesResponseCallback callback);
virtual client::CancellableFuture<PrefetchTilesResponse> PrefetchTiles(
PrefetchTilesRequest request);
virtual bool RemoveFromCache(const std::string& partition_id);
virtual bool RemoveFromCache(const geo::TileKey& tile);
private:
CatalogVersionResponse GetVersion(boost::optional<std::string> billing_tag,
const FetchOptions& fetch_options,
const client::CancellationContext& context);
client::HRN catalog_;
std::string layer_id_;
client::OlpClientSettings settings_;
RequestBroker broker_;
std::shared_ptr<client::PendingRequests> pending_requests_;
std::atomic<int64_t> catalog_version_;
};
} // namespace read
} // namespace dataservice
} // namespace olp