userver: userver/testsuite/postgres_control.hpp Source File
Loading...
Searching...
No Matches
postgres_control.hpp
1#pragma once
2
3#include <chrono>
4
5#include <userver/engine/deadline.hpp>
6
7USERVER_NAMESPACE_BEGIN
8
9namespace testsuite {
10
11class PostgresControl {
12public:
13 enum class ReadonlyMaster { kNotExpected, kExpected };
14
15 PostgresControl() = default;
16
17 PostgresControl(
18 std::chrono::milliseconds execute_timeout,
19 std::chrono::milliseconds statement_timeout,
20 ReadonlyMaster readonly_master
21 );
22
23 [[nodiscard]] engine::Deadline MakeExecuteDeadline(std::chrono::milliseconds duration) const;
24
25 [[nodiscard]] std::chrono::milliseconds MakeStatementTimeout(std::chrono::milliseconds duration) const;
26
27 bool IsReadonlyMasterExpected() const;
28
29private:
30 std::chrono::milliseconds execute_timeout_{};
31 std::chrono::milliseconds statement_timeout_{};
32 bool is_readonly_master_expected_{false};
33};
34
35} // namespace testsuite
36
37USERVER_NAMESPACE_END