DelayVector.cc
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/* DEBUG: section 77 Delay Pools */
10
11#include "squid.h"
12
13#if USE_DELAY_POOLS
14#include "base/AsyncCall.h"
16#include "comm/Connection.h"
17#include "DelayVector.h"
18
20{
22}
23
25{
27}
28
29void
31{
32 iterator pos = pools.begin();
33
34 while (pos != pools.end()) {
35 (*pos)->stats(sentry);
36 ++pos;
37 }
38}
39
40void
42{
43 const_iterator pos = pools.begin();
44
45 while (pos != pools.end()) {
46 (*pos)->dump(entry);
47 ++pos;
48 }
49}
50
51void
53{
54 /*
55 * Each pool updates itself,
56 * but we may have deferred reads waiting on the pool as a whole.
57 */
58
59 kickReads();
60}
61
62void
64{
65 iterator pos = pools.begin();
66
67 while (pos != pools.end()) {
68 (*pos)->parse();
69 ++pos;
70 }
71}
72
75{
76 return new Id(this, details);
77}
78
79void
81{
82 pools.push_back(aNode);
83}
84
85DelayVector::Id::Id(DelayVector::Pointer aDelayVector, CompositeSelectionDetails &details) : theVector(aDelayVector)
86{
87 debugs(77, 3, "DelayVector::Id::Id");
89
90 while (pos != theVector->pools.end()) {
91 ids.push_back ((*pos)->id (details));
92 ++pos;
93 }
94}
95
97{
98 debugs(77, 3, "DelayVector::Id::~Id");
99}
100
101int
102DelayVector::Id::bytesWanted (int minimum, int maximum) const
103{
104 int nbytes = maximum;
105 const_iterator pos = ids.begin();
106
107 while (pos != ids.end()) {
108 nbytes = min (nbytes, (*pos)->bytesWanted(minimum, nbytes));
109 ++pos;
110 }
111
112 nbytes = max(minimum, nbytes);
113 return nbytes;
114}
115
116void
118{
119 iterator pos = ids.begin();
120
121 while (pos != ids.end()) {
122 (*pos)->bytesIn(qty);
123 ++pos;
124 }
125
126 theVector->kickReads();
127}
128
129void
131{
132 theVector->delayRead(aRead);
133}
134
135#endif
136
static void deregisterForUpdates(Updateable *)
Definition: delay_pools.cc:515
static void registerForUpdates(Updateable *)
Definition: delay_pools.cc:508
std::vector< DelayIdComposite::Pointer >::iterator iterator
Definition: DelayVector.h:51
int bytesWanted(int min, int max) const override
Definition: DelayVector.cc:102
std::vector< DelayIdComposite::Pointer > ids
Definition: DelayVector.h:50
Id(RefCount< DelayVector >, CompositeSelectionDetails &)
Definition: DelayVector.cc:85
void bytesIn(int qty) override
Definition: DelayVector.cc:117
std::vector< DelayIdComposite::Pointer >::const_iterator const_iterator
Definition: DelayVector.h:52
RefCount< DelayVector > theVector
Definition: DelayVector.h:49
void delayRead(const AsyncCallPointer &) override
Definition: DelayVector.cc:130
~Id() override
Definition: DelayVector.cc:96
~DelayVector() override
Definition: DelayVector.cc:24
std::vector< CompositePoolNode::Pointer > pools
Definition: DelayVector.h:57
void update(int incr) override
Definition: DelayVector.cc:52
std::vector< CompositePoolNode::Pointer >::iterator iterator
Definition: DelayVector.h:58
DelayIdComposite::Pointer id(CompositeSelectionDetails &) override
Definition: DelayVector.cc:74
friend class Id
Definition: DelayVector.h:55
void parse() override
Definition: DelayVector.cc:63
std::vector< CompositePoolNode::Pointer >::const_iterator const_iterator
Definition: DelayVector.h:59
void stats(StoreEntry *sentry) override
Definition: DelayVector.cc:30
void dump(StoreEntry *entry) const override
Definition: DelayVector.cc:41
void push_back(CompositePoolNode::Pointer)
Definition: DelayVector.cc:80
A const & max(A const &lhs, A const &rhs)
A const & min(A const &lhs, A const &rhs)
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:194

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors