-
Notifications
You must be signed in to change notification settings - Fork 516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintenance: add ostream report API to Mgr::Action #1806
base: master
Are you sure you want to change the base?
Conversation
This new API method allows new or updated cache manager reports to write their output to a stream without having to import any StoreEntry related API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR duplicates the primary problem of still-open PR #1560. We have already spent a lot of time on that problem. IMHO, it is unethical to repost these changes like that, without any cross references and warnings.
Really? AFIAK this is the only part of that PR which has not been complained about. With this vetoed you are now essentially blocking conversion of cachemgr to using ostream for report generation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR duplicates the primary problem of still-open PR #1560.
AFIAK this is the only part of that PR which has not been complained about.
The two change requests in the latest #1560 (review) (dated November 10, 2023) are clearly attached to code duplicated in this PR. There are no other open change requests. This PR contains the primary part of PR 1560 that is currently1 blocking that PR.
With this vetoed you are now essentially blocking conversion of cachemgr to using ostream for report generation.
I am not. I am blocking one problematic conversion. There are ways to determine the right conversion goal (which could be std::ostream or some custom class) and make progress in this area, but this duplicated PR is not the right place to discuss any of that.
Footnotes
-
Some other problematic parts may have been fixed earlier or may be discovered in the future, of course. I am only describing the current state. ↩
Apparently marking an unwanted API as deprecated is enough to seriously break Squid somehow.
Surely you jest. Words on a code comment are not sufficient technical reason to veto maintenance updates. I have removed the comment entirely to avoid further conflict. If you have an actual technical reason to block, please state clearly what that is. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alex: This PR contains the primary part of PR 1560 that is currently blocking that PR.
Amos: Surely you jest. Words on a code comment are not sufficient technical reason to veto maintenance updates.
My text stated a fact. It was not a joke. I do not block PRs in jest.
Words in a code comment may be important enough to block a PR, especially words containing deprecation notices (and TODO plans), as was the case in PR 1560.
Our definitions of "maintenance update" probably differ, but that difference is probably not important right now. After this PR code changes finalize, I may request the removal of controversial "Maintenance" prefix from this PR title. Please consider removing it now to save time.
@@ -76,11 +78,14 @@ class Action: public RefCountable | |||
/// calculate and keep local action-specific information | |||
virtual void collect() {} | |||
|
|||
/// write manager report output to a stream. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The proposed description does not differentiate this new method enough from the existing dump() method. AFAICT, the new method is not usable for actions that cannot write the entire report immediately (i.e. for non-atomic() actions). Those actions should continue to use the dump() method. We should clarify that.
Also, there is not enough value in converting existing dump() code to report() unless that conversion also establishes YAML compliance. Thus, we should make this new method specific to YAML reports.
For example:
/// write manager report output to a stream. | |
/// Write the entire YAML-compliant report to the given stream. | |
/// Actions that cannot produce YAML reports and non-atomic() | |
/// actions need to override dump() method instead. |
@@ -112,11 +113,17 @@ Mgr::Action::fillEntry(StoreEntry* entry, bool writeHttpHeader) | |||
entry->replaceHttpReply(rep); | |||
} | |||
|
|||
dump(entry); | |||
dump(entry); // TODO: replace with report() when all children are converted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed the comment entirely
You have not removed this TODO comment (that was one of the two detailed reasons for blocking PR 1560). The other changes in this PR do not address the corresponding PR 1560 concerns.
dump(entry); // TODO: replace with report() when all children are converted | |
dump(entry); |
Mgr::Action::dump(StoreEntry *entry) | ||
{ | ||
PackableStream os(*entry); | ||
report(os); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should decide whether std::ostream is the best type for future Actions. Ongoing YAML conversion efforts suggest that it might not be. Hopefully, we will know the answer after the spaces() issue is resolved. I will come back to this concern at that time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides that, why not use an overload for supporting the transition?
report() is a better name, and I'd support for it but we can do it with a different strategy:
- decide what the API will look like
- overload dump()
- progressively convert and possibly rename (or keep dump to avoid purely cosmetic changes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe C++ term "overload" is not applicable here, but the rest of your description matches my expectations of the anticipated transition. None of my blocking change requests contradict that natural transition strategy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you did mean that the new method should reuse the old dump() method name (i.e. that we should overload the old method), then I am currently against that particular aspect of the transition sketch because report() is a better name, because more visual clues identifying transitioned callers may be helpful, and because overload adds complexity.
@@ -76,11 +78,14 @@ class Action: public RefCountable | |||
/// calculate and keep local action-specific information | |||
virtual void collect() {} | |||
|
|||
/// write manager report output to a stream. | |||
virtual void report(std::ostream &) {} | |||
|
|||
/** start writing action-specific info to Store entry; | |||
* may collect info during dump, especially if collect() did nothing | |||
* non-atomic() actions may continue writing asynchronously after returning | |||
*/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*/ | |
* Use report() to produce atomic() YAML-compliant reports. | |
*/ |
|
||
entry->flush(); | ||
|
||
if (atomic()) | ||
entry->complete(); | ||
} | ||
|
||
void | ||
Mgr::Action::dump(StoreEntry *entry) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mgr::Action::dump(StoreEntry *entry) | |
Mgr::Action::dump(StoreEntry * const entry) |
This new API method allows new or updated cache manager reports
to write their output to a stream without having to import any
StoreEntry related API.