Squid Web Cache master
Loading...
Searching...
No Matches
Action.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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_SRC_MGR_ACTION_H
12#define SQUID_SRC_MGR_ACTION_H
13
14#include "ipc/forward.h"
15#include "mgr/ActionFeatures.h"
16#include "mgr/forward.h"
17
18class StoreEntry;
19
20namespace Mgr
21{
22
25class Action: public RefCountable
26{
27public:
29
30public:
31 Action(const CommandPointer &aCmd);
32 ~Action() override;
33
34 /* for local Cache Manager use */
35
37 void run(StoreEntry *entry, bool writeHttpHeader);
38
40 void fillEntry(StoreEntry *entry, bool writeHttpHeader);
41
42 /* for global Coordinator use */
43
45 virtual void add(const Action &action);
46
47 /* global-local communication */
48
50 virtual void respond(const Request &request);
51
53 virtual void pack(Ipc::TypedMsgHdr &) const {}
54
56 virtual void unpack(const Ipc::TypedMsgHdr &) {}
57
60
61 /* Action properties */
62
65 virtual bool aggregatable() const { return true; } // most kid classes are
66
68 virtual Format format() const;
69
70 bool atomic() const;
71 const char *name() const;
72 const Command &command() const;
73
75
77 const char *contentType() const;
78
79protected:
81 virtual void collect() {}
82
87 virtual void dump(StoreEntry *) {}
88
89private:
91
92private:
93 Action(const Action &); // not implemented
94 Action &operator= (const Action &); // not implemented
95};
96
100
104
105} // namespace Mgr
106
107#endif /* SQUID_SRC_MGR_ACTION_H */
108
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition Lock.h:66
struct msghdr with a known type, fixed-size I/O and control buffers
Definition TypedMsgHdr.h:35
virtual void dump(StoreEntry *)
Definition Action.h:87
virtual bool aggregatable() const
Definition Action.h:65
virtual Format format() const
action report syntax
Definition Action.cc:50
void fillEntry(StoreEntry *entry, bool writeHttpHeader)
prepare store entry, dump info, close store entry (if possible)
Definition Action.cc:119
RefCount< Action > Pointer
Definition Action.h:28
Action(const Action &)
const Command & command() const
the cause of this action
Definition Action.cc:37
void sendResponse(Ipc::RequestId)
notify Coordinator that this action is done with local processing
Definition Action.cc:102
virtual void respond(const Request &request)
respond to Coordinator request; default is to collect and sendResponse
Definition Action.cc:88
StoreEntry * createStoreEntry() const
creates store entry from params
Definition Action.cc:75
virtual void collect()
calculate and keep local action-specific information
Definition Action.h:81
bool atomic() const
dump() call writes everything before returning
Definition Action.cc:44
~Action() override
Definition Action.cc:32
const char * contentType() const
HTTP Content-Type header value for this Action report.
Definition Action.cc:62
Action & operator=(const Action &)
virtual void unpack(const Ipc::TypedMsgHdr &)
unpack action info from the message received by Coordinator
Definition Action.h:56
const char * name() const
label as seen in the cache manager menu
Definition Action.cc:56
const CommandPointer cmd
the command that caused this action
Definition Action.h:90
virtual void add(const Action &action)
incrementally merge in remote information (of the same action type)
Definition Action.cc:83
virtual void pack(Ipc::TypedMsgHdr &) const
pack collected action info into a message to be sent to Coordinator
Definition Action.h:53
void run(StoreEntry *entry, bool writeHttpHeader)
collect + fillEntry: collect local information and fill the store entry
Definition Action.cc:111
combined hard-coded action profile with user-supplied action parameters
Definition Command.h:22
cache manager request
Definition Request.h:24
Cache Manager API.
Definition Action.h:21
void OpenKidSection(StoreEntry *, Format)
Definition Action.cc:144
void CloseKidSection(StoreEntry *, Format)
Definition Action.cc:156