zqr10159 opened a new pull request, #3873:
URL: https://github.com/apache/hertzbeat/pull/3873

   This pull request refactors the collector dispatch codebase to replace usage 
of the old `ClusterMsg.Message` class with the newer `ClusterMessage` class 
throughout both production and test code. This update affects message 
construction, processor interfaces, and serialization/deserialization logic, 
ensuring consistency and simplifying message handling. The changes also update 
related unit tests to use the new class.
   
   **Core Refactoring: Message Class Replacement**
   - Replaced all instances of `ClusterMsg.Message` with `ClusterMessage` in 
collector dispatch logic, including message creation, processor interfaces, and 
method signatures in `CollectServer`, `CollectJobService`, and all processor 
classes. 
(`[[1]](diffhunk://#diff-beee0e12b64261803ba5c72a78257f0f2e76cce1d3f21dfb6848f72ace0f5968L36-R35)`,
 
`[[2]](diffhunk://#diff-2c52b64fdc32be6c413d018516f9d0c86185774770777f4df619b8325fb52037L120-R122)`,
 
`[[3]](diffhunk://#diff-2c52b64fdc32be6c413d018516f9d0c86185774770777f4df619b8325fb52037L156-R170)`,
 
`[[4]](diffhunk://#diff-f09af788e0a3d951b3e99d18c18039244b61a800702e8245845144cd3bca402bL40-R41)`,
 
`[[5]](diffhunk://#diff-43aecd12cecf3bc410bf511bac2b0e294230a0a1eab0c52dd10393eeb580d6f0L38-R39)`,
 
`[[6]](diffhunk://#diff-002098cd55984abc51318d5fbc8e25f6ac4afa0b16c47e2d241f7b48780a6086L42-R44)`,
 
`[[7]](diffhunk://#diff-d89801c547c992e74dec0c387e721bdd2868b6b74f4f3b9ec75b1a109aa93eacL44-R49)`)
   
   **Message Serialization and Deserialization Updates**
   - Updated message serialization to use direct byte arrays (`msg`) instead of 
`ByteString`, and deserialization to use the new methods compatible with 
`ClusterMessage`. 
(`[[1]](diffhunk://#diff-beee0e12b64261803ba5c72a78257f0f2e76cce1d3f21dfb6848f72ace0f5968L146-R148)`,
 
`[[2]](diffhunk://#diff-beee0e12b64261803ba5c72a78257f0f2e76cce1d3f21dfb6848f72ace0f5968L166-R168)`,
 
`[[3]](diffhunk://#diff-2c52b64fdc32be6c413d018516f9d0c86185774770777f4df619b8325fb52037L120-R122)`,
 
`[[4]](diffhunk://#diff-2c52b64fdc32be6c413d018516f9d0c86185774770777f4df619b8325fb52037L156-R170)`,
 
`[[5]](diffhunk://#diff-002098cd55984abc51318d5fbc8e25f6ac4afa0b16c47e2d241f7b48780a6086L42-R44)`,
 
`[[6]](diffhunk://#diff-d89801c547c992e74dec0c387e721bdd2868b6b74f4f3b9ec75b1a109aa93eacL44-R49)`)
   
   **Processor Interface Changes**
   - Changed processor method signatures to accept and return `ClusterMessage` 
instead of `ClusterMsg.Message`, updating all relevant processors 
(`CollectCyclicDataProcessor`, `CollectOneTimeDataProcessor`, 
`DeleteCyclicTaskProcessor`, `GoCloseProcessor`). 
(`[[1]](diffhunk://#diff-f09af788e0a3d951b3e99d18c18039244b61a800702e8245845144cd3bca402bL40-R41)`,
 
`[[2]](diffhunk://#diff-43aecd12cecf3bc410bf511bac2b0e294230a0a1eab0c52dd10393eeb580d6f0L38-R39)`,
 
`[[3]](diffhunk://#diff-002098cd55984abc51318d5fbc8e25f6ac4afa0b16c47e2d241f7b48780a6086L42-R44)`,
 
`[[4]](diffhunk://#diff-d89801c547c992e74dec0c387e721bdd2868b6b74f4f3b9ec75b1a109aa93eacL44-R49)`)
   
   **Test Code Updates**
   - Updated all relevant test classes and mocks to use `ClusterMessage` 
instead of `ClusterMsg.Message`, ensuring tests reflect the new message type. 
(`[[1]](diffhunk://#diff-fc647519943a0d6c62c0553a51018e4e482ff5ad9da94852a638b53ab0e0350eL32-R32)`,
 
`[[2]](diffhunk://#diff-fc647519943a0d6c62c0553a51018e4e482ff5ad9da94852a638b53ab0e0350eL116-R116)`,
 
`[[3]](diffhunk://#diff-fc647519943a0d6c62c0553a51018e4e482ff5ad9da94852a638b53ab0e0350eL138-R138)`,
 
`[[4]](diffhunk://#diff-9eb2e7b31ebf4806c5c930e1b3a220c2d521a939319ad808afd520957817f9d5L37-R37)`,
 
`[[5]](diffhunk://#diff-9eb2e7b31ebf4806c5c930e1b3a220c2d521a939319ad808afd520957817f9d5L119-R119)`,
 
`[[6]](diffhunk://#diff-9eb2e7b31ebf4806c5c930e1b3a220c2d521a939319ad808afd520957817f9d5L140-R140)`)
   
   **Code Cleanup**
   - Removed unused imports related to `ByteString` and `ClusterMsg` in 
affected files. 
(`[[1]](diffhunk://#diff-beee0e12b64261803ba5c72a78257f0f2e76cce1d3f21dfb6848f72ace0f5968L21)`,
 
`[[2]](diffhunk://#diff-2c52b64fdc32be6c413d018516f9d0c86185774770777f4df619b8325fb52037L20-R27)`)
   
   This refactor improves maintainability and prepares the codebase for future 
enhancements around collector messaging.## What's changed?
   
   <!-- Describe Your PR Here -->
   
   
   ## Checklist
   
   - [ ]  I have read the [Contributing 
Guide](https://hertzbeat.apache.org/docs/community/code_style_and_quality_guide)
   - [ ]  I have written the necessary doc or comment.
   - [ ]  I have added the necessary unit tests and all cases have passed.
   
   ## Add or update API
   
   - [ ] I have added the necessary [e2e 
tests](https://github.com/apache/hertzbeat/tree/master/e2e) and all cases have 
passed.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to