PragmaTwice commented on issue #2302:
URL: https://github.com/apache/kvrocks/issues/2302#issuecomment-2118688740

   > > Yeah, it looks a bit ugly. We can have a more intuitive design for this 
feature.
   > 
   > i feel confused about the more intuitive design is this close to that 
[292bdbe](https://github.com/apache/kvrocks/commit/292bdbe7d36f54ada89623006c1597cb74eed3ef)?
 otherwise its out of scope for me (at least for now, will have to wait for 
someone else's PR or if someone can guide me around the better approach).
   
   
https://github.com/apache/kvrocks/blob/292bdbe7d36f54ada89623006c1597cb74eed3ef/src/server/server.cc#L1330-L1346
   
   
   I hope you can notice that there is a lot of repetition in the code between 
if and else, we should avoid this [copy-and-paste 
programming](https://en.wikipedia.org/wiki/Copy-and-paste_programming). For me, 
preventing such code from entering kvrocks codebase is my top priority.
   
   In fact, we can see that the result returned by INFO is a format similar to 
   ```
   std::map<SectionNameTy, std::map<KeyTy, ValueTy>
   (where ValueTy = something like std::variant<int, std::string>)
   ```
   So we can return this format and transform it into JSON or TEXT at the end.


-- 
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]

Reply via email to