Github   Telegram
Loading...
Searching...
No Matches
settings.hpp
1#pragma once
2
3#include <memory>
4#include <string>
5#include <vector>
6
7#include <userver/yaml_config/yaml_config.hpp>
8
9USERVER_NAMESPACE_BEGIN
10
11namespace error_injection {
12
13/// What error injection hook may decide to do
14enum class Verdict {
15 Error, ///< return error
16 Timeout, ///< wait for deadline and return error
17 MaxDelay, ///< wait for deadline w/o returning an error
18 RandomDelay, ///< wait for [0; deadline] w/o retunring an error
19
20 // Skip must be the last
21
22 Skip, ///< no error
23};
24
25struct Settings final {
26 bool enabled{false};
27 double probability{0};
28 std::vector<Verdict> possible_verdicts;
29};
30
31Settings Parse(const yaml_config::YamlConfig& value,
32 formats::parse::To<Settings>);
33
34} // namespace error_injection
35
36USERVER_NAMESPACE_END