cpp-msgpack-rpc 0.2.0
An RPC library implementing MessagePack RPC.
Loading...
Searching...
No Matches
client_config.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 MusicScience37 (Kenta Kabashima)
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 */
20#pragma once
21
22#include <chrono>
23#include <string_view>
24#include <vector>
25
30#include "msgpack_rpc/impl/msgpack_rpc_export.h"
31
33
38class MSGPACK_RPC_EXPORT ClientConfig {
39public:
47
55
62 ClientConfig& add_uri(std::string_view uri);
63
69 [[nodiscard]] const std::vector<addresses::URI>& uris() const noexcept;
70
77 ClientConfig& call_timeout(std::chrono::nanoseconds value);
78
84 [[nodiscard]] std::chrono::nanoseconds call_timeout() const noexcept;
85
91 [[nodiscard]] MessageParserConfig& message_parser() noexcept;
92
98 [[nodiscard]] const MessageParserConfig& message_parser() const noexcept;
99
105 [[nodiscard]] ExecutorConfig& executor() noexcept;
106
112 [[nodiscard]] const ExecutorConfig& executor() const noexcept;
113
119 [[nodiscard]] ReconnectionConfig& reconnection() noexcept;
120
126 [[nodiscard]] const ReconnectionConfig& reconnection() const noexcept;
127
128private:
130 std::vector<addresses::URI> uris_;
131
133 std::chrono::nanoseconds call_timeout_;
134
137
140
143};
144
145} // namespace msgpack_rpc::config
Class of URIs (Uniform Resource Identifiers) to specify endpoints in this library.
Definition uri.h:38
ReconnectionConfig & reconnection() noexcept
Get the configuration of reconnection.
std::vector< addresses::URI > uris_
URIs.
ClientConfig & call_timeout(std::chrono::nanoseconds value)
Set the duration of timeout of RPCs.
ExecutorConfig & executor() noexcept
Get the configuration of executors.
ExecutorConfig executor_
Configuration of executors.
ReconnectionConfig reconnection_
Configuration of reconnection.
const std::vector< addresses::URI > & uris() const noexcept
Get the URIs of the server.
MessageParserConfig message_parser_
Configuration of parsers of messages.
std::chrono::nanoseconds call_timeout_
Duration of timeout of RPCs.
MessageParserConfig & message_parser() noexcept
Get the configuration of parsers of messages.
ClientConfig & add_uri(addresses::URI uri)
Add a URI of the server.
Class of configuration of executors.
Class of configuration of parsers of messages.
Class of configurations of reconnection.
Definition of ExecutorConfig class.
Definition of MessageParserConfig class.
Namespace of configurations.
Definition of ReconnectionConfig class.
Definition of URI class.