16 #ifndef THIRD_PARTY_TENSORFLOW_SERVING_MODEL_SERVERS_SERVER_INIT_H_
17 #define THIRD_PARTY_TENSORFLOW_SERVING_MODEL_SERVERS_SERVER_INIT_H_
21 #include "google/protobuf/any.pb.h"
22 #include "tensorflow/core/lib/core/status.h"
23 #include "tensorflow_serving/apis/prediction_service.grpc.pb.h"
24 #include "tensorflow_serving/model_servers/http_rest_api_handler_base.h"
25 #include "tensorflow_serving/model_servers/prediction_service_util.h"
26 #include "tensorflow_serving/model_servers/server_core.h"
27 #include "tensorflow_serving/servables/tensorflow/session_bundle_config.pb.h"
29 namespace tensorflow {
33 using SetupPlatformConfigMapForTensorFlowFnType =
34 Status (*)(
const SessionBundleConfig&, PlatformConfigMap&);
35 using UpdatePlatformConfigMapForTensorFlowFnType =
36 Status (*)(PlatformConfigMap&);
37 using CreateHttpRestApiHandlerFnType =
38 std::unique_ptr<HttpRestApiHandlerBase> (*)(int, ServerCore*);
39 using CreatePredictionServiceFnType =
40 std::unique_ptr<PredictionService::Service> (*)(
41 const PredictionServiceOptions&);
43 Status SetupPlatformConfigMapForTensorFlowImpl(
const SessionBundleConfig&,
45 Status UpdatePlatformConfigMapForTensorFlowImpl(PlatformConfigMap&);
46 std::unique_ptr<HttpRestApiHandlerBase> CreateHttpRestApiHandlerImpl(
48 std::unique_ptr<PredictionService::Service> CreatePredictionServiceImpl(
49 const PredictionServiceOptions&);
65 absl::string_view type,
66 SetupPlatformConfigMapForTensorFlowFnType setup_platform_config_map_func,
67 UpdatePlatformConfigMapForTensorFlowFnType
68 update_platform_config_map_func,
69 CreateHttpRestApiHandlerFnType create_http_rest_api_handler_func,
70 CreatePredictionServiceFnType create_prediction_service_func);
72 bool IsRegistered()
const {
return !registration_type_.empty(); }
74 SetupPlatformConfigMapForTensorFlowFnType GetSetupPlatformConfigMap()
const {
75 return setup_platform_config_map_;
78 UpdatePlatformConfigMapForTensorFlowFnType GetUpdatePlatformConfigMap()
80 return update_platform_config_map_;
83 CreateHttpRestApiHandlerFnType GetCreateHttpRestApiHandler()
const {
84 return create_http_rest_api_handler_;
87 CreatePredictionServiceFnType GetCreatePredictionService()
const {
88 return create_prediction_service_;
93 Register(
"tensorflow", init::SetupPlatformConfigMapForTensorFlowImpl,
94 init::UpdatePlatformConfigMapForTensorFlowImpl,
95 init::CreateHttpRestApiHandlerImpl,
96 init::CreatePredictionServiceImpl);
100 std::string registration_type_ =
"";
104 SetupPlatformConfigMapForTensorFlowFnType setup_platform_config_map_;
107 UpdatePlatformConfigMapForTensorFlowFnType update_platform_config_map_;
110 CreateHttpRestApiHandlerFnType create_http_rest_api_handler_;
113 CreatePredictionServiceFnType create_prediction_service_;