]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/Inquirer.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / mgr / Inquirer.h
1 /*
2 * Copyright (C) 1996-2017 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 16 Cache Manager API */
10
11 #ifndef SQUID_MGR_INQUIRER_H
12 #define SQUID_MGR_INQUIRER_H
13
14 #include "comm/forward.h"
15 #include "ipc/Inquirer.h"
16 #include "mgr/Action.h"
17
18 class CommIoCbParams;
19 class CommCloseCbParams;
20
21 namespace Mgr
22 {
23
24 /// Coordinator's job that sends a cache manage request to each strand,
25 /// aggregating individual strand responses and dumping the result if needed
26 class Inquirer: public Ipc::Inquirer
27 {
28 CBDATA_CLASS(Inquirer);
29
30 public:
31 Inquirer(Action::Pointer anAction, const Request &aCause,
32 const Ipc::StrandCoords &coords);
33
34 protected:
35 /* AsyncJob API */
36 virtual void start();
37 virtual bool doneAll() const;
38
39 /* Ipc::Inquirer API */
40 virtual void cleanup();
41 virtual void sendResponse();
42 virtual bool aggregate(Ipc::Response::Pointer aResponse);
43
44 private:
45 void noteWroteHeader(const CommIoCbParams& params);
46 void noteCommClosed(const CommCloseCbParams& params);
47 void removeCloseHandler();
48 Ipc::StrandCoords applyQueryParams(const Ipc::StrandCoords& aStrands,
49 const QueryParams& aParams);
50 private:
51 Action::Pointer aggrAction; //< action to aggregate
52
53 Comm::ConnectionPointer conn; ///< HTTP client socket descriptor
54
55 AsyncCall::Pointer writer; ///< comm_write callback
56 AsyncCall::Pointer closer; ///< comm_close handler
57 };
58
59 } // namespace Mgr
60
61 #endif /* SQUID_MGR_INQUIRER_H */
62