olp-cpp-sdk  1.22.0
KeyGenerator.h
1 /*
2  * Copyright (C) 2021 HERE Europe B.V.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  * SPDX-License-Identifier: Apache-2.0
17  * License-Filename: LICENSE
18  */
19 
20 #pragma once
21 
22 #include <string>
23 
24 #include <olp/core/CoreApi.h>
25 #include <olp/core/client/HRN.h>
26 #include <olp/core/geo/tiling/TileKey.h>
27 #include <boost/optional.hpp>
28 
29 namespace olp {
30 namespace cache {
31 
35 class CORE_API KeyGenerator {
36  public:
46  static std::string CreateApiKey(const std::string& hrn,
47  const std::string& service,
48  const std::string& version);
49 
57  static std::string CreateCatalogKey(const std::string& hrn);
58 
66  static std::string CreateLatestVersionKey(const std::string& hrn);
67 
78  static std::string CreatePartitionKey(
79  const std::string& hrn, const std::string& layer_id,
80  const std::string& partition_id, const boost::optional<int64_t>& version);
81 
91  static std::string CreatePartitionsKey(
92  const std::string& hrn, const std::string& layer_id,
93  const boost::optional<int64_t>& version);
94 
103  static std::string CreateLayerVersionsKey(const std::string& hrn,
104  const int64_t version);
105 
117  static std::string CreateQuadTreeKey(const std::string& hrn,
118  const std::string& layer_id,
119  olp::geo::TileKey root,
120  const boost::optional<int64_t>& version,
121  int32_t depth);
122 
132  static std::string CreateDataHandleKey(const std::string& hrn,
133  const std::string& layer_id,
134  const std::string& data_handle);
135 };
136 
137 } // namespace cache
138 } // namespace olp
Helper class to generate cache keys for different entities.
Definition: KeyGenerator.h:35
static std::string CreateQuadTreeKey(const std::string &hrn, const std::string &layer_id, olp::geo::TileKey root, const boost::optional< int64_t > &version, int32_t depth)
Generates cache key for storing quadtree metadata.
static std::string CreateApiKey(const std::string &hrn, const std::string &service, const std::string &version)
Generates cache key for service API.
static std::string CreatePartitionsKey(const std::string &hrn, const std::string &layer_id, const boost::optional< int64_t > &version)
Generates cache key for storing list of partitions.
static std::string CreateLatestVersionKey(const std::string &hrn)
Generates cache key to store latest catalog version.
static std::string CreateLayerVersionsKey(const std::string &hrn, const int64_t version)
Generates cache key for storing list of available layer versions.
static std::string CreateCatalogKey(const std::string &hrn)
Generates cache key for catalog data.
static std::string CreatePartitionKey(const std::string &hrn, const std::string &layer_id, const std::string &partition_id, const boost::optional< int64_t > &version)
Generates cache key for storing partition data.
static std::string CreateDataHandleKey(const std::string &hrn, const std::string &layer_id, const std::string &data_handle)
Generates cache key for data handle entities.
Addresses a tile in a quadtree.
Definition: TileKey.h:63
Rules all the other namespaces.
Definition: AppleSignInProperties.h:24