]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/mgr/Inquirer.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / mgr / Inquirer.h
index c59530da80be217e27205e7e57008130d125db67..85e4a58822f6cf7849394df63bda8b734d73c384 100644 (file)
@@ -1,20 +1,19 @@
 /*
- * $Id$
- *
- * DEBUG: section 16    Cache Manager API
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
  *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
 
+/* DEBUG: section 16    Cache Manager API */
+
 #ifndef SQUID_MGR_INQUIRER_H
 #define SQUID_MGR_INQUIRER_H
 
-#include "base/AsyncJobCalls.h"
-#include "base/AsyncJob.h"
-#include "ipc/StrandCoords.h"
-#include "MemBuf.h"
+#include "comm/forward.h"
+#include "ipc/Inquirer.h"
 #include "mgr/Action.h"
-#include "mgr/Request.h"
-#include <map>
 
 class CommIoCbParams;
 class CommCloseCbParams;
@@ -24,64 +23,40 @@ namespace Mgr
 
 /// Coordinator's job that sends a cache manage request to each strand,
 /// aggregating individual strand responses and dumping the result if needed
-class Inquirer: public AsyncJob
+class Inquirer: public Ipc::Inquirer
 {
-public:
-    Inquirer(Action::Pointer anAction, int aFd, const Request &aCause,
-        const Ipc::StrandCoords &coords);
-    virtual ~Inquirer();
+    CBDATA_CLASS(Inquirer);
 
-    /// finds and calls the right Inquirer upon strand's response
-    static void HandleRemoteAck(const Mgr::Response& response);
+public:
+    Inquirer(Action::Pointer anAction, const Request &aCause,
+             const Ipc::StrandCoords &coords);
 
 protected:
     /* AsyncJob API */
     virtual void start();
-    virtual void swanSong();
     virtual bool doneAll() const;
-    virtual const char *status() const;
 
-private:
-    typedef UnaryMemFunT<Inquirer, Response, const Response&> HandleAckDialer;
+    /* Ipc::Inquirer API */
+    virtual void cleanup();
+    virtual void sendResponse();
+    virtual bool aggregate(Ipc::Response::Pointer aResponse);
 
-    void inquire();
+private:
     void noteWroteHeader(const CommIoCbParams& params);
     void noteCommClosed(const CommCloseCbParams& params);
-
-    void handleRemoteAck(const Response& response);
-
-    static AsyncCall::Pointer DequeueRequest(unsigned int requestId);
-
-    static void RequestTimedOut(void* param);
-    void requestTimedOut();
-    void removeTimeoutEvent();
-
-    void close();
     void removeCloseHandler();
-
+    Ipc::StrandCoords applyQueryParams(const Ipc::StrandCoords& aStrands,
+                                       const QueryParams& aParams);
 private:
     Action::Pointer aggrAction; //< action to aggregate
 
-    Request cause; ///< cache manager request received from HTTP client
-    int fd; ///< HTTP client socket descriptor
-
-    Ipc::StrandCoords strands; ///< all strands we want to query, in order
-    Ipc::StrandCoords::const_iterator pos; ///< strand we should query now
+    Comm::ConnectionPointer conn; ///< HTTP client socket descriptor
 
-    unsigned int requestId; ///< ID of our outstanding request to strand
     AsyncCall::Pointer writer; ///< comm_write callback
     AsyncCall::Pointer closer; ///< comm_close handler
-    const double timeout; ///< number of seconds to wait for strand response
-
-    /// maps requestId to Inquirer::handleRemoteAck callback
-    typedef std::map<unsigned int, AsyncCall::Pointer> RequestsMap;
-    static RequestsMap TheRequestsMap; ///< pending strand requests
-
-    static unsigned int LastRequestId; ///< last requestId used
-
-    CBDATA_CLASS2(Inquirer);
 };
 
 } // namespace Mgr
 
 #endif /* SQUID_MGR_INQUIRER_H */
+