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