]> git.ipfire.org Git - thirdparty/squid.git/blob - src/HelperChildConfig.h
Various audit updates
[thirdparty/squid.git] / src / HelperChildConfig.h
1 #ifndef _SQUID_SRC_HELPERCHILDCONFIG_H
2 #define _SQUID_SRC_HELPERCHILDCONFIG_H
3
4 /**
5 * Contains statistics of a particular type of child helper.
6 *
7 * Some derived from a helper children configuration option,
8 * some from runtime stats on the currently active children.
9 */
10 class HelperChildConfig
11 {
12 public:
13 explicit HelperChildConfig(const unsigned int m = 0);
14
15 /**
16 * When new helpers are needed call this to find out how many more
17 * we are allowed to start.
18 * \retval 0 No more helpers may be started right now.
19 * \retval N < 0 Error. No more helpers may be started.
20 * \retval N N more helpers may be started immediately.
21 */
22 int needNew() const;
23 void parseConfig();
24
25 /**
26 * Update an existing set of details with new start/max/idle/concurrent limits.
27 * This is for parsing new child settings into an object incrementally then updating
28 * the running set without loosing any of the active state or causing races.
29 */
30 HelperChildConfig &updateLimits(const HelperChildConfig &rhs);
31
32 /* values from squid.conf */
33 public:
34
35 /** maximum child process limits. How many of this helper the system can cope with */
36 unsigned int n_max;
37
38 /**
39 * Number of children to kick off at startup.
40 * set via the startup=N option.
41 *
42 * By default if undefined 1 will be started immediately for use.
43 * The minimum/idle amount will be scheduled for starting as soon as possible after startup is completed.
44 */
45 unsigned int n_startup;
46
47 /**
48 * Number of helper children to keep available as a buffer against sudden bursts of requests.
49 * set via the idle=N option. May be zero.
50 *
51 * The default value for backward compatibility the default for this is the same as maximum children.
52 * For now the actual number of idle children is only reduced by a reconfigure operation. This may change.
53 */
54 unsigned int n_idle;
55
56 /**
57 * How many concurrent requests each child helper may be capable of handling.
58 * Default: 0 - no concurrency possible.
59 */
60 unsigned int concurrency;
61
62 /* derived from active operations */
63
64 /**
65 * Total helper children objects currently existing.
66 * Produced as a side effect of starting children or their stopping.
67 */
68 unsigned int n_running;
69
70 /**
71 * Count of helper children active (not shutting down).
72 * This includes both idle and in-use children.
73 */
74 unsigned int n_active;
75 };
76
77 /* Legacy parser interface */
78 #define parse_HelperChildConfig(c) (c)->parseConfig()
79 #define dump_HelperChildConfig(e,n,c) storeAppendPrintf((e), "\n%s %d startup=%d idle=%d concurrency=%d\n", (n), (c).n_max, (c).n_startup, (c).n_idle, (c).concurrency)
80 #define free_HelperChildConfig(dummy) // NO.
81
82 #endif /* _SQUID_SRC_HELPERCHILDCONFIG_H */