| 80 | //////////////////////////////////////////////////////////////////////////////////// |
| 81 | |
| 82 | class BatchTask { |
| 83 | public: |
| 84 | BatchTask(int topic_id, Producer *producer) : topic_id_(topic_id), producer_(producer) {} |
| 85 | ~BatchTask() {} |
| 86 | |
| 87 | void Init(); |
| 88 | void AddTask(shared_ptr<Task> task); |
| 89 | bool Ready(uint64_t *ready_timestamp_ms = nullptr); |
| 90 | comm::RetCode Process(bool is_timeout = false); |
| 91 | |
| 92 | private: |
| 93 | int topic_id_; |
| 94 | Producer *producer_ = nullptr; |
| 95 | vector<shared_ptr<Task>> tasks_; |
| 96 | |
| 97 | uint32_t nbyte_ = 0; |
| 98 | uint32_t nitems_ = 0; |
| 99 | uint64_t start_timestamp_ms_ = 0; |
| 100 | |
| 101 | uint32_t items_byte_size_limit_ = 0; |
| 102 | uint32_t batch_limit_ = 0; |
| 103 | uint32_t producer_batch_delay_time_ms_ = 0; |
| 104 | }; |
| 105 | |
| 106 | |
| 107 | void BatchTask::Init() { |
nothing calls this directly
no outgoing calls
no test coverage detected