-
Notifications
You must be signed in to change notification settings - Fork 538
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?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -9,6 +9,7 @@ | |||||
/* DEBUG: section 16 Cache Manager API */ | ||||||
|
||||||
#include "squid.h" | ||||||
#include "base/PackableStream.h" | ||||||
#include "CacheManager.h" | ||||||
#include "comm/Connection.h" | ||||||
#include "HttpReply.h" | ||||||
|
@@ -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 | ||||||
|
||||||
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 commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
{ | ||||||
PackableStream os(*entry); | ||||||
report(os); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. Besides that, why not use an overload for supporting the transition?
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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. |
||||||
} |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -14,6 +14,8 @@ | |||||||||
#include "ipc/forward.h" | ||||||||||
#include "mgr/forward.h" | ||||||||||
|
||||||||||
#include <iosfwd> | ||||||||||
|
||||||||||
class StoreEntry; | ||||||||||
|
||||||||||
namespace Mgr | ||||||||||
|
@@ -76,11 +78,16 @@ 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 commentThe 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:
Suggested change
|
||||||||||
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 | ||||||||||
* | ||||||||||
* \deprecated implement report() instead | ||||||||||
*/ | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
virtual void dump(StoreEntry *) {} | ||||||||||
virtual void dump(StoreEntry *); | ||||||||||
|
||||||||||
private: | ||||||||||
const CommandPointer cmd; ///< the command that caused this action | ||||||||||
|
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.
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.