Action.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 
18 class StoreEntry;
19 
20 namespace Mgr
21 {
22 
25 class Action: public RefCountable
26 {
27 public:
29 
30 public:
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 
74  StoreEntry *createStoreEntry() const;
75 
77  const char *contentType() const;
78 
79 protected:
81  virtual void collect() {}
82 
87  virtual void dump(StoreEntry *) {}
88 
89 private:
91 
92 private:
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 
Action & operator=(const Action &)
void OpenKidSection(StoreEntry *, Format)
Definition: Action.cc:143
~Action() override
Definition: Action.cc:31
combined hard-coded action profile with user-supplied action parameters
Definition: Command.h:21
const char * contentType() const
HTTP Content-Type header value for this Action report.
Definition: Action.cc:61
const CommandPointer cmd
the command that caused this action
Definition: Action.h:90
const char * name() const
label as seen in the cache manager menu
Definition: Action.cc:55
void CloseKidSection(StoreEntry *, Format)
Definition: Action.cc:155
virtual void unpack(const Ipc::TypedMsgHdr &)
unpack action info from the message received by Coordinator
Definition: Action.h:56
Action(const CommandPointer &aCmd)
Definition: Action.cc:25
const Command & command() const
the cause of this action
Definition: Action.cc:36
bool atomic() const
dump() call writes everything before returning
Definition: Action.cc:43
virtual void respond(const Request &request)
respond to Coordinator request; default is to collect and sendResponse
Definition: Action.cc:87
StoreEntry * createStoreEntry() const
creates store entry from params
Definition: Action.cc:74
void sendResponse(Ipc::RequestId)
notify Coordinator that this action is done with local processing
Definition: Action.cc:101
cache manager request
Definition: Request.h:23
virtual void dump(StoreEntry *)
Definition: Action.h:87
virtual bool aggregatable() const
Definition: Action.h:65
virtual void collect()
calculate and keep local action-specific information
Definition: Action.h:81
virtual Format format() const
action report syntax
Definition: Action.cc:49
void run(StoreEntry *entry, bool writeHttpHeader)
collect + fillEntry: collect local information and fill the store entry
Definition: Action.cc:110
void fillEntry(StoreEntry *entry, bool writeHttpHeader)
prepare store entry, dump info, close store entry (if possible)
Definition: Action.cc:118
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:34
virtual void pack(Ipc::TypedMsgHdr &) const
pack collected action info into a message to be sent to Coordinator
Definition: Action.h:53
RefCount< Action > Pointer
Definition: Action.h:28
virtual void add(const Action &action)
incrementally merge in remote information (of the same action type)
Definition: Action.cc:82
Cache Manager API.
Definition: Action.h:20

 

Introduction

Documentation

Support

Miscellaneous