#include <CacheDigest.h>
Public Member Functions | |
CacheDigest (uint64_t capacity, uint8_t bpe) | |
~CacheDigest () | |
CacheDigest * | clone () const |
produce a new identical copy of the digest object More... | |
void | clear () |
reset the digest mask and counters More... | |
void | updateCapacity (uint64_t newCapacity) |
changes mask size to fit newCapacity, resets bits to 0 More... | |
void | add (const cache_key *key) |
void | remove (const cache_key *key) |
bool | contains (const cache_key *key) const |
double | usedMaskPercent () const |
percentage of mask bits which are used More... | |
Static Public Member Functions | |
static uint32_t | CalcMaskSize (uint64_t cap, uint8_t bpe) |
Public Attributes | |
uint64_t | count |
uint64_t | del_count |
uint64_t | capacity |
char * | mask |
uint32_t | mask_size |
int8_t | bits_per_entry |
Private Member Functions | |
MEMPROXY_CLASS (CacheDigest) | |
void | init (uint64_t newCapacity) |
Detailed Description
Definition at line 20 of file CacheDigest.h.
Constructor & Destructor Documentation
◆ CacheDigest()
CacheDigest::CacheDigest | ( | uint64_t | capacity, |
uint8_t | bpe | ||
) |
Definition at line 50 of file CacheDigest.cc.
References assert, SQUID_MD5_DIGEST_LENGTH, and updateCapacity().
Referenced by clone().
◆ ~CacheDigest()
CacheDigest::~CacheDigest | ( | ) |
Definition at line 62 of file CacheDigest.cc.
Member Function Documentation
◆ add()
void CacheDigest::add | ( | const cache_key * | key | ) |
Definition at line 107 of file CacheDigest.cc.
References assert, cacheDigestHashKey(), CBIT_SET, CBIT_TEST, StatCounters::cd, count, StatHist::count(), hashed_keys, mask, StatCounters::on_xition_count, and statCounter.
Referenced by cacheResetDigest(), cacheStore(), and storeDigestAdd().
◆ CalcMaskSize()
|
static |
calculate the size of mask required to digest up to a specified capacity and bitsize.
Definition at line 273 of file CacheDigest.cc.
References assert, and INT_MAX.
Referenced by init(), and peerDigestSetCBlock().
◆ clear()
void CacheDigest::clear | ( | ) |
Definition at line 79 of file CacheDigest.cc.
References count, del_count, mask, and mask_size.
Referenced by storeDigestRebuildResume().
◆ clone()
CacheDigest * CacheDigest::clone | ( | ) | const |
Definition at line 68 of file CacheDigest.cc.
References CacheDigest(), assert, bits_per_entry, capacity, count, del_count, mask, and mask_size.
Referenced by main().
◆ contains()
bool CacheDigest::contains | ( | const cache_key * | key | ) | const |
- Returns
- true if the key belongs to the digest
Definition at line 93 of file CacheDigest.cc.
References assert, cacheDigestHashKey(), CBIT_TEST, hashed_keys, and mask.
Referenced by peerDigestLookup(), storeDigestAdd(), and storeDigestDel().
◆ init()
|
private |
Definition at line 38 of file CacheDigest.cc.
References assert, bits_per_entry, CalcMaskSize(), capacity, debugs, mask, mask_size, and xcalloc().
Referenced by updateCapacity().
◆ MEMPROXY_CLASS()
|
private |
◆ remove()
void CacheDigest::remove | ( | const cache_key * | key | ) |
Definition at line 140 of file CacheDigest.cc.
References assert, and del_count.
Referenced by cachePurge(), and storeDigestDel().
◆ updateCapacity()
void CacheDigest::updateCapacity | ( | uint64_t | newCapacity | ) |
Definition at line 86 of file CacheDigest.cc.
References init(), mask, and safe_free.
Referenced by CacheDigest(), and storeDigestResize().
◆ usedMaskPercent()
double CacheDigest::usedMaskPercent | ( | ) | const |
Definition at line 183 of file CacheDigest.cc.
References cacheDigestStats(), Ping::stats, and xpercent().
Referenced by peerDigestUseful().
Member Data Documentation
◆ bits_per_entry
int8_t CacheDigest::bits_per_entry |
Definition at line 60 of file CacheDigest.h.
Referenced by cacheDigestReport(), clone(), and init().
◆ capacity
uint64_t CacheDigest::capacity |
Definition at line 57 of file CacheDigest.h.
Referenced by cacheDigestReport(), clone(), init(), storeDigestCBlockSwapOut(), and storeDigestResize().
◆ count
uint64_t CacheDigest::count |
Definition at line 55 of file CacheDigest.h.
Referenced by add(), cacheDigestReport(), cacheResetDigest(), clear(), clone(), peerDigestSetCBlock(), and storeDigestCBlockSwapOut().
◆ del_count
uint64_t CacheDigest::del_count |
Definition at line 56 of file CacheDigest.h.
Referenced by cacheDigestReport(), clear(), clone(), peerDigestSetCBlock(), remove(), and storeDigestCBlockSwapOut().
◆ mask
char* CacheDigest::mask |
Definition at line 58 of file CacheDigest.h.
Referenced by ~CacheDigest(), add(), cacheDigestStats(), clear(), clone(), contains(), init(), peerDigestSwapInCBlock(), peerDigestSwapInMask(), storeDigestSwapOutStep(), and updateCapacity().
◆ mask_size
uint32_t CacheDigest::mask_size |
Definition at line 59 of file CacheDigest.h.
Referenced by cacheDigestHashKey(), cacheDigestStats(), clear(), clone(), GetCountersStats(), init(), peerDigestFetchedEnough(), peerDigestSetCBlock(), peerDigestSwapInMask(), storeDigestCBlockSwapOut(), storeDigestRewriteResume(), and storeDigestSwapOutStep().
The documentation for this class was generated from the following files:
- src/CacheDigest.h
- src/CacheDigest.cc
- src/tests/stub_CacheDigest.cc