]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/FunAction.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / mgr / FunAction.h
1 /*
2 * $Id$
3 *
4 * DEBUG: section 16 Cache Manager API
5 *
6 */
7
8 #ifndef SQUID_MGR_FUN_ACTION_H
9 #define SQUID_MGR_FUN_ACTION_H
10
11 #include "mgr/Action.h"
12 #include "mgr/ActionCreator.h"
13
14
15 namespace Mgr
16 {
17
18 /// function-based cache manager Action; a wrapper for so called legacy actions
19 /// that do everything using a single OBJH function
20 class FunAction: public Action
21 {
22 protected:
23 FunAction(const CommandPointer &cmd, OBJH *aHandler);
24
25 public:
26 static Pointer Create(const CommandPointer &cmd, OBJH *aHandler);
27
28 /* Action API */
29 virtual void respond(const Request& request);
30 // we cannot aggregate because we do not even know what the handler does
31 virtual bool aggregatable() const { return false; }
32
33 protected:
34 /* Action API */
35 virtual void dump(StoreEntry *entry);
36
37 private:
38 OBJH *handler; ///< legacy function that collects and dumps info
39 };
40
41
42 /// creates FunAction using ActionCreator API
43 class FunActionCreator: public ActionCreator
44 {
45 public:
46 explicit FunActionCreator(OBJH *aHandler): handler(aHandler) {}
47
48 /* ActionCreator API */
49 virtual Action::Pointer create(const CommandPointer &cmd) const {
50 return FunAction::Create(cmd, handler);
51 }
52
53 private:
54 OBJH *handler; ///< legacy function to pass to the FunAction wrapper
55 };
56
57 } // namespace Mgr
58
59 #endif /* SQUID_MGR_FUN_ACTION_H */