package com.centzy.ourpc.logging;

import com.centzy.ourpc.service.MethodWireName;
import com.centzy.ourpc.service.ServiceWireName;
import com.google.protobuf.Message;

import java.util.Map;

/**
 * @author Peter Edge (peter@locality.com).
 */
public interface ServerRpcLogger {

  RpcStart logStart(
      ServiceWireName serviceWireName,
      MethodWireName methodWireName,
      Message request,
      Map<String, String> requestProperties,
      String clientId,
      String clientRpcId
  );

  long logResponseEnd(
      ServiceWireName serviceWireName,
      MethodWireName methodWireName,
      Message request,
      Map<String, String> requestProperties,
      Message response,
      Map<String, String> responseProperties,
      String clientId,
      String clientRpcId,
      String serverRpcId,
      Long serverStartUnixTimeUsec
  );

  long logErrorEnd(
      ServiceWireName serviceWireName,
      MethodWireName methodWireName,
      Message request,
      Map<String, String> requestProperties,
      Exception exception,
      Map<String, String> responseProperties,
      String clientId,
      String clientRpcId,
      String serverRpcId,
      Long serverStartUnixTimeUsec
  );
}
