Action.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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_MGR_ACTION_H
12 #define SQUID_MGR_ACTION_H
13 
14 #include "ipc/forward.h"
15 #include "mgr/forward.h"
16 
17 class StoreEntry;
18 
19 namespace Mgr
20 {
21 
24 class Action: public RefCountable
25 {
26 public:
28 
29 public:
30  Action(const CommandPointer &aCmd);
31  virtual ~Action();
32 
33  /* for local Cache Manager use */
34 
36  void run(StoreEntry *entry, bool writeHttpHeader);
37 
39  void fillEntry(StoreEntry *entry, bool writeHttpHeader);
40 
41  /* for global Coordinator use */
42 
44  virtual void add(const Action &action);
45 
46  /* global-local communication */
47 
49  virtual void respond(const Request &request);
50 
52  virtual void pack(Ipc::TypedMsgHdr &) const {}
53 
55  virtual void unpack(const Ipc::TypedMsgHdr &) {}
56 
58  void sendResponse(unsigned int requestId);
59 
60  /* Action properties */
61 
64  virtual bool aggregatable() const { return true; } // most kid classes are
65 
66  bool atomic() const;
67  const char *name() const;
68  const Command &command() const;
69 
70  StoreEntry *createStoreEntry() const;
71 
73  virtual const char *contentType() const {return "text/plain;charset=utf-8";}
74 
75 protected:
77  virtual void collect() {}
78 
83  virtual void dump(StoreEntry *) {}
84 
85 private:
87 
88 private:
89  Action(const Action &); // not implemented
90  Action &operator= (const Action &); // not implemented
91 };
92 
93 } // namespace Mgr
94 
95 #endif /* SQUID_MGR_ACTION_H */
96 
cache manager request
Definition: Request.h:22
Action & operator=(const Action &)
void fillEntry(StoreEntry *entry, bool writeHttpHeader)
prepare store entry, dump info, close store entry (if possible)
Definition: Action.cc:99
struct _request * request(char *urlin)
Definition: tcp-banger2.c:291
virtual void collect()
calculate and keep local action-specific information
Definition: Action.h:77
RefCount< Action > Pointer
Definition: Action.h:27
virtual void pack(Ipc::TypedMsgHdr &) const
pack collected action info into a message to be sent to Coordinator
Definition: Action.h:52
virtual void respond(const Request &request)
respond to Coordinator request; default is to collect and sendResponse
Definition: Action.cc:68
bool atomic() const
dump() call writes everything before returning
Definition: Action.cc:43
virtual void unpack(const Ipc::TypedMsgHdr &)
unpack action info from the message received by Coordinator
Definition: Action.h:55
Action(const CommandPointer &aCmd)
Definition: Action.cc:25
void sendResponse(unsigned int requestId)
notify Coordinator that this action is done with local processing
Definition: Action.cc:82
const Command & command() const
the cause of this action
Definition: Action.cc:36
const CommandPointer cmd
the command that caused this action
Definition: Action.h:86
bool action(int fd, size_t metasize, const char *fn, const char *url, const SquidMetaList &meta)
Definition: purge.cc:311
combined hard-coded action profile with user-supplied action parameters
Definition: Command.h:21
const char * name() const
label as seen in the cache manager menu
Definition: Action.cc:49
struct msghdr with a known type, fixed-size I/O and control buffers
Definition: TypedMsgHdr.h:31
virtual ~Action()
Definition: Action.cc:31
StoreEntry * createStoreEntry() const
creates store entry from params
Definition: Action.cc:55
virtual void add(const Action &action)
incrementally merge in remote information (of the same action type)
Definition: Action.cc:63
virtual const char * contentType() const
Definition: Action.h:73
virtual bool aggregatable() const
Definition: Action.h:64
void run(StoreEntry *entry, bool writeHttpHeader)
collect + fillEntry: collect local information and fill the store entry
Definition: Action.cc:91
virtual void dump(StoreEntry *)
Definition: Action.h:83

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors