57 void update(
int incr)
override;
58 void parse()
override;
86template <
class Key,
class Value>
114 void parse()
override;
115 void update(
int incr)
override;
129 virtual char const *
label()
const = 0;
143 void bytesIn(
int qty)
override;
157 char const *
label()
const override {
return "Individual";}
167 char const *
label()
const override {
return "Network";}
197 void parse()
override;
198 void update(
int incr)
override;
211 virtual char const *
label()
const {
return "Individual";}
232 void bytesIn(
int qty)
override;
266 compositeCopy = temp.
getRaw();
276 compositeCopy = temp.
getRaw();
287 compositeCopy = temp.
getRaw();
303 fatal (
"unknown delay pool class");
319 for (
unsigned int j = 0; j < individuals.size(); ++j)
320 individuals.values[j].update (
rate, incr);
326 for (
unsigned int j = 0; j < individuals.size(); ++j) {
327 assert (individualUsed (j));
329 individuals.values[j].stats (sentry);
336 return individuals.findKeyIndex(host);
342 return individuals.indexUsed(index);
348 return individualUsed(findHostMapPosition (host));
354 if (individualAllocated (host))
355 return findHostMapPosition(host);
357 assert (!individualUsed (findHostMapPosition(host)));
359 unsigned char result = findHostMapPosition(host);
361 initHostIndex (
rate, result, host);
369 assert (!individualUsed(index));
371 unsigned char const newIndex = individuals.insert (host);
374 individuals.values[newIndex].init (
rate);
393 if (
rate()->restore_bps == -1)
425 if (
rate()->restore_bps != -1)
437 return theAggregate->theBucket.bytesWanted(
min,
max);
443 theAggregate->theBucket.bytesIn(qty);
444 theAggregate->kickReads();
461 RegisterWithCacheManager();
487 if (!pools() && toUpdate.empty())
490 eventAdd(
"DelayPools::Update", Update,
nullptr, 1.0, 1);
499 std::vector<Updateable *>::iterator pos = toUpdate.begin();
501 while (pos != toUpdate.end()) {
502 (*pos)->update(incr);
511 toUpdate.push_back(anObject);
517 std::vector<Updateable *>::iterator pos = toUpdate.begin();
519 while (pos != toUpdate.end() && *pos != anObject) {
523 if (pos != toUpdate.end()) {
525 std::vector<Updateable *>::iterator temp = pos;
528 while (pos != toUpdate.end()) {
573 debugs(3,
DBG_CRITICAL,
"parse_delay_pool_count: multiple delay_pools lines, aborting all previous delay_pools config");
583template <
class Key,
class Value>
587template <
class Key,
class Value>
591 return nextMapPosition;
594template <
class Key,
class Value>
598 unsigned char index = findKeyIndex (key);
599 assert (!indexUsed(index));
601 key_map[index] = key;
623 if (
rate()->restore_bps == -1) {
630 for (
unsigned int i = 0; i <
buckets.
size(); ++i) {
650 if (
rate()->restore_bps == -1)
669template <
class Key,
class Value>
673 return index <
size();
677template <
class Key,
class Value>
681 for (
unsigned int index = 0; index <
size(); ++index) {
684 if (key_map[index] == key)
695 if (
rate()->restore_bps == -1)
711 return new Id(
this, resultIndex);
720 return theVector->buckets.values[theIndex].bytesWanted (
min,
max);
726 theVector->buckets.values[theIndex].bytesIn (qty);
738 return (ntohl(host.s_addr) & 0xff);
750 return ( (ntohl(net.s_addr) >> 8) & 0xff);
768 if (
rate()->restore_bps == -1) {
773 for (
unsigned int index = 0; index <
buckets.
size(); ++index) {
794 if (
rate()->restore_bps == -1)
823 return (ntohl(host.s_addr) & 0xff);
835 return ( (ntohl(net.s_addr) >> 8) & 0xff);
841 if (
rate()->restore_bps == -1)
850 unsigned char host = makeHostKey (details.
src_addr);
852 unsigned char hostIndex;
854 unsigned char netIndex;
863 return new Id (
this, netIndex, hostIndex);
872 return theClassCHost->buckets.values[theNet].individuals.values[theHost].bytesWanted (
min,
max);
878 theClassCHost->buckets.values[theNet].individuals.values[theHost].bytesIn (qty);
#define MEMPROXY_CLASS(CLASS)
#define SQUIDSBUFPRINT(s)
RefCount< Aggregate > theAggregate
AggregateId(RefCount< Aggregate >)
int bytesWanted(int min, int max) const override
void bytesIn(int qty) override
void delayRead(const AsyncCallPointer &) override
RefCount< Aggregate > Pointer
virtual DelaySpec * rate()
DelayIdComposite::Pointer id(CompositeSelectionDetails &) override
void dump(StoreEntry *entry) const override
void stats(StoreEntry *sentry) override
void update(int incr) override
virtual DelaySpec const * rate() const
unsigned char findHostMapPosition(unsigned char const host) const
void update(DelaySpec const &, int incr)
unsigned char hostPosition(DelaySpec &rate, unsigned char const host)
VectorMap< unsigned char, DelayBucket > individuals
void initHostIndex(DelaySpec &rate, unsigned char index, unsigned char host)
void stats(StoreEntry *) const
bool individualUsed(unsigned int index) const
bool individualAllocated(unsigned char host) const
void bytesIn(int qty) override
RefCount< ClassCHostPool > theClassCHost
Id(RefCount< ClassCHostPool >, unsigned char, unsigned char)
int bytesWanted(int min, int max) const override
DelayIdComposite::Pointer id(CompositeSelectionDetails &) override
unsigned char makeHostKey(Ip::Address &src_addr) const
~ClassCHostPool() override
void update(int incr) override
void stats(StoreEntry *sentry) override
bool keyAllocated(unsigned char const key) const
virtual char const * label() const
VectorMap< unsigned char, ClassCBucket > buckets
void dump(StoreEntry *entry) const override
virtual DelaySpec const * rate() const
RefCount< ClassCHostPool > Pointer
virtual DelaySpec * rate()
virtual unsigned int makeKey(Ip::Address &src_addr) const
unsigned int makeKey(Ip::Address &src_addr) const override
char const * label() const override
static CommonPool * Factory(unsigned char _class, CompositePoolNode::Pointer &)
virtual void stats(StoreEntry *sentry)=0
void delayRead(const AsyncCallPointer &)
void init(DelaySpec const &)
void update(DelaySpec const &, int incr)
void stats(StoreEntry *) const
CompositePoolNode::Pointer theComposite()
static void deregisterForUpdates(Updateable *)
static unsigned short pools()
static void FreeDelayData()
static void RegisterWithCacheManager(void)
static unsigned short pools_
static void Update(void *)
static void registerForUpdates(Updateable *)
static std::vector< Updateable * > toUpdate
static DelayPool * delay_data
static void InitDelayData()
static void Stats(StoreEntry *)
void dump(StoreEntry *) const
void stats(StoreEntry *sentry, char const *) const
void push_back(CompositePoolNode::Pointer)
unsigned int makeKey(Ip::Address &src_addr) const override
char const * label() const override
bool getInAddr(struct in_addr &) const
unsigned int insert(Key const key)
unsigned char findKeyIndex(Key const key) const
unsigned int size() const
unsigned int nextMapPosition
bool indexUsed(unsigned char const index) const
RefCount< VectorPool > theVector
Id(RefCount< VectorPool >, int)
void bytesIn(int qty) override
int bytesWanted(int min, int max) const override
DelayIdComposite::Pointer id(CompositeSelectionDetails &) override
virtual unsigned int makeKey(Ip::Address &src_addr) const =0
RefCount< VectorPool > Pointer
virtual DelaySpec * rate()
VectorMap< unsigned char, DelayBucket > buckets
void dump(StoreEntry *entry) const override
virtual DelaySpec const * rate() const
virtual char const * label() const =0
void stats(StoreEntry *sentry) override
void update(int incr) override
bool keyAllocated(unsigned char const key) const
A const & max(A const &lhs, A const &rhs)
A const & min(A const &lhs, A const &rhs)
#define debugs(SECTION, LEVEL, CONTENT)
void eventAdd(const char *name, EVH *func, void *arg, double when, int weight, bool cbdata)
void fatal(const char *message)
void RegisterAction(char const *action, char const *desc, OBJH *handler, Protected, Atomic, Format)
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
time_t getCurrentTime() STUB_RETVAL(0) int tvSubUsec(struct timeval