ClientDelayConfig.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 #ifndef SQUID_SRC_CLIENTDELAYCONFIG_H
10 #define SQUID_SRC_CLIENTDELAYCONFIG_H
11 
12 #include "acl/forward.h"
13 #include "base/RefCount.h"
14 
15 #include <vector>
16 
17 class StoreEntry;
18 class ConfigParser;
19 
21 
22 /* represents one client write limiting delay 'pool' */
24 {
25 public:
27 
29  : access(nullptr), rate(0), highwatermark(0) {}
30  ~ClientDelayPool() override;
31  ClientDelayPool(const ClientDelayPool &) = delete;
32  ClientDelayPool &operator=(const ClientDelayPool &) = delete;
33 
34  void dump (StoreEntry * entry, unsigned int poolNumberMinusOne) const;
36  int rate;
37  int64_t highwatermark;
38 };
39 
41 {
42 public:
43  ClientDelayPools(const ClientDelayPools &) = delete;
44  ClientDelayPools &operator=(const ClientDelayPools &) = delete;
45  static ClientDelayPools *Instance();
46 
47  std::vector<ClientDelayPool::Pointer> pools;
48 private:
51 };
52 
53 /* represents configuration of client write limiting delay pools */
55 {
56 public:
58  : initial(50) {}
59  ClientDelayConfig(const ClientDelayConfig &) = delete;
61 
62  void freePools();
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);
70 
71  void finalize();
72 
73  /* initial bucket level, how fill bucket at startup */
74  unsigned short initial;
75 
76 private:
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)); }
80 };
81 
82 #endif /* SQUID_SRC_CLIENTDELAYCONFIG_H */
83 
ClientDelayPools & operator=(const ClientDelayPools &)=delete
std::vector< ClientDelayPool::Pointer > pools
void finalize()
checks pools configuration
acl_access * access
void parsePoolAccess(ConfigParser &parser)
~ClientDelayPool() override
RefCount< ClientDelayPool > Pointer
unsigned short initial
std::vector< ClientDelayPool::Pointer > & pools()
ClientDelayConfig & operator=(const ClientDelayConfig &)=delete
void dump(StoreEntry *entry, unsigned int poolNumberMinusOne) const
ClientDelayPool & operator=(const ClientDelayPool &)=delete
static ClientDelayPools * Instance()
ClientDelayPool & pool(const int i)
void dumpPoolCount(StoreEntry *entry, const char *name) const
unsigned short parsePoolId()

 

Introduction

Documentation

Support

Miscellaneous