]> git.ipfire.org Git - thirdparty/squid.git/blob - src/CollapsedForwarding.h
Merged from trunk
[thirdparty/squid.git] / src / CollapsedForwarding.h
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 /* DEBUG: section 17 Request Forwarding */
10
11 #ifndef SQUID_COLLAPSED_FORWARDING_H
12 #define SQUID_COLLAPSED_FORWARDING_H
13
14 #include "ipc/forward.h"
15 #include "ipc/Queue.h"
16 #include "typedefs.h"
17
18 #include <memory>
19
20 class StoreEntry;
21
22 /// Sends and handles collapsed forwarding notifications.
23 class CollapsedForwarding
24 {
25 public:
26 /// open shared memory segment
27 static void Init();
28
29 /// notify other workers about changes in entry state (e.g., new data)
30 static void Broadcast(const StoreEntry &e);
31
32 /// kick worker with empty IPC queue
33 static void Notify(const int workerId);
34
35 /// handle new data messages in IPC queue
36 static void HandleNewData(const char *const when);
37
38 /// handle queue push notifications from worker or disker
39 static void HandleNotification(const Ipc::TypedMsgHdr &msg);
40
41 private:
42 typedef Ipc::MultiQueue Queue;
43 static std::auto_ptr<Queue> queue; ///< IPC queue
44 };
45
46 #endif /* SQUID_COLLAPSED_FORWARDING_H */
47