olp-cpp-sdk 1.24.0
Loading...
Searching...
No Matches
OlpClientSettingsFactory.h
1/*
2 * Copyright (C) 2019-2023 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 <memory>
23#include <string>
24
25#include "olp/core/CoreApi.h"
26#include "olp/core/http/Network.h"
27#include "olp/core/http/NetworkInitializationSettings.h"
28#include "olp/core/thread/TaskScheduler.h"
29
30namespace olp {
31namespace cache {
32class KeyValueCache;
33struct CacheSettings;
34} // namespace cache
35
36namespace client {
37struct OlpClientSettings;
38
43class CORE_API OlpClientSettingsFactory final {
44 public:
54 static std::unique_ptr<thread::TaskScheduler> CreateDefaultTaskScheduler(
55 size_t thread_count = 1u);
56
75 static std::shared_ptr<http::Network> CreateDefaultNetworkRequestHandler(
76 size_t max_requests_count = 30u);
77
98 static std::shared_ptr<http::Network> CreateDefaultNetworkRequestHandler(
100
115 static std::unique_ptr<cache::KeyValueCache> CreateDefaultCache(
116 cache::CacheSettings settings);
117
135 static void PrewarmConnection(const OlpClientSettings& settings,
136 const std::string& url,
137 http::Network::Callback callback = nullptr);
138};
139
140} // namespace client
141} // namespace olp
Fills in the OlpClientSettings structure with default handlers.
Definition OlpClientSettingsFactory.h:43
static std::shared_ptr< http::Network > CreateDefaultNetworkRequestHandler(http::NetworkInitializationSettings settings)
Creates the Network instance used for all the non-local requests.
static std::unique_ptr< thread::TaskScheduler > CreateDefaultTaskScheduler(size_t thread_count=1u)
Creates the TaskScheduler instance used for all the delayed operations.
static void PrewarmConnection(const OlpClientSettings &settings, const std::string &url, http::Network::Callback callback=nullptr)
This function helps you prewarm the connection to the provided host.
static std::shared_ptr< http::Network > CreateDefaultNetworkRequestHandler(size_t max_requests_count=30u)
Creates the Network instance used for all the non-local requests.
static std::unique_ptr< cache::KeyValueCache > CreateDefaultCache(cache::CacheSettings settings)
Creates the KeyValueCache instance that includes both a small memory LRU cache and a larger persisten...
std::function< void(NetworkResponse response)> Callback
The callback that is called when the request is processed or canceled.
Definition Network.h:41
Rules all the other namespaces.
Definition AppleSignInProperties.h:24
Settings for memory and disk caching.
Definition CacheSettings.h:63
Configures the behavior of the OlpClient class.
Definition OlpClientSettings.h:178
Settings for network initialization.
Definition NetworkInitializationSettings.h:32