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 {
12 public:
13 enum class ReadonlyMaster { kNotExpected, kExpected };
14
15 PostgresControl() = default;
16
17 PostgresControl(std::chrono::milliseconds execute_timeout,
18 std::chrono::milliseconds statement_timeout,
19 ReadonlyMaster readonly_master);
20
21 [[nodiscard]] engine::Deadline MakeExecuteDeadline(
22 std::chrono::milliseconds duration) const;
23
24 [[nodiscard]] std::chrono::milliseconds MakeStatementTimeout(
25 std::chrono::milliseconds duration) const;
26
27 bool IsReadonlyMasterExpected() const;
28
29 private:
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