multi_request.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright [2021] JD.com, Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef __H_MULTI_REQUEST_H__
  17. #define __H_MULTI_REQUEST_H__
  18. #include "request/request_base_all.h"
  19. class JobHubAskChain;
  20. class DTCJobOperation;
  21. union DTCValue;
  22. class MultiRequest {
  23. private:
  24. JobHubAskChain *owner;
  25. DTCJobOperation *wait;
  26. DTCValue *keyList;
  27. unsigned char *keyMask;
  28. int doneReq;
  29. int totalReq;
  30. int subReq;
  31. int firstPass;
  32. int keyFields;
  33. int internal;
  34. public:
  35. friend class JobHubAskChain;
  36. MultiRequest(JobHubAskChain *o, DTCJobOperation *job);
  37. ~MultiRequest(void);
  38. int decode_key_list(void);
  39. int split_task(void);
  40. int total_count(void) const
  41. {
  42. return totalReq;
  43. }
  44. int remain_count(void) const
  45. {
  46. return totalReq - doneReq;
  47. }
  48. void second_pass(int err);
  49. void complete_task(DTCJobOperation *req, int index);
  50. public:
  51. DTCValue *get_key_value(int i);
  52. void set_key_completed(int i);
  53. int is_key_completed(int i);
  54. void complete_waiter(void);
  55. };
  56. class MultiTaskReply : public JobAnswerInterface<DTCJobOperation> {
  57. public:
  58. MultiTaskReply()
  59. {
  60. }
  61. virtual void job_answer_procedure(DTCJobOperation *job_operation);
  62. };
  63. #endif