Interface AlignmentContext


@Private @Evolving public interface AlignmentContext
This interface intends to align the state between client and server via RPC communication. This should be implemented separately on the client side and server side and can be used to pass state information on RPC responses from server to client.
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the last seen state id of the alignment context instance.
    boolean
    isCoordinatedCall(String protocolName, String method)
    Return true if this method call does need to be synced, false otherwise. sync meaning server state needs to have caught up with client state.
    long
    receiveRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto header, long threshold)
    This is the intended server method call to implement to receive client state info during RPC response header processing.
    void
    receiveResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto header)
    This is the intended client method call to implement to receive state info during RPC response processing.
    void
    updateRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto.Builder header)
    This is the intended client method call to pull last seen state info into RPC request processing.
    void
    updateResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder header)
    This is the intended server method call to implement to pass state info during RPC response header construction.
  • Method Details

    • updateResponseState

      void updateResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto.Builder header)
      This is the intended server method call to implement to pass state info during RPC response header construction.
      Parameters:
      header - The RPC response header builder.
    • receiveResponseState

      void receiveResponseState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcResponseHeaderProto header)
      This is the intended client method call to implement to receive state info during RPC response processing.
      Parameters:
      header - The RPC response header.
    • updateRequestState

      void updateRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto.Builder header)
      This is the intended client method call to pull last seen state info into RPC request processing.
      Parameters:
      header - The RPC request header builder.
    • receiveRequestState

      long receiveRequestState(org.apache.hadoop.ipc.protobuf.RpcHeaderProtos.RpcRequestHeaderProto header, long threshold) throws IOException
      This is the intended server method call to implement to receive client state info during RPC response header processing.
      Parameters:
      header - The RPC request header.
      threshold - a parameter to verify a condition when server should reject client request due to its state being too far misaligned with the client state. See implementation for more details.
      Returns:
      state id required for the server to execute the call.
      Throws:
      IOException - raised on errors performing I/O.
    • getLastSeenStateId

      long getLastSeenStateId()
      Returns the last seen state id of the alignment context instance.
      Returns:
      the value of the last seen state id.
    • isCoordinatedCall

      boolean isCoordinatedCall(String protocolName, String method)
      Return true if this method call does need to be synced, false otherwise. sync meaning server state needs to have caught up with client state.
      Parameters:
      protocolName - the name of the protocol
      method - the method call to check
      Returns:
      true if this method is async, false otherwise.