-
Notifications
You must be signed in to change notification settings - Fork 570
Maintenance: move async and events code to libasync #1635
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
base: master
Are you sure you want to change the base?
Conversation
async/forward.h needs to include base/forward.h to avoid duplicating the declaration of RefCount
Note: I have intentionally avoided creating Async namespace, this PR touches so much code already. |
FWIW, I do not think creating Async namespace is a good idea (in any PR). |
And yet it was you who decided all these objects should consume the IMO the However, @kinkie please do not merge the |
@kinkie, also be aware the |
Sure, but could you highlight why? It would be a deviation from standard practice, isn't it? |
This reverts commit c7a705e.
@@ -8,4 +8,3 @@ | |||
|
|||
#include "squid.h" | |||
#include "AsyncEngine.h" | |||
|
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.
File should no longer be touched.
@@ -27,7 +28,6 @@ | |||
#include "comm/Loops.h" | |||
#include "CommCalls.h" | |||
#include "errorpage.h" | |||
#include "event.h" |
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 event.h
and corresponding event.cc
code is all part of the EventLoop
mechanism. Not part of AsyncJob
code, even though the two are similar and interact.
|
||
if ENABLE_AUTH | ||
SUBDIRS += auth | ||
AUTH_LIBS= auth/libauth.la | ||
AUTH_ACL_LIBS= auth/libacls.la | ||
endif | ||
|
||
SUBDIRS += http ip icmp ident log ipc mgr | ||
SUBDIRS += http ip icmp ident log ipc mgr |
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.
typo
SUBDIRS += http ip icmp ident log ipc mgr | |
SUBDIRS += http ip icmp ident log ipc mgr |
class CallDialer; | ||
class DelayedAsyncCalls; | ||
|
||
template <class Answer> class AsyncCallback; |
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.
template <class Answer> class AsyncCallback; | |
template<class Answer> class AsyncCallback; |
template<class Job> class JobWait; | ||
|
||
template<class Cbc> class CbcPointer; | ||
typedef CbcPointer<AsyncJob> AsyncJobPointer; |
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.
typedef CbcPointer<AsyncJob> AsyncJobPointer; | |
using AsyncJobPointer = CbcPointer<AsyncJob>; |
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: FWIW, I do not think creating Async namespace is a good idea (in any PR).
Francesco: Sure, but could you highlight why?
I am not convinced that every Squid class must be in a namespace1. If some Squid classes should not be in a namespace, then it is reasonable to question whether, say, AsyncCall should be. To me, AsyncCall feels similar to SBuf -- both do not really need a dedicated namespace1 AFAICT.
I failed to find an applicable industry guideline regarding the use of namespaces in similar contexts.
The value of numerous users using "Async::Call" (instead of existing "AsyncCall") just so that AsyncCall implementation can simply say "Call" is rather questionable.
If all deferred calls (whatever we decide that or a similar term means) should migrate to (the variation of) AsyncCall API, then we may even decide to drop "Async" itself. One large change is better than two (with the same end result) in this case.
I will change my position if somebody proves that we should change 800+ lines of code to migrate AsyncCall and AsyncJob to Async namespace, but I believe that change proposal must come first, before I am forced to spend even more time on discussing a change that has not been really proposed yet.
Francesco: It would be a deviation from standard practice, isn't it?
You will need to define "standard practice" for me to be able to answer that question. I can interpret that term many different ways. Needless to say, Squid does not use namespaces for some code grouped inside src directories, and I am not aware of any requirement to use a namespace for all src directories code. Each directory or group of related names deserves a dedicated decision IMO.
Amos: And yet it was you who decided all these objects should consume the
Async
prefix (a.k.a. namespace).
I have been begging to stop posting reviews of people and yet here we go again.
- Squid classes used "Async prefix" before "all these objects" were introduced
- a class name prefix is not the same as a C++ namespace
- not "all these objects" consume the "Async prefix"
Amos: You have a better alternative to rename them as?
I am not convinced they should be renamed at this time.
Amos: IMO the
AsyncJob
and related pieces are sufficiently complex and self-contained to deserve their own library+namespace like this.
FWIW, I am (still) OK with grouping AsyncCall-related code in a dedicated directory and convenience library. The devil is in the details (e.g., what code to move, what directory name to use, whether to introduce a new namespace, whether to rename anything, etc.). For example, we can move without introducing a new namespace. I believe those details are being hammered out elsewhere, and this PR should continue to wait for the conclusion of those discussions.
Amos: the
EventLoop
mechanism ... should have a separate library of its own.
FWIW, there is currently no consensus on whether EventLoop deserves a library of its own.
Move Async and Events related code
to own library in src/async