PeerDigest.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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:
80  ~PeerDigest();
81 
82  CachePeer *peer = nullptr;
83  CacheDigest *cd = nullptr;
85  const char *req_result = nullptr;
87  struct {
88  bool needed = false;
89  bool usable = false;
90  bool requested = false;
91  } flags;
92 
93  struct {
94  /* all times are absolute unless augmented with _delay */
95  time_t initialized = 0; /* creation */
96  time_t needed = 0; /* first lookup/use by a peer */
97  time_t next_check = 0; /* next scheduled check/refresh event */
98  time_t retry_delay = 0; /* delay before re-checking _invalid_ digest */
99  time_t requested = 0; /* requested a fresh copy of a digest */
100  time_t req_delay = 0; /* last request response time */
101  time_t received = 0; /* received the current copy of a digest */
102  time_t disabled = 0; /* disabled for good */
103  } times;
104 
105  struct {
107  int used_count = 0;
108 
109  struct {
110  int msgs = 0;
112  } sent, recv;
113  } stats;
114 };
115 
116 extern const Version CacheDigestVer;
117 
119 void peerDigestNeeded(PeerDigest * pd);
121 void peerDigestStatsReport(const PeerDigest * pd, StoreEntry * e);
122 
123 #endif /* USE_CACHE_DIGESTS */
124 
125 #endif /* SQUID_PEERDIGEST_H */
126 
StoreEntry * entry
Definition: PeerDigest.h:53
store_client * sc
Definition: PeerDigest.h:55
time_t received
Definition: PeerDigest.h:101
struct PeerDigest::@91 times
void peerDigestNotePeerGone(PeerDigest *pd)
Definition: peer_digest.cc:243
time_t retry_delay
Definition: PeerDigest.h:98
time_t initialized
Definition: PeerDigest.h:95
store_client * old_sc
Definition: PeerDigest.h:56
counter for accumulating byte values
Definition: ByteCounter.h:13
time_t start_time
Definition: PeerDigest.h:60
String host
Definition: PeerDigest.h:84
void peerDigestNeeded(PeerDigest *pd)
Definition: peer_digest.cc:177
char * p
Definition: membanger.c:43
CacheDigest * cd
Definition: PeerDigest.h:83
time_t req_delay
Definition: PeerDigest.h:100
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:89
ByteCounter kbytes
Definition: PeerDigest.h:111
Version const CacheDigestVer
Definition: peer_digest.cc:56
StoreEntry * old_entry
Definition: PeerDigest.h:54
PeerDigest(CachePeer *)
Definition: peer_digest.cc:69
uint32_t mask_offset
Definition: PeerDigest.h:59
bool needed
Definition: PeerDigest.h:88
PeerDigest * pd
Definition: PeerDigest.h:52
CacheDigestGuessStats guess
Definition: PeerDigest.h:106
ssize_t bufofs
Definition: PeerDigest.h:70
#define CBDATA_CLASS(type)
Definition: cbdata.h:302
void peerDigestStatsReport(const PeerDigest *pd, StoreEntry *e)
time_t next_check
Definition: PeerDigest.h:97
time_t disabled
Definition: PeerDigest.h:102
bool usable
Definition: PeerDigest.h:89
short int current
Definition: PeerDigest.h:20
short int reserved_short
Definition: PeerDigest.h:36
digest_read_state_t
Definition: enums.h:194
#define SM_PAGE_SIZE
Definition: defines.h:102
struct PeerDigest::@92::@93 sent
short int required
Definition: PeerDigest.h:21
bool requested
Definition: PeerDigest.h:90
HttpRequest * request
Definition: PeerDigest.h:57
time_t resp_time
Definition: PeerDigest.h:61
char buf[SM_PAGE_SIZE]
Definition: PeerDigest.h:69
const char * req_result
Definition: PeerDigest.h:85
CachePeer * peer
Definition: PeerDigest.h:82
int used_count
Definition: PeerDigest.h:107
struct PeerDigest::@92 stats
void peerDigestCreate(CachePeer *p)
Definition: peer_digest.cc:130
struct PeerDigest::@92::@93 recv
int reserved[32-6]
Definition: PeerDigest.h:37

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors