void DataAggregatorActor::handleInsertResponse(const ActorMessagePtr& msg) {
  DVLOG_FIRST_N(2, 20) << "receive store insert response of member " << msg->getSourceMemberId();
  idgs::store::pb::InsertResponse* response = dynamic_cast<idgs::store::pb::InsertResponse*>(msg->getPayload().get());

  // error
  if (response->result_code() != idgs::store::pb::SRC_SUCCESS) {
    resultCode = response->result_code();
    LOG(ERROR)<< "error in insert data to member " << msg->getSourceActorId() << " error code : " << resultCode;
  }

  // collect response from all members and calculate size and then response to client.
  ++ responseCount;
  DVLOG_FIRST_N(2, 20) << "member " << msg->getSourceMemberId() << " responsed, left " << requestCount - responseCount << " members.";
  if (requestCount == responseCount) {
    DVLOG_FIRST_N(2, 20) << "all member responsed, send response to client";
    shared_ptr<idgs::store::pb::InsertResponse> globalResponse = make_shared<idgs::store::pb::InsertResponse>();
    globalResponse->set_result_code(resultCode);
    sendResponse(OP_INSERT_RESPONSE, globalResponse);

    terminate();
  }
}
void DataAggregatorActor::handleDeleteResponse(const ActorMessagePtr& msg) {
  DVLOG_FIRST_N(2, 20) << "receive store remove response of member " << getActorId();
  auto response = dynamic_cast<idgs::store::pb::DeleteResponse*>(msg->getPayload().get());

  // error
  if (response->result_code() != idgs::store::pb::SRC_SUCCESS) {
    LOG(ERROR)<< "error in remove data to member " << msg->getSourceActorId();
    resultCode = response->result_code();
  }

  ++ responseCount;
  DVLOG_FIRST_N(2, 20) << "member " << msg->getSourceMemberId() << " response, left " << requestCount - responseCount << " members.";
  if (requestCount == responseCount) {
    DVLOG_FIRST_N(2, 20) << "all member response, send response to client.";

    auto globalResponse = make_shared<idgs::store::pb::DeleteResponse>();
    globalResponse->set_result_code(resultCode);
    sendResponse(OP_DELETE_RESPONSE, globalResponse);

    terminate();
  }
}