Flow-IPC 3.0.0
Flow-IPC project: Full implementation reference.
session_cfg.hpp
Go to the documentation of this file.
1/* Flow-IPC: Sessions
2 * Copyright 2023 Akamai Technologies, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the
5 * "License"); you may not use this file except in
6 * compliance with the License. You may obtain a copy
7 * of the License at
8 *
9 * https://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in
12 * writing, software distributed under the License is
13 * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
14 * CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing
16 * permissions and limitations under the License. */
17
18/// @file
19#pragma once
20
22#include "ipc/common.hpp"
23#include "ipc/util/util_fwd.hpp"
24
25namespace ipc::session
26{
27
28// Types.
29
30/**
31 * Grouping of compile-time config/knobs (as of this writing: constants) governing some of the behavior of
32 * ipc::session sessions.
33 *
34 * ### Rationale ###
35 * Some of these could be viewed as implementation details; nevertheless they are public, much like
36 * transport::Native_socket_stream_cfg: it is harmless, and it can be helpful for logging/reporting or for
37 * understanding the system's behavior (e.g., how quickly a stuck opposing process is detected).
38 *
39 * @todo Session_cfg is the nucleus of a more general overhaul of ipc::session configuration (e.g., grouping
40 * various `Session` / `Session_server` template parameters into a `struct`; possibly per-Client_app knobs).
41 * Its constants may then become run-time and/or per-session-configurable.
42 */
44{
45public:
46 // Constants.
47
48 /**
49 * The period with which each session-internal channel -- notably the session master channel; also the
50 * internal channel used by an arena-lending SHM-provider (as of this writing SHM-jemalloc) -- sends low-level
51 * keep-alive pings to the opposing peer. See transport::Channel::auto_ping().
52 *
53 * The opposing side uses the same value; hence #S_IDLE_TIMEOUT (which must comfortably exceed it) works
54 * consistently in both directions.
55 */
56 static constexpr util::Fine_duration S_PING_PERIOD = boost::chrono::seconds{2};
57
58 /**
59 * The idle timeout of each session-internal channel (see #S_PING_PERIOD): if no low-level traffic -- including
60 * the opposing side's pings -- arrives in this long, the channel is considered hosed; and hence the session is
61 * too. See transport::Channel::idle_timer_run().
62 *
63 * Its purpose is to detect an opposing process that is stuck (alive but not functioning), as opposed to dead
64 * (detected immediately regardless). As a false positive (hosing a healthy session over a transient stall)
65 * is costlier than slower detection of a stuck peer, the value is generous relative to #S_PING_PERIOD.
66 */
67 static constexpr util::Fine_duration S_IDLE_TIMEOUT = boost::chrono::seconds{15};
68
69private:
70 // Constructors/destructor.
71
72 /// Forbid instantiation, for it is pointless.
73 Session_cfg() = delete;
74}; // class Session_cfg
75
76} // namespace ipc::session
Grouping of compile-time config/knobs (as of this writing: constants) governing some of the behavior ...
Definition: session_cfg.hpp:44
static constexpr util::Fine_duration S_PING_PERIOD
The period with which each session-internal channel – notably the session master channel; also the in...
Definition: session_cfg.hpp:56
Session_cfg()=delete
Forbid instantiation, for it is pointless.
static constexpr util::Fine_duration S_IDLE_TIMEOUT
The idle timeout of each session-internal channel (see S_PING_PERIOD): if no low-level traffic – incl...
Definition: session_cfg.hpp:67
Flow-IPC module providing the broad lifecycle and shared-resource organization – via the session conc...
Definition: app.cpp:29
flow::Fine_duration Fine_duration
Short-hand for Flow's Fine_duration.
Definition: util_fwd.hpp:114