3 * Copyright 2018 gRPC authors.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
19 #ifndef GRPC_SRC_CPP_LOAD_REPORTING_SERVICE_SERVER_BUILDER_PLUGIN_H
20 #define GRPC_SRC_CPP_LOAD_REPORTING_SERVICE_SERVER_BUILDER_PLUGIN_H
22 #include <grpc/support/port_platform.h>
24 #include <grpcpp/impl/server_builder_plugin.h>
26 #include "src/cpp/server/load_reporter/load_reporter_async_service_impl.h"
29 namespace load_reporter {
31 // The plugin that registers and starts load reporting service when starting a
33 class LoadReportingServiceServerBuilderPlugin : public ServerBuilderPlugin {
35 ~LoadReportingServiceServerBuilderPlugin() override = default;
36 grpc::string name() override { return "load_reporting_service"; }
38 // Creates a load reporting service.
39 void UpdateServerBuilder(ServerBuilder* builder) override;
41 // Registers the load reporter service.
42 void InitServer(grpc_impl::ServerInitializer* si) override;
44 // Starts the load reporter service.
45 void Finish(grpc_impl::ServerInitializer* si) override;
47 void ChangeArguments(const grpc::string& name, void* value) override {}
48 void UpdateChannelArguments(grpc::ChannelArguments* args) override {}
49 bool has_sync_methods() const override;
50 bool has_async_methods() const override;
53 std::shared_ptr<LoadReporterAsyncServiceImpl> service_;
56 std::unique_ptr<grpc::ServerBuilderPlugin>
57 CreateLoadReportingServiceServerBuilderPlugin();
59 } // namespace load_reporter
62 #endif // GRPC_SRC_CPP_LOAD_REPORTING_SERVICE_SERVER_BUILDER_PLUGIN_H