Squid Web Cache master
Loading...
Searching...
No Matches
MessageDelayPools.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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_MESSAGEDELAYPOOLS_H
10#define SQUID_SRC_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
20class MessageBucket;
22
27{
28public:
30
31 MessageDelayPool(const SBuf &name, int64_t bucketSpeed, int64_t bucketSize,
32 int64_t aggregateSpeed, int64_t aggregateSize, uint16_t initialBucketPercent);
33 ~MessageDelayPool() override;
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
66private:
68 time_t lastUpdate;
69};
70
74{
75public:
78
80
86 void freePools();
87
88 std::vector<MessageDelayPool::Pointer> pools;
89
90private:
93 void Stats() { } // TODO
94};
95
98{
99public:
103 void freePools();
104};
105
106#define free_response_delay_pool_access(X)
107#define dump_response_delay_pool_access(X, Y, Z)
108
109inline void
114
115inline void
120
121inline void
126
127inline void
132
133#endif
134#endif /* SQUID_SRC_MESSAGEDELAYPOOLS_H */
135
#define RefCountable
The locking interface for use on Reference-Counted classes.
Definition Lock.h:66
void dump_response_delay_pool_parameters(StoreEntry *entry, const char *, MessageDelayConfig &cfg)
RefCount< MessageBucket > MessageBucketPointer
void parse_response_delay_pool_parameters(MessageDelayConfig *cfg)
void parse_response_delay_pool_access(MessageDelayConfig *cfg)
void free_response_delay_pool_parameters(MessageDelayConfig *cfg)
void bytesIn(int qty)
int const & level() const
Definition DelayBucket.h:24
Limits Squid-to-client bandwidth for each matching response.
represents configuration for response delay pools
void dumpResponseDelayPoolParameters(StoreEntry *)
~MessageDelayPool() override
int64_t individualRestore
the speed limit of an individual bucket (bytes/s)
time_t lastUpdate
Time the aggregate bucket level was last refilled.
bool noLimit() const
whether the aggregate bucket has no limit
DelayBucket theBucket
the aggregate bucket
void refillBucket()
Increases the aggregate bucket level with the aggregateRestore speed.
SBuf poolName
the response delay pool name
MessageDelayPool(const MessageDelayPool &)=delete
int level()
current aggregate level
MessageBucketPointer createBucket()
creates an individual response bucket
uint16_t initialBucketLevel
the initial bucket size as a percentage of individualMaximum
int64_t individualMaximum
the maximum size of an individual bucket
int64_t aggregateMaximum
the maximum size of the aggregate bucket
void dump(StoreEntry *entry) const
RefCount< MessageDelayPool > Pointer
void bytesIn(int qty)
decreases the aggregate level
MessageDelayPool & operator=(const MessageDelayPool &)=delete
int64_t aggregateRestore
the speed limit of the aggregate bucket (bytes/s)
void add(MessageDelayPool *pool)
appends a single MessageDelayPool, created during configuration
static MessageDelayPools * Instance()
std::vector< MessageDelayPool::Pointer > pools
MessageDelayPool::Pointer pool(const SBuf &name)
returns a MessageDelayPool with a given name or null otherwise
MessageDelayPools & operator=(const MessageDelayPools &)=delete
void freePools()
memory cleanup, performing during reconfiguration
MessageDelayPools(const MessageDelayPools &)=delete
Definition SBuf.h:94