userver: samples/grpc_service/src/greeter_service.hpp
Loading...
Searching...
No Matches
samples/grpc_service/src/greeter_service.hpp
#pragma once
#include <string_view>
#include <samples/greeter_service.usrv.pb.hpp>
namespace samples {
class GreeterService final : public api::GreeterServiceBase {
public:
explicit GreeterService(std::string prefix);
SayHelloResult SayHello(CallContext& context, api::GreetingRequest&& request) override;
SayHelloResponseStreamResult SayHelloResponseStream(
CallContext& context,
api::GreetingRequest&& request,
SayHelloResponseStreamWriter& writer
) override;
SayHelloRequestStreamResult SayHelloRequestStream(CallContext& context, SayHelloRequestStreamReader& reader)
override;
SayHelloStreamsResult SayHelloStreams(CallContext& context, SayHelloStreamsReaderWriter& stream) override;
private:
const std::string prefix_;
};
class GreeterServiceComponent final : public ugrpc::server::ServiceComponentBase {
public:
static constexpr std::string_view kName = "greeter-service";
GreeterServiceComponent(const components::ComponentConfig& config, const components::ComponentContext& context);
static yaml_config::Schema GetStaticConfigSchema();
private:
GreeterService service_;
};
} // namespace samples