Class ClientGSIContext

java.lang.Object
org.apache.hadoop.hdfs.ClientGSIContext
All Implemented Interfaces:
org.apache.hadoop.ipc.AlignmentContext

@Private @Evolving public class ClientGSIContext extends Object implements org.apache.hadoop.ipc.AlignmentContext
Global State Id context for the client.

This is the client side implementation responsible for receiving state alignment info from server(s).

  • Constructor Summary

    Constructors
    Constructor
    Description
     
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
     
    org.apache.hadoop.thirdparty.protobuf.ByteString
     
    static Map<String,Long>
    getRouterFederatedStateMap(org.apache.hadoop.thirdparty.protobuf.ByteString byteString)
    Utility function to parse routerFederatedState field in RPC headers.
    boolean
    isCoordinatedCall(String protocolName, String method)
     
    static org.apache.hadoop.thirdparty.protobuf.ByteString
    mergeRouterFederatedState(org.apache.hadoop.thirdparty.protobuf.ByteString state1, org.apache.hadoop.thirdparty.protobuf.ByteString state2)
    Merge state1 and state2 to get the max value for each namespace.
    long
    receiveRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto header, long threshold)
    Client side implementation only provides state alignment info in requests.
    void
    receiveResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto header)
    Client side implementation for receiving state alignment info in responses.
    void
    updateRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto.Builder header)
    Client side implementation for providing state alignment info in requests.
    void
    updateResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder header)
    Client side implementation only receives state alignment info.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ClientGSIContext

      public ClientGSIContext()
    • ClientGSIContext

      public ClientGSIContext(LongAccumulator lastSeenStateId)
  • Method Details

    • getLastSeenStateId

      public long getLastSeenStateId()
      Specified by:
      getLastSeenStateId in interface org.apache.hadoop.ipc.AlignmentContext
    • isCoordinatedCall

      public boolean isCoordinatedCall(String protocolName, String method)
      Specified by:
      isCoordinatedCall in interface org.apache.hadoop.ipc.AlignmentContext
    • updateResponseState

      public void updateResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder header)
      Client side implementation only receives state alignment info. It does not provide state alignment info therefore this does nothing.
      Specified by:
      updateResponseState in interface org.apache.hadoop.ipc.AlignmentContext
    • receiveResponseState

      public void receiveResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto header)
      Client side implementation for receiving state alignment info in responses.
      Specified by:
      receiveResponseState in interface org.apache.hadoop.ipc.AlignmentContext
    • getRouterFederatedStateMap

      public static Map<String,Long> getRouterFederatedStateMap(org.apache.hadoop.thirdparty.protobuf.ByteString byteString)
      Utility function to parse routerFederatedState field in RPC headers.
    • mergeRouterFederatedState

      public static org.apache.hadoop.thirdparty.protobuf.ByteString mergeRouterFederatedState(org.apache.hadoop.thirdparty.protobuf.ByteString state1, org.apache.hadoop.thirdparty.protobuf.ByteString state2)
      Merge state1 and state2 to get the max value for each namespace.
      Parameters:
      state1 - input ByteString.
      state2 - input ByteString.
      Returns:
      one ByteString object which contains the max value of each namespace.
    • updateRequestState

      public void updateRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto.Builder header)
      Client side implementation for providing state alignment info in requests.
      Specified by:
      updateRequestState in interface org.apache.hadoop.ipc.AlignmentContext
    • receiveRequestState

      public long receiveRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto header, long threshold) throws IOException
      Client side implementation only provides state alignment info in requests. Client does not receive RPC requests therefore this does nothing.
      Specified by:
      receiveRequestState in interface org.apache.hadoop.ipc.AlignmentContext
      Throws:
      IOException
    • getRouterFederatedState

      @VisibleForTesting public org.apache.hadoop.thirdparty.protobuf.ByteString getRouterFederatedState()