Interface CallService


  • public interface CallService
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String NAME
      The name of CallService.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void CallExecuted​(java.math.BigInteger _reqId, int _code, java.lang.String _msg)
      Notifies that the call message has been executed.
      void CallMessage​(java.lang.String _from, java.lang.String _to, java.math.BigInteger _sn, java.math.BigInteger _reqId, byte[] _data)
      Notifies the user that a new call message has arrived.
      void CallMessageSent​(score.Address _from, java.lang.String _to, java.math.BigInteger _sn)
      Notifies that the requested call message has been sent.
      void executeCall​(java.math.BigInteger _reqId, byte[] _data)
      Executes the requested call message.
      void executeRollback​(java.math.BigInteger _sn)
      Rollbacks the caller state of the request '_sn'.
      void handleError​(java.math.BigInteger _sn)
      Handle the error on delivering the message.
      void handleMessage​(java.lang.String _from, byte[] _msg)
      Handles incoming Messages.
      void ResponseMessage​(java.math.BigInteger _sn, int _code)
      Notifies that a response message has arrived for the `_sn` if the request was a two-way message.
      void RollbackExecuted​(java.math.BigInteger _sn)
      Notifies that the rollback has been executed.
      void RollbackMessage​(java.math.BigInteger _sn)
      Notifies the user that a rollback operation is required for the request '_sn'.
      java.math.BigInteger sendCallMessage​(java.lang.String _to, byte[] _data, byte[] _rollback, java.lang.String[] _sources, java.lang.String[] _destinations)
      Sends a call message to the contract on the destination chain.
    • Method Detail

      • sendCallMessage

        java.math.BigInteger sendCallMessage​(java.lang.String _to,
                                             byte[] _data,
                                             byte[] _rollback,
                                             java.lang.String[] _sources,
                                             java.lang.String[] _destinations)
        Sends a call message to the contract on the destination chain.
        Parameters:
        _to - The BTP address of the callee on the destination chain
        _data - The calldata specific to the target contract
        _rollback - (Optional) The data for restoring the caller state when an error occurred
        Returns:
        The serial number of the request
      • handleMessage

        void handleMessage​(java.lang.String _from,
                           byte[] _msg)
        Handles incoming Messages.
        Parameters:
        _from - String ( Network id of source network )
        _msg - Bytes ( serialized bytes of CallMessage )
      • handleError

        void handleError​(java.math.BigInteger _sn)
        Handle the error on delivering the message.
        Parameters:
        _sn - Integer ( serial number of the original message )
      • CallMessageSent

        void CallMessageSent​(score.Address _from,
                             java.lang.String _to,
                             java.math.BigInteger _sn)
        Notifies that the requested call message has been sent.
        Parameters:
        _from - The chain-specific address of the caller
        _to - The BTP address of the callee on the destination chain
        _sn - The serial number of the request
      • ResponseMessage

        void ResponseMessage​(java.math.BigInteger _sn,
                             int _code)
        Notifies that a response message has arrived for the `_sn` if the request was a two-way message.
        Parameters:
        _sn - The serial number of the previous request
        _code - The response code (0: Success, -1: Unknown generic failure, >=1: User defined error code)
      • RollbackMessage

        void RollbackMessage​(java.math.BigInteger _sn)
        Notifies the user that a rollback operation is required for the request '_sn'.
        Parameters:
        _sn - The serial number of the previous request
      • executeRollback

        void executeRollback​(java.math.BigInteger _sn)
        Rollbacks the caller state of the request '_sn'.
        Parameters:
        _sn - The serial number of the previous request
      • RollbackExecuted

        void RollbackExecuted​(java.math.BigInteger _sn)
        Notifies that the rollback has been executed.
        Parameters:
        _sn - The serial number for the rollback
      • CallMessage

        void CallMessage​(java.lang.String _from,
                         java.lang.String _to,
                         java.math.BigInteger _sn,
                         java.math.BigInteger _reqId,
                         byte[] _data)
        Notifies the user that a new call message has arrived.
        Parameters:
        _from - The BTP address of the caller on the source chain
        _to - A string representation of the callee address
        _sn - The serial number of the request from the source
        _reqId - The request id of the destination chain
        _data - The calldata
      • executeCall

        void executeCall​(java.math.BigInteger _reqId,
                         byte[] _data)
        Executes the requested call message.
        Parameters:
        _reqId - The request id
      • CallExecuted

        void CallExecuted​(java.math.BigInteger _reqId,
                          int _code,
                          java.lang.String _msg)
        Notifies that the call message has been executed.
        Parameters:
        _reqId - The request id for the call message
        _code - The execution result code (0: Success, -1: Unknown generic failure, >=1: User defined error code)
        _msg - The result message if any