7#include <unordered_map>
17 virtual std::optional<std::string>
start_session() {
return std::nullopt; }
25 std::string endpoint_;
26 std::string session_endpoint_ =
"transfertune_session";
27 std::unordered_map<std::string, std::string> headers_;
30 void set_server(std::string server) { server_ = std::move(server); }
33 SimpleRpcContext(std::string server, std::string endpoint, std::unordered_map<std::string, std::string> headers = {})
34 : server_(std::move(server)), endpoint_(std::move(endpoint)), headers_(std::move(headers)) {}
38 std::unordered_map<std::string, std::string>
get_auth_headers()
const override {
return headers_; }
47 std::unordered_map<std::string, std::string>
headers;
60 std::shared_ptr<SimpleRpcContext>
build(
bool print =
true)
const;
Definition rpc_context.h:11
virtual ~RpcContext()=default
virtual std::unordered_map< std::string, std::string > get_auth_headers() const =0
virtual std::optional< std::string > start_session()
Definition rpc_context.h:17
virtual std::string get_remote_address() const =0
std::string get_remote_address() const override
Definition rpc_context.h:36
SimpleRpcContext(std::string server, std::string endpoint, std::unordered_map< std::string, std::string > headers={})
Definition rpc_context.h:33
void set_server(std::string server)
Definition rpc_context.h:30
std::optional< std::string > start_session() override
std::unordered_map< std::string, std::string > get_auth_headers() const override
Definition rpc_context.h:38
Definition daisytuner_rpc_context.h:10
std::shared_ptr< RpcContext > build_rpc_context_auto()
Definition rpc_context.h:73
std::shared_ptr< RpcContext > build_rpc_context_local()
Definition rpc_context.h:63
std::shared_ptr< RpcContext > build_rpc_context_from_file(std::filesystem::path config_file)
Definition rpc_context.h:68
Definition rpc_context.h:44
std::string endpoint
Definition rpc_context.h:46
std::string server
Definition rpc_context.h:45
SimpleRpcContextBuilder & from_file(std::filesystem::path config_file)
SimpleRpcContextBuilder & from_header_env(std::string env_var="RPC_HEADER")
SimpleRpcContextBuilder & from_env(std::string env_var="SDFG_RPC_CONFIG")
std::shared_ptr< SimpleRpcContext > build(bool print=true) const
std::unordered_map< std::string, std::string > headers
Definition rpc_context.h:47
SimpleRpcContextBuilder & add_header(std::string name, std::string value)
SimpleRpcContextBuilder()
Definition rpc_context.h:49
SimpleRpcContextBuilder & from_docc_config()
SimpleRpcContextBuilder & initialize_local_default()