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

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors