2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 package org
.apache
.hadoop
.hbase
.master
;
21 import org
.apache
.hadoop
.hbase
.client
.VersionInfoUtil
;
22 import org
.apache
.yetus
.audience
.InterfaceAudience
;
24 import org
.apache
.hbase
.thirdparty
.com
.google
.protobuf
.RpcController
;
25 import org
.apache
.hbase
.thirdparty
.com
.google
.protobuf
.ServiceException
;
27 import org
.apache
.hadoop
.hbase
.shaded
.protobuf
.generated
.RegionServerStatusProtos
;
30 * A wrapper class for MasterRpcServices shortcut that ensures a client version is available
31 * to the callee without a current RPC call.
33 @InterfaceAudience.Private
34 public class MasterRpcServicesVersionWrapper
35 implements RegionServerStatusProtos
.RegionServerStatusService
.BlockingInterface
{
38 public interface ServiceCallFunction
<Req
, Resp
>
39 extends VersionInfoUtil
.ServiceCallFunction
<RpcController
, Req
, Resp
, ServiceException
> {
42 private final MasterRpcServices masterRpcServices
;
43 private final ServiceCallFunction
<RegionServerStatusProtos
.RegionServerStartupRequest
,
44 RegionServerStatusProtos
.RegionServerStartupResponse
> startupCall
;
45 private final ServiceCallFunction
<RegionServerStatusProtos
.RegionServerReportRequest
,
46 RegionServerStatusProtos
.RegionServerReportResponse
> reportCall
;
49 public MasterRpcServicesVersionWrapper(MasterRpcServices masterRpcServices
) {
50 this.masterRpcServices
= masterRpcServices
;
51 this.startupCall
= (c
, req
) -> masterRpcServices
.regionServerStartup(c
, req
);
52 this.reportCall
= (c
, req
) -> masterRpcServices
.regionServerReport(c
, req
);
56 public RegionServerStatusProtos
.RegionServerStartupResponse
regionServerStartup(
57 RpcController controller
, RegionServerStatusProtos
.RegionServerStartupRequest request
)
58 throws ServiceException
{
59 return VersionInfoUtil
.callWithVersion(startupCall
, controller
, request
);
63 public RegionServerStatusProtos
.RegionServerReportResponse
regionServerReport(
64 RpcController controller
, RegionServerStatusProtos
.RegionServerReportRequest request
)
65 throws ServiceException
{
66 return VersionInfoUtil
.callWithVersion(reportCall
, controller
, request
);
70 public RegionServerStatusProtos
.ReportRSFatalErrorResponse
reportRSFatalError(
71 RpcController controller
, RegionServerStatusProtos
.ReportRSFatalErrorRequest request
)
72 throws ServiceException
{
73 return masterRpcServices
.reportRSFatalError(controller
, request
);
77 public RegionServerStatusProtos
.GetLastFlushedSequenceIdResponse
getLastFlushedSequenceId(
78 RpcController controller
, RegionServerStatusProtos
.GetLastFlushedSequenceIdRequest request
)
79 throws ServiceException
{
80 return masterRpcServices
.getLastFlushedSequenceId(controller
, request
);
84 public RegionServerStatusProtos
.ReportRegionStateTransitionResponse
reportRegionStateTransition(
85 RpcController controller
,
86 RegionServerStatusProtos
.ReportRegionStateTransitionRequest request
)
87 throws ServiceException
{
88 return masterRpcServices
.reportRegionStateTransition(controller
, request
);
92 public RegionServerStatusProtos
.RegionSpaceUseReportResponse
reportRegionSpaceUse(
93 RpcController controller
, RegionServerStatusProtos
.RegionSpaceUseReportRequest request
)
94 throws ServiceException
{
95 return masterRpcServices
.reportRegionSpaceUse(controller
, request
);
99 public RegionServerStatusProtos
.ReportProcedureDoneResponse
reportProcedureDone(
100 RpcController controller
, RegionServerStatusProtos
.ReportProcedureDoneRequest request
)
101 throws ServiceException
{
102 return masterRpcServices
.reportProcedureDone(controller
, request
);
106 public RegionServerStatusProtos
.FileArchiveNotificationResponse
reportFileArchival(
107 RpcController controller
, RegionServerStatusProtos
.FileArchiveNotificationRequest request
)
108 throws ServiceException
{
109 return masterRpcServices
.reportFileArchival(controller
, request
);