OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // The cache is stored on disk as a collection of block-files, plus an index | 5 // The cache is stored on disk as a collection of block-files, plus an index |
6 // plus a collection of external files. | 6 // plus a collection of external files. |
7 // | 7 // |
8 // Any data blob bigger than kMaxBlockSize (disk_cache/addr.h) will be stored in | 8 // Any data blob bigger than kMaxBlockSize (disk_cache/addr.h) will be stored in |
9 // a separate file named f_xxx where x is a hexadecimal number. Shorter data | 9 // a separate file named f_xxx where x is a hexadecimal number. Shorter data |
10 // will be stored as a series of blocks on a block-file. In any case, CacheAddr | 10 // will be stored as a series of blocks on a block-file. In any case, CacheAddr |
(...skipping 24 matching lines...) Expand all Loading... |
35 // The files that store internal information for the cache (blocks and index) | 35 // The files that store internal information for the cache (blocks and index) |
36 // are memory mapped. They have a location that is signaled every time the | 36 // are memory mapped. They have a location that is signaled every time the |
37 // internal structures are modified, so it is possible to detect (most of the | 37 // internal structures are modified, so it is possible to detect (most of the |
38 // time) when the process dies in the middle of an update. There are dedicated | 38 // time) when the process dies in the middle of an update. There are dedicated |
39 // backup files for cache bitmaps, used to detect entries out of date. | 39 // backup files for cache bitmaps, used to detect entries out of date. |
40 // | 40 // |
41 // Although cache files are to be consumed on the same machine that creates | 41 // Although cache files are to be consumed on the same machine that creates |
42 // them, if files are to be moved accross machines, little endian storage is | 42 // them, if files are to be moved accross machines, little endian storage is |
43 // assumed. | 43 // assumed. |
44 | 44 |
45 #ifndef NET_DISK_CACHE_V3_DISK_FORMAT_V3_H_ | 45 #ifndef NET_DISK_CACHE_BLOCKFILE_DISK_FORMAT_V3_H_ |
46 #define NET_DISK_CACHE_V3_DISK_FORMAT_V3_H_ | 46 #define NET_DISK_CACHE_BLOCKFILE_DISK_FORMAT_V3_H_ |
47 | 47 |
48 #include "base/basictypes.h" | 48 #include "base/basictypes.h" |
49 #include "net/disk_cache/disk_format_base.h" | 49 #include "net/disk_cache/blockfile/disk_format_base.h" |
50 | 50 |
51 namespace disk_cache { | 51 namespace disk_cache { |
52 | 52 |
53 const int kBaseTableLen = 0x400; | 53 const int kBaseTableLen = 0x400; |
54 const uint32 kIndexMagicV3 = 0xC103CAC3; | 54 const uint32 kIndexMagicV3 = 0xC103CAC3; |
55 const uint32 kVersion3 = 0x30000; // Version 3.0. | 55 const uint32 kVersion3 = 0x30000; // Version 3.0. |
56 | 56 |
57 // Flags for a given cache. | 57 // Flags for a given cache. |
58 enum CacheFlags { | 58 enum CacheFlags { |
59 SMALL_CACHE = 1 << 0, // See IndexCell. | 59 SMALL_CACHE = 1 << 0, // See IndexCell. |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 uint8 flags; | 236 uint8 flags; |
237 int32 key_len; | 237 int32 key_len; |
238 uint64 last_access_time; | 238 uint64 last_access_time; |
239 uint32 long_hash[5]; | 239 uint32 long_hash[5]; |
240 uint32 self_hash; | 240 uint32 self_hash; |
241 }; | 241 }; |
242 COMPILE_ASSERT(sizeof(ShortEntryRecord) == 48, bad_ShortEntryRecord); | 242 COMPILE_ASSERT(sizeof(ShortEntryRecord) == 48, bad_ShortEntryRecord); |
243 | 243 |
244 } // namespace disk_cache | 244 } // namespace disk_cache |
245 | 245 |
246 #endif // NET_DISK_CACHE_V3_DISK_FORMAT_V3_H_ | 246 #endif // NET_DISK_CACHE_BLOCKFILE_DISK_FORMAT_V3_H_ |
OLD | NEW |