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