DelayPool.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 "acl/Acl.h"
15 #include "acl/Gadgets.h"
16 #include "CommonPool.h"
17 #include "DelayPool.h"
18 #include "Store.h"
19 
20 DelayPool::DelayPool() : pool (nullptr), access (nullptr)
21 {
23 }
24 
26 {
27  if (pool)
28  freeData();
29 
30  if (access)
32 }
33 
34 void
36 {
37  assert(theComposite() != nullptr);
38  theComposite()->parse();
39 }
40 
41 void
42 DelayPool::dump(StoreEntry *entry, unsigned int i) const
43 {
44  if (theComposite() == nullptr)
45  return;
46 
47  storeAppendPrintf(entry, "delay_class %d " SQUIDSBUFPH "\n", i + 1, SQUIDSBUFPRINT(pool->classTypeLabel()));
48 
49  LOCAL_ARRAY(char, nom, 32);
50 
51  snprintf(nom, 32, "delay_access %d", i + 1);
52 
53  dump_acl_access(entry, nom, access);
54 
55  storeAppendPrintf(entry, "delay_parameters %d", i + 1);
56 
57  theComposite()->dump (entry);
58 
59  storeAppendPrintf(entry, "\n");
60 }
61 
62 void
63 DelayPool::createPool(u_char delay_class)
64 {
65  if (pool)
66  freeData();
67 
68  pool = CommonPool::Factory(delay_class, theComposite_);
69 }
70 
71 void
73 {
74  delete pool;
75  pool = nullptr;
76 }
77 
78 // TODO: create DelayIdComposite.cc
79 void
81 {
82  deferredReads.delay(aRead);
83 }
84 
85 #include "comm.h"
86 
87 void
89 {
91 }
92 
93 #endif /* USE_DELAY_POOLS */
94 
#define LOCAL_ARRAY(type, name, size)
Definition: squid.h:62
virtual void parse()=0
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:855
void delay(const AsyncCallPointer &)
stores the given call to schedule it at schedule() or destruction time
void dump(StoreEntry *, unsigned int poolNumberMinusOne) const
Definition: DelayPool.cc:42
static CommonPool * Factory(unsigned char _class, CompositePoolNode::Pointer &)
Definition: delay_pools.cc:248
#define SQUIDSBUFPRINT(s)
Definition: SBuf.h:32
void dump_acl_access(StoreEntry *entry, const char *name, acl_access *head)
Definition: cache_cf.cc:1511
const SBuf & classTypeLabel() const
Definition: CommonPool.h:31
void createPool(u_char delay_class)
Definition: DelayPool.cc:63
DelayedAsyncCalls deferredReads
#define assert(EX)
Definition: assert.h:17
void parse()
Definition: DelayPool.cc:35
void schedule()
schedules and forgets all async calls previously stored by delay()
virtual void dump(StoreEntry *entry) const =0
~DelayPool()
Definition: DelayPool.cc:25
void aclDestroyAccessList(acl_access **list)
Definition: Gadgets.cc:223
void freeData()
Definition: DelayPool.cc:72
CompositePoolNode::Pointer theComposite()
Definition: DelayPool.h:34
void delayRead(const AsyncCallPointer &)
Definition: DelayPool.cc:80
CommonPool * pool
Definition: DelayPool.h:33
CompositePoolNode::Pointer theComposite_
Definition: DelayPool.h:41
acl_access * access
Definition: DelayPool.h:38
#define SQUIDSBUFPH
Definition: SBuf.h:31

 

Introduction

Documentation

Support

Miscellaneous