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_MGR_ACTION_H
12#define SQUID_MGR_ACTION_H
13
14#include "ipc/forward.h"
15#include "mgr/forward.h"
16
17class StoreEntry;
18
19namespace Mgr
20{
21
24class Action: public RefCountable
25{
26public:
28
29public:
30 Action(const CommandPointer &aCmd);
31 ~Action() override;
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
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
71
73 virtual const char *contentType() const {return "text/plain;charset=utf-8";}
74
75protected:
77 virtual void collect() {}
78
83 virtual void dump(StoreEntry *) {}
84
85private:
87
88private:
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
#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:83
Action(const CommandPointer &aCmd)
Definition: Action.cc:25
virtual bool aggregatable() const
Definition: Action.h:64
void fillEntry(StoreEntry *entry, bool writeHttpHeader)
prepare store entry, dump info, close store entry (if possible)
Definition: Action.cc:99
RefCount< Action > Pointer
Definition: Action.h:27
Action(const Action &)
const Command & command() const
the cause of this action
Definition: Action.cc:36
void sendResponse(Ipc::RequestId)
notify Coordinator that this action is done with local processing
Definition: Action.cc:82
virtual void respond(const Request &request)
respond to Coordinator request; default is to collect and sendResponse
Definition: Action.cc:68
StoreEntry * createStoreEntry() const
creates store entry from params
Definition: Action.cc:55
virtual const char * contentType() const
Definition: Action.h:73
virtual void collect()
calculate and keep local action-specific information
Definition: Action.h:77
bool atomic() const
dump() call writes everything before returning
Definition: Action.cc:43
~Action() override
Definition: Action.cc:31
Action & operator=(const Action &)
virtual void unpack(const Ipc::TypedMsgHdr &)
unpack action info from the message received by Coordinator
Definition: Action.h:55
const char * name() const
label as seen in the cache manager menu
Definition: Action.cc:49
const CommandPointer cmd
the command that caused this action
Definition: Action.h:86
virtual void add(const Action &action)
incrementally merge in remote information (of the same action type)
Definition: Action.cc:63
virtual void pack(Ipc::TypedMsgHdr &) const
pack collected action info into a message to be sent to Coordinator
Definition: Action.h:52
void run(StoreEntry *entry, bool writeHttpHeader)
collect + fillEntry: collect local information and fill the store entry
Definition: Action.cc:91
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:20
static bool action(int fd, size_t metasize, const char *fn, const char *url, const SquidMetaList &meta)
Definition: purge.cc:315

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors