]> git.ipfire.org Git - thirdparty/squid.git/blob - src/DelayVector.h
Preserve caller context across (and improve) deferred reads (#1025)
[thirdparty/squid.git] / src / DelayVector.h
1 /*
2 * Copyright (C) 1996-2022 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_DELAYVECTOR_H
10 #define SQUID_DELAYVECTOR_H
11
12 #if USE_DELAY_POOLS
13
14 #include "base/forward.h"
15 #include "CompositePoolNode.h"
16
17 /// \ingroup DelayPoolsAPI
18 class DelayVector : public CompositePoolNode
19 {
20 MEMPROXY_CLASS(DelayVector);
21
22 public:
23 typedef RefCount<DelayVector> Pointer;
24 DelayVector();
25 virtual ~DelayVector();
26 virtual void stats(StoreEntry * sentry);
27 virtual void dump(StoreEntry *entry) const;
28 virtual void update(int incr);
29 virtual void parse();
30
31 virtual DelayIdComposite::Pointer id(CompositeSelectionDetails &);
32 void push_back (CompositePoolNode::Pointer);
33
34 private:
35
36 /// \ingroup DelayPoolsInternal
37 class Id:public DelayIdComposite
38 {
39 MEMPROXY_CLASS(DelayVector::Id);
40
41 public:
42 Id (RefCount<DelayVector>,CompositeSelectionDetails &);
43 ~Id();
44 virtual int bytesWanted (int min, int max) const;
45 virtual void bytesIn(int qty);
46 virtual void delayRead(const AsyncCallPointer &);
47
48 private:
49 RefCount<DelayVector> theVector;
50 std::vector<DelayIdComposite::Pointer> ids;
51 typedef std::vector<DelayIdComposite::Pointer>::iterator iterator;
52 typedef std::vector<DelayIdComposite::Pointer>::const_iterator const_iterator;
53 };
54
55 friend class Id;
56
57 std::vector<CompositePoolNode::Pointer> pools;
58 typedef std::vector<CompositePoolNode::Pointer>::iterator iterator;
59 typedef std::vector<CompositePoolNode::Pointer>::const_iterator const_iterator;
60 };
61
62 #endif /* USE_DELAY_POOLS */
63 #endif /* SQUID_DELAYVECTOR_H */
64