forked from envoyproxy/nighthawk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput_variable_setter_impl.h
43 lines (35 loc) · 1.5 KB
/
input_variable_setter_impl.h
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
#pragma once
#include "envoy/registry/registry.h"
#include "nighthawk/adaptive_load/input_variable_setter.h"
#include "api/adaptive_load/input_variable_setter_impl.pb.h"
namespace Nighthawk {
/**
* An InputVariableSetter that sets the |requests_per_second| field in the CommandLineOptions proto.
*/
class RequestsPerSecondInputVariableSetter : public InputVariableSetter {
public:
/**
* Constructs the class from an already valid config proto.
*
* @param config Valid plugin-specific config proto.
*/
RequestsPerSecondInputVariableSetter(
const nighthawk::adaptive_load::RequestsPerSecondInputVariableSetterConfig& config);
absl::Status SetInputVariable(nighthawk::client::CommandLineOptions& command_line_options,
double input_value) override;
};
/**
* A factory that creates an RequestsPerSecondInputVariableSetter from a
* RequestsPerSecondInputVariableSetterConfig proto.
*/
class RequestsPerSecondInputVariableSetterConfigFactory : public InputVariableSetterConfigFactory {
public:
std::string name() const override;
Envoy::ProtobufTypes::MessagePtr createEmptyConfigProto() override;
InputVariableSetterPtr
createInputVariableSetter(const Envoy::Protobuf::Message& message) override;
absl::Status ValidateConfig(const Envoy::Protobuf::Message& message) const override;
};
// This factory is activated through LoadInputVariableSetterPlugin in plugin_util.h.
DECLARE_FACTORY(RequestsPerSecondInputVariableSetterConfigFactory);
} // namespace Nighthawk