/*
- * $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 "comm/forward.h"
-#include "ipc/StrandCoords.h"
-#include "MemBuf.h"
+#include "ipc/Inquirer.h"
#include "mgr/Action.h"
-#include "mgr/Request.h"
-#include <map>
class CommIoCbParams;
class CommCloseCbParams;
/// 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
{
+ CBDATA_CLASS(Inquirer);
+
public:
- Inquirer(Action::Pointer anAction, const Comm::ConnectionPointer &conn, const Request &aCause,
+ Inquirer(Action::Pointer anAction, const Request &aCause,
const Ipc::StrandCoords &coords);
- virtual ~Inquirer();
-
- /// finds and calls the right Inquirer upon strand's response
- static void HandleRemoteAck(const Mgr::Response& response);
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
- Comm::ConnectionPointer clientConnection; ///< 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 */
+