forked from scylladb/scylladb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimeout_config.hh
56 lines (42 loc) · 1.6 KB
/
timeout_config.hh
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
/*
* Copyright (C) 2018-present ScyllaDB
*
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include "db/timeout_clock.hh"
#include "utils/updateable_value.hh"
namespace db { class config; }
class updateable_timeout_config;
/// timeout_config represents a snapshot of the options stored in it when
/// an instance of this class is created. so far this class is only used by
/// client_state. so either these classes are obliged to
/// update it by themselves, or they are fine with using the maybe-updated
/// options in the lifecycle of a client / connection even if some of these
/// options are changed whtn the client / connection is still alive.
struct timeout_config {
using duration_t = db::timeout_clock::duration;
duration_t read_timeout;
duration_t write_timeout;
duration_t range_read_timeout;
duration_t counter_write_timeout;
duration_t truncate_timeout;
duration_t cas_timeout;
duration_t other_timeout;
};
struct updateable_timeout_config {
using timeout_option_t = utils::updateable_value<uint32_t>;
timeout_option_t read_timeout_in_ms;
timeout_option_t write_timeout_in_ms;
timeout_option_t range_read_timeout_in_ms;
timeout_option_t counter_write_timeout_in_ms;
timeout_option_t truncate_timeout_in_ms;
timeout_option_t cas_timeout_in_ms;
timeout_option_t other_timeout_in_ms;
explicit updateable_timeout_config(const db::config& cfg);
timeout_config current_values() const;
};
using timeout_config_selector = db::timeout_clock::duration (timeout_config::*);
extern const timeout_config infinite_timeout_config;