]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/ClientDelayConfig.h
1ccf5990e5dee037ec9403aac66a98fcd6ce4fa5
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_CLIENTDELAYCONFIG_H
10 #define SQUID_CLIENTDELAYCONFIG_H
12 #include "acl/forward.h"
13 #include "base/RefCount.h"
20 /// \ingroup DelayPoolsAPI
22 /* represents one client write limiting delay 'pool' */
23 class ClientDelayPool
: public RefCountable
26 typedef RefCount
<ClientDelayPool
> Pointer
;
29 : access(nullptr), rate(0), highwatermark(0) {}
31 ClientDelayPool(const ClientDelayPool
&) = delete;
32 ClientDelayPool
&operator=(const ClientDelayPool
&) = delete;
34 void dump (StoreEntry
* entry
, unsigned int poolNumberMinusOne
) const;
37 int64_t highwatermark
;
40 class ClientDelayPools
43 ClientDelayPools(const ClientDelayPools
&) = delete;
44 ClientDelayPools
&operator=(const ClientDelayPools
&) = delete;
45 static ClientDelayPools
*Instance();
47 std::vector
<ClientDelayPool::Pointer
> pools
;
53 /* represents configuration of client write limiting delay pools */
54 class ClientDelayConfig
59 ClientDelayConfig(const ClientDelayConfig
&) = delete;
60 ClientDelayConfig
&operator=(const ClientDelayConfig
&) = delete;
63 void dumpPoolCount(StoreEntry
* entry
, const char *name
) const;
64 /* parsing of client_delay_pools - number of pools */
65 void parsePoolCount();
66 /* parsing of client_delay_parameters lines */
67 void parsePoolRates();
68 /* parsing client_delay_access lines */
69 void parsePoolAccess(ConfigParser
&parser
);
71 void finalize(); ///< checks pools configuration
73 /* initial bucket level, how fill bucket at startup */
74 unsigned short initial
;
77 unsigned short parsePoolId();
78 std::vector
<ClientDelayPool::Pointer
> &pools() { return ClientDelayPools::Instance()->pools
; }
79 ClientDelayPool
&pool(const int i
) { return *(ClientDelayPools::Instance()->pools
.at(i
)); }
82 #endif // SQUID_CLIENTDELAYCONFIG_H