[coap] encapsulate Request state and hide its Metadata - #12675
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly refactors the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request effectively encapsulates the CoapBase::Request state by making its internal members private and introducing getter/setter methods. The changes improve code structure and maintainability as intended. I found one critical issue in src/core/coap/coap.hpp where a method was renamed incorrectly, which will cause a compilation error. Other than that, the refactoring looks good.
This commit updates the `CoapBase::Request` class to encapsulate its internal state. The `mMessage` pointer and `mMetadata` struct are now private, and their properties are accessed and modified through explicit getter and setter methods (e.g., `GetMessage()`, `IsConfirmable()`, `MarkAsAcknowledged()`). By doing so, the code that manages pending requests no longer directly manipulates the internal metadata fields, improving code structure and maintainability.
2adef51 to
5ec45de
Compare
|
/gemini review |
Library files
|
There was a problem hiding this comment.
Code Review
This pull request refactors the CoapBase::Request class to improve encapsulation by making its internal state private. The direct access to mMessage and mMetadata is replaced by a set of getter and setter methods. This is a good improvement to the code structure and maintainability. The changes are consistent and correctly implemented across the codebase. The ProcessObserveSend method has also been logically moved to the PendingRequests class. The implementation looks solid and I have no specific comments.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12675 +/- ##
==========================================
- Coverage 74.58% 73.80% -0.78%
==========================================
Files 695 694 -1
Lines 95626 96562 +936
==========================================
- Hits 71318 71270 -48
- Misses 24308 25292 +984
🚀 New features to boost your workflow:
|
This commit updates the
CoapBase::Requestclass to encapsulate its internal state. ThemMessagepointer andmMetadatastruct are now private, and their properties are accessed and modified through explicit getter and setter methods (e.g.,GetMessage(),IsConfirmable(),MarkAsAcknowledged()).By doing so, the code that manages pending requests no longer directly manipulates the internal metadata fields, improving code structure and maintainability.