]> git.ipfire.org Git - thirdparty/squid.git/blob - src/CacheDigest.h
Merged from trunk
[thirdparty/squid.git] / src / CacheDigest.h
1 #ifndef SQUID_CACHEDIGEST_H_
2 #define SQUID_CACHEDIGEST_H_
3 /*
4 * DEBUG: section 70 Cache Digest
5 * AUTHOR: Alex Rousskov
6 *
7 * SQUID Web Proxy Cache http://www.squid-cache.org/
8 * ----------------------------------------------------------
9 *
10 * Squid is the result of efforts by numerous individuals from
11 * the Internet community; see the CONTRIBUTORS file for full
12 * details. Many organizations have provided support for Squid's
13 * development; see the SPONSORS file for full details. Squid is
14 * Copyrighted (C) 2001 by the Regents of the University of
15 * California; see the COPYRIGHT file for full details. Squid
16 * incorporates software developed and/or copyrighted by other
17 * sources; see the CREDITS file for full details.
18 *
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
32 *
33 */
34
35 /* for cache_key */
36 #include "typedefs.h"
37
38 class CacheDigestGuessStats;
39 class StoreEntry;
40
41 class CacheDigest {
42 public:
43 /* public, read-only */
44 char *mask; /* bit mask */
45 int mask_size; /* mask size in bytes */
46 int capacity; /* expected maximum for .count, not a hard limit */
47 int bits_per_entry; /* number of bits allocated for each entry from capacity */
48 int count; /* number of digested entries */
49 int del_count; /* number of deletions performed so far */
50 };
51
52 extern CacheDigest *cacheDigestCreate(int capacity, int bpe);
53 extern void cacheDigestDestroy(CacheDigest * cd);
54 extern CacheDigest *cacheDigestClone(const CacheDigest * cd);
55 extern void cacheDigestClear(CacheDigest * cd);
56 extern void cacheDigestChangeCap(CacheDigest * cd, int new_cap);
57 extern int cacheDigestTest(const CacheDigest * cd, const cache_key * key);
58 extern void cacheDigestAdd(CacheDigest * cd, const cache_key * key);
59 extern void cacheDigestDel(CacheDigest * cd, const cache_key * key);
60 extern size_t cacheDigestCalcMaskSize(int cap, int bpe);
61 extern int cacheDigestBitUtil(const CacheDigest * cd);
62 extern void cacheDigestGuessStatsUpdate(CacheDigestGuessStats * stats, int real_hit, int guess_hit);
63 extern void cacheDigestGuessStatsReport(const CacheDigestGuessStats * stats, StoreEntry * sentry, const char *label);
64 extern void cacheDigestReport(CacheDigest * cd, const char *label, StoreEntry * e);
65
66 #endif /* SQUID_CACHEDIGEST_H_ */