Class RouterStateIdContext
java.lang.Object
org.apache.hadoop.hdfs.server.federation.router.RouterStateIdContext
- All Implemented Interfaces:
org.apache.hadoop.ipc.AlignmentContext
@Private
@Evolving
public class RouterStateIdContext
extends Object
implements org.apache.hadoop.ipc.AlignmentContext
This is the router implementation to hold the state Ids for all
namespaces. This object is only updated by responses from NameNodes.
-
Method Summary
Modifier and TypeMethodDescriptionstatic longlonggetNamespaceStateId(String nsId) getRouterFederatedStateMap(org.apache.hadoop.thirdparty.protobuf.ByteString byteString) Utility function to parse routerFederatedState field in RPC headers.booleanisCoordinatedCall(String protocolName, String methodName) longreceiveRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto header, long clientWaitTime) Routers do not update their state using information from clients to avoid clients interfering with one another.voidreceiveResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto header) voidremoveNamespaceStateId(String nsId) voidsetResponseHeaderState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder headerBuilder) Adds thenamespaceIdMapto the response header that will be sent to a client.voidupdateRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto.Builder header) voidupdateResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder header)
-
Method Details
-
setResponseHeaderState
public void setResponseHeaderState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder headerBuilder) Adds thenamespaceIdMapto the response header that will be sent to a client.- Parameters:
headerBuilder- the response header that will be sent to a client.
-
getNamespaceStateId
-
getNamespaces
-
getNamespaceIdMap
-
removeNamespaceStateId
-
getRouterFederatedStateMap
public static Map<String,Long> getRouterFederatedStateMap(org.apache.hadoop.thirdparty.protobuf.ByteString byteString) Utility function to parse routerFederatedState field in RPC headers.- Parameters:
byteString- the byte string of routerFederatedState.- Returns:
- the router federated state map.
-
getClientStateIdFromCurrentCall
-
updateResponseState
public void updateResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder header) - Specified by:
updateResponseStatein interfaceorg.apache.hadoop.ipc.AlignmentContext
-
receiveResponseState
public void receiveResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto header) - Specified by:
receiveResponseStatein interfaceorg.apache.hadoop.ipc.AlignmentContext
-
updateRequestState
public void updateRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto.Builder header) - Specified by:
updateRequestStatein interfaceorg.apache.hadoop.ipc.AlignmentContext
-
receiveRequestState
public long receiveRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto header, long clientWaitTime) throws org.apache.hadoop.ipc.RetriableException Routers do not update their state using information from clients to avoid clients interfering with one another.- Specified by:
receiveRequestStatein interfaceorg.apache.hadoop.ipc.AlignmentContext- Throws:
org.apache.hadoop.ipc.RetriableException
-
getLastSeenStateId
public long getLastSeenStateId()- Specified by:
getLastSeenStateIdin interfaceorg.apache.hadoop.ipc.AlignmentContext
-
isCoordinatedCall
- Specified by:
isCoordinatedCallin interfaceorg.apache.hadoop.ipc.AlignmentContext
-