]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/StoreMeta.h
f47aef03e98b18adcc20dd7b05b4ce0c9df05478
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_TYPELENGTHVALUE_H
10 #define SQUID_TYPELENGTHVALUE_H
15 typedef class StoreMeta tlv
;
19 \todo AYJ: for critical lists like this we should use A=64,B=65 etc to enforce and reserve values.
20 \note NOTE! We must preserve the order of this list!
22 \section StoreSwapMeta Store "swap meta" Description
24 * "swap meta" refers to a section of meta data stored at the beginning
25 * of an object that is stored on disk. This meta data includes information
26 * such as the object's cache key (MD5), URL, and part of the StoreEntry
30 * The meta data is stored using a TYPE-LENGTH-VALUE format. That is,
31 * each chunk of meta information consists of a TYPE identifier, a
32 * LENGTH field, and then the VALUE (which is LENGTH octets long).
36 * Just a placeholder for the zeroth value. It is never used on disk.
42 * This represents the case when we use the URL as the cache
43 * key, as Squid-1.1 does. Currently we don't support using
44 * a URL as a cache key, so this is not used.
50 * For a brief time we considered supporting SHA (secure
51 * hash algorithm) as a cache key. Nobody liked it, and
52 * this type is not currently used.
57 * This represents the MD5 cache key that Squid currently uses.
58 * When Squid opens a disk file for reading, it can check that
59 * this MD5 matches the MD5 of the user's request. If not, then
60 * something went wrong and this is probably the wrong object.
65 * The object's URL. This also may be matched against a user's
66 * request for cache hits to make sure we got the right object.
71 * This is the "standard metadata" for an object.
72 * Really its just this middle chunk of the StoreEntry structure:
78 uint64_t swap_file_sz;
86 * Reserved for future hit-metering (RFC 2227) stuff
88 STORE_META_HITMETERING
,
90 /// \todo DOCS: document.
94 * Stores Vary request headers
96 STORE_META_VARY_HEADERS
,
99 * Updated version of STORE_META_STD, with support for >2GB objects.
100 * As STORE_META_STD except that the swap_file_sz is a 64-bit integer instead of 32-bit.
106 STORE_META_STOREURL
, /* the store url, if different to the normal URL */
107 STORE_META_VARY_ID
, /* Unique ID linking variants */
111 /// \ingroup SwapStoreAPI
115 static bool validType(char);
116 static int const MaximumTLVLength
;
117 static int const MinimumTLVLength
;
118 static StoreMeta
*Factory(char type
, size_t len
, void const *value
);
119 static StoreMeta
**Add(StoreMeta
**tail
, StoreMeta
*aNode
);
120 static void FreeList(StoreMeta
**head
);
122 virtual char getType() const = 0;
123 virtual bool validLength(int) const;
124 virtual bool checkConsistency(StoreEntry
*) const;
125 virtual ~StoreMeta() {}
132 /// \ingroup SwapStoreAPI
133 char *storeSwapMetaPack(tlv
* tlv_list
, int *length
);
134 /// \ingroup SwapStoreAPI
135 tlv
*storeSwapMetaBuild(StoreEntry
* e
);
136 /// \ingroup SwapStoreAPI
137 void storeSwapTLVFree(tlv
* n
);
139 #endif /* SQUID_TYPELENGTHVALUE_H */