]> git.ipfire.org Git - thirdparty/squid.git/blob - src/CacheDigest.h
Merge cleanups branch: split most of typedefs.h
[thirdparty/squid.git] / src / CacheDigest.h
1 /*
2 * Copyright (C) 1996-2015 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 70 Cache Digest */
10
11 #ifndef SQUID_CACHEDIGEST_H_
12 #define SQUID_CACHEDIGEST_H_
13
14 #include "store_key_md5.h"
15
16 class CacheDigestGuessStats;
17 class StoreEntry;
18
19 // currently a POD
20 class CacheDigest
21 {
22 public:
23 /* public, read-only */
24 char *mask; /* bit mask */
25 int mask_size; /* mask size in bytes */
26 int capacity; /* expected maximum for .count, not a hard limit */
27 int bits_per_entry; /* number of bits allocated for each entry from capacity */
28 int count; /* number of digested entries */
29 int del_count; /* number of deletions performed so far */
30 };
31
32 CacheDigest *cacheDigestCreate(int capacity, int bpe);
33 void cacheDigestDestroy(CacheDigest * cd);
34 CacheDigest *cacheDigestClone(const CacheDigest * cd);
35 void cacheDigestClear(CacheDigest * cd);
36 void cacheDigestChangeCap(CacheDigest * cd, int new_cap);
37 int cacheDigestTest(const CacheDigest * cd, const cache_key * key);
38 void cacheDigestAdd(CacheDigest * cd, const cache_key * key);
39 void cacheDigestDel(CacheDigest * cd, const cache_key * key);
40 size_t cacheDigestCalcMaskSize(int cap, int bpe);
41 int cacheDigestBitUtil(const CacheDigest * cd);
42 void cacheDigestGuessStatsUpdate(CacheDigestGuessStats * stats, int real_hit, int guess_hit);
43 void cacheDigestGuessStatsReport(const CacheDigestGuessStats * stats, StoreEntry * sentry, const char *label);
44 void cacheDigestReport(CacheDigest * cd, const char *label, StoreEntry * e);
45
46 #endif /* SQUID_CACHEDIGEST_H_ */
47