MessageDelayPools.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 MESSAGEDELAYPOOLS_H
10 #define MESSAGEDELAYPOOLS_H
11 
12 #if USE_DELAY_POOLS
13 
14 #include "acl/Acl.h"
15 #include "base/RefCount.h"
16 #include "DelayBucket.h"
17 #include "DelayPools.h"
18 #include "sbuf/SBuf.h"
19 
22 
27 {
28 public:
30 
31  MessageDelayPool(const SBuf &name, int64_t bucketSpeed, int64_t bucketSize,
32  int64_t aggregateSpeed, int64_t aggregateSize, uint16_t initialBucketPercent);
34  MessageDelayPool(const MessageDelayPool &) = delete;
35  MessageDelayPool &operator=(const MessageDelayPool &) = delete;
36 
38  void refillBucket();
40  void bytesIn(int qty) { if (!noLimit()) theBucket.bytesIn(qty); }
42  int level() { return theBucket.level(); }
46  bool noLimit () const { return aggregateRestore < 0; }
47 
48  void dump (StoreEntry * entry) const;
49 
65 
66 private:
68  time_t lastUpdate;
69 };
70 
74 {
75 public:
76  MessageDelayPools(const MessageDelayPools &) = delete;
78 
79  static MessageDelayPools *Instance();
80 
82  MessageDelayPool::Pointer pool(const SBuf &name);
84  void add(MessageDelayPool *pool);
86  void freePools();
87 
88  std::vector<MessageDelayPool::Pointer> pools;
89 
90 private:
93  void Stats() { } // TODO
94 };
95 
98 {
99 public:
100  void parseResponseDelayPool();
101  void dumpResponseDelayPoolParameters(StoreEntry *e, const char *name);
103  void freePools();
104 };
105 
106 #define free_response_delay_pool_access(X)
107 #define dump_response_delay_pool_access(X, Y, Z)
108 
109 inline void
111 {
112  cfg->freePools();
113 }
114 
115 inline void
117 {
118  cfg.dumpResponseDelayPoolParameters(entry, name);
119 }
120 
121 inline void
123 {
124  cfg->parseResponseDelayPool();
125 }
126 
127 inline void
129 {
131 }
132 
133 #endif
134 #endif
135 
RefCount< MessageDelayPool > Pointer
represents configuration for response delay pools
int const & level() const
Definition: DelayBucket.h:24
MessageDelayPool(const SBuf &name, int64_t bucketSpeed, int64_t bucketSize, int64_t aggregateSpeed, int64_t aggregateSize, uint16_t initialBucketPercent)
Definition: SBuf.h:87
bool noLimit() const
whether the aggregate bucket has no limit
DelayBucket theBucket
the aggregate bucket
void add(MessageDelayPool *pool)
appends a single MessageDelayPool, created during configuration
void parse_response_delay_pool_parameters(MessageDelayConfig *cfg)
int64_t aggregateMaximum
the maximum size of the aggregate bucket
SBuf poolName
the response delay pool name
Limits Squid-to-client bandwidth for each matching response.
Definition: MessageBucket.h:20
void freePools()
memory cleanup, performing during reconfiguration
int64_t individualRestore
the speed limit of an individual bucket (bytes/s)
int level()
current aggregate level
RefCount< MessageBucket > MessageBucketPointer
void bytesIn(int qty)
Definition: DelayBucket.cc:41
acl_access * access
void refillBucket()
Increases the aggregate bucket level with the aggregateRestore speed.
static MessageDelayPools * Instance()
void dump(StoreEntry *entry) const
uint16_t initialBucketLevel
the initial bucket size as a percentage of individualMaximum
time_t lastUpdate
Time the aggregate bucket level was last refilled.
void free_response_delay_pool_parameters(MessageDelayConfig *cfg)
void dump_response_delay_pool_parameters(StoreEntry *entry, const char *name, MessageDelayConfig &cfg)
MessageBucketPointer createBucket()
creates an individual response bucket
int64_t aggregateRestore
the speed limit of the aggregate bucket (bytes/s)
void parse_response_delay_pool_access(MessageDelayConfig *cfg)
MessageDelayPool::Pointer pool(const SBuf &name)
returns a MessageDelayPool with a given name or null otherwise
std::vector< MessageDelayPool::Pointer > pools
int64_t individualMaximum
the maximum size of an individual bucket
void bytesIn(int qty)
decreases the aggregate level
void dumpResponseDelayPoolParameters(StoreEntry *e, const char *name)
#define acl_access
Definition: forward.h:44
MessageDelayPools & operator=(const MessageDelayPools &)=delete
MessageDelayPool & operator=(const MessageDelayPool &)=delete

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors