PeerDigest.h
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 #ifndef SQUID_PEERDIGEST_H
10 #define SQUID_PEERDIGEST_H
11 
12 #if USE_CACHE_DIGESTS
13 
14 #include "cbdata.h"
15 #include "StatCounters.h"
16 
17 class Version
18 {
19 public:
20  short int current; /* current version */
21  short int required; /* minimal version that can safely handle current version */
22 };
23 
24 /* digest control block; used for transmission and storage */
25 
27 {
28 public:
30  int capacity;
31  int count;
32  int del_count;
33  int mask_size;
34  unsigned char bits_per_entry;
35  unsigned char hash_func_count;
36  short int reserved_short;
37  int reserved[32 - 6];
38 };
39 
40 class HttpRequest;
41 class PeerDigest;
42 class store_client;
43 
45 {
47 
48 public:
51 
58  int offset;
59  uint32_t mask_offset;
60  time_t start_time;
61  time_t resp_time;
62  time_t expires;
63 
64  struct {
65  int msg;
66  int bytes;
67  } sent, recv;
68 
70  ssize_t bufofs;
72 };
73 
75 {
77 
78 public:
79  CachePeer *peer;
82  const char *req_result;
84  struct {
85  bool needed;
86  bool usable;
87  bool requested;
88  } flags;
89 
90  struct {
91  /* all times are absolute unless augmented with _delay */
92  time_t initialized; /* creation */
93  time_t needed; /* first lookup/use by a peer */
94  time_t next_check; /* next scheduled check/refresh event */
95  time_t retry_delay; /* delay before re-checking _invalid_ digest */
96  time_t requested; /* requested a fresh copy of a digest */
97  time_t req_delay; /* last request response time */
98  time_t received; /* received the current copy of a digest */
99  time_t disabled; /* disabled for good */
100  } times;
101 
102  struct {
105 
106  struct {
107  int msgs;
109  } sent, recv;
110  } stats;
111 };
112 
113 extern const Version CacheDigestVer;
114 
116 void peerDigestNeeded(PeerDigest * pd);
118 void peerDigestStatsReport(const PeerDigest * pd, StoreEntry * e);
119 
120 #endif /* USE_CACHE_DIGESTS */
121 
122 #endif /* SQUID_PEERDIGEST_H */
123 
StoreEntry * entry
Definition: PeerDigest.h:53
store_client * sc
Definition: PeerDigest.h:55
time_t received
Definition: PeerDigest.h:98
struct PeerDigest::@91 times
time_t retry_delay
Definition: PeerDigest.h:95
time_t initialized
Definition: PeerDigest.h:92
store_client * old_sc
Definition: PeerDigest.h:56
void peerDigestStatsReport(const PeerDigest *pd, StoreEntry *e)
counter for accumulating byte values
Definition: ByteCounter.h:13
time_t start_time
Definition: PeerDigest.h:60
String host
Definition: PeerDigest.h:81
char * p
Definition: membanger.c:43
CacheDigest * cd
Definition: PeerDigest.h:80
time_t req_delay
Definition: PeerDigest.h:97
struct PeerDigest::@90 flags
struct DigestFetchState::@89 sent
digest_read_state_t state
Definition: PeerDigest.h:71
unsigned char bits_per_entry
Definition: PeerDigest.h:34
unsigned char hash_func_count
Definition: PeerDigest.h:35
struct DigestFetchState::@89 recv
DigestFetchState(PeerDigest *, HttpRequest *)
Definition: peer_digest.cc:92
ByteCounter kbytes
Definition: PeerDigest.h:108
void peerDigestNeeded(PeerDigest *pd)
Definition: peer_digest.cc:170
StoreEntry * old_entry
Definition: PeerDigest.h:54
const Version CacheDigestVer
Definition: peer_digest.cc:56
uint32_t mask_offset
Definition: PeerDigest.h:59
bool needed
Definition: PeerDigest.h:85
PeerDigest * pd
Definition: PeerDigest.h:52
CacheDigestGuessStats guess
Definition: PeerDigest.h:103
ssize_t bufofs
Definition: PeerDigest.h:70
#define CBDATA_CLASS(type)
Definition: cbdata.h:302
time_t next_check
Definition: PeerDigest.h:94
time_t disabled
Definition: PeerDigest.h:99
bool usable
Definition: PeerDigest.h:86
short int current
Definition: PeerDigest.h:20
short int reserved_short
Definition: PeerDigest.h:36
digest_read_state_t
Definition: enums.h:165
#define SM_PAGE_SIZE
Definition: defines.h:102
time_t needed
Definition: PeerDigest.h:93
PeerDigest * peerDigestCreate(CachePeer *p)
Definition: peer_digest.cc:133
struct PeerDigest::@92::@93 sent
short int required
Definition: PeerDigest.h:21
bool requested
Definition: PeerDigest.h:87
HttpRequest * request
Definition: PeerDigest.h:57
time_t resp_time
Definition: PeerDigest.h:61
char buf[SM_PAGE_SIZE]
Definition: PeerDigest.h:69
time_t requested
Definition: PeerDigest.h:96
const char * req_result
Definition: PeerDigest.h:82
CachePeer * peer
Definition: PeerDigest.h:76
void peerDigestNotePeerGone(PeerDigest *pd)
Definition: peer_digest.cc:236
int used_count
Definition: PeerDigest.h:104
struct PeerDigest::@92 stats
struct PeerDigest::@92::@93 recv
int reserved[32-6]
Definition: PeerDigest.h:37

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors