]>
Commit | Line | Data |
---|---|---|
8822ebee | 1 | /* |
b8ae064d | 2 | * Copyright (C) 1996-2023 The Squid Software Foundation and contributors |
8822ebee | 3 | * |
bbc27441 AJ |
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. | |
8822ebee AR |
7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 16 Cache Manager API */ |
10 | ||
ff9d9458 FC |
11 | #ifndef SQUID_SRC_MGR_FUNACTION_H |
12 | #define SQUID_SRC_MGR_FUNACTION_H | |
8822ebee AR |
13 | |
14 | #include "mgr/Action.h" | |
15 | #include "mgr/ActionCreator.h" | |
16 | ||
8822ebee AR |
17 | namespace Mgr |
18 | { | |
19 | ||
20 | /// function-based cache manager Action; a wrapper for so called legacy actions | |
21 | /// that do everything using a single OBJH function | |
22 | class FunAction: public Action | |
23 | { | |
24 | protected: | |
25 | FunAction(const CommandPointer &cmd, OBJH *aHandler); | |
26 | ||
27 | public: | |
28 | static Pointer Create(const CommandPointer &cmd, OBJH *aHandler); | |
29 | ||
30 | /* Action API */ | |
337b9aa4 | 31 | void respond(const Request& request) override; |
8822ebee | 32 | // we cannot aggregate because we do not even know what the handler does |
337b9aa4 | 33 | bool aggregatable() const override { return false; } |
8822ebee AR |
34 | |
35 | protected: | |
36 | /* Action API */ | |
337b9aa4 | 37 | void dump(StoreEntry *entry) override; |
8822ebee AR |
38 | |
39 | private: | |
40 | OBJH *handler; ///< legacy function that collects and dumps info | |
41 | }; | |
42 | ||
8822ebee AR |
43 | /// creates FunAction using ActionCreator API |
44 | class FunActionCreator: public ActionCreator | |
45 | { | |
46 | public: | |
47 | explicit FunActionCreator(OBJH *aHandler): handler(aHandler) {} | |
48 | ||
49 | /* ActionCreator API */ | |
337b9aa4 | 50 | Action::Pointer create(const CommandPointer &cmd) const override { |
8822ebee AR |
51 | return FunAction::Create(cmd, handler); |
52 | } | |
53 | ||
54 | private: | |
55 | OBJH *handler; ///< legacy function to pass to the FunAction wrapper | |
56 | }; | |
57 | ||
58 | } // namespace Mgr | |
59 | ||
ff9d9458 | 60 | #endif /* SQUID_SRC_MGR_FUNACTION_H */ |
f53969cc | 61 |