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 // For a general description of the files used by the cache see file_format.h. | 5 // For a general description of the files used by the cache see file_format.h. |
6 // | 6 // |
7 // A block file is a file designed to store blocks of data of a given size. It | 7 // A block file is a file designed to store blocks of data of a given size. It |
8 // is able to store data that spans from one to four consecutive "blocks", and | 8 // is able to store data that spans from one to four consecutive "blocks", and |
9 // it grows as needed to store up to approximately 65000 blocks. It has a fixed | 9 // it grows as needed to store up to approximately 65000 blocks. It has a fixed |
10 // size header used for book keeping such as tracking free of blocks on the | 10 // size header used for book keeping such as tracking free of blocks on the |
(...skipping 10 matching lines...) Expand all Loading... |
21 #define NET_DISK_CACHE_DISK_FORMAT_BASE_H_ | 21 #define NET_DISK_CACHE_DISK_FORMAT_BASE_H_ |
22 | 22 |
23 #include "base/basictypes.h" | 23 #include "base/basictypes.h" |
24 #include "net/base/net_export.h" | 24 #include "net/base/net_export.h" |
25 | 25 |
26 namespace disk_cache { | 26 namespace disk_cache { |
27 | 27 |
28 typedef uint32 CacheAddr; | 28 typedef uint32 CacheAddr; |
29 | 29 |
30 const uint32 kBlockVersion2 = 0x20000; // Version 2.0. | 30 const uint32 kBlockVersion2 = 0x20000; // Version 2.0. |
| 31 const uint32 kBlockCurrentVersion = 0x30000; // Version 3.0. |
31 | 32 |
32 const uint32 kBlockMagic = 0xC104CAC3; | 33 const uint32 kBlockMagic = 0xC104CAC3; |
33 const int kBlockHeaderSize = 8192; // Two pages: almost 64k entries | 34 const int kBlockHeaderSize = 8192; // Two pages: almost 64k entries |
34 const int kMaxBlocks = (kBlockHeaderSize - 80) * 8; | 35 const int kMaxBlocks = (kBlockHeaderSize - 80) * 8; |
35 | 36 |
36 // Bitmap to track used blocks on a block-file. | 37 // Bitmap to track used blocks on a block-file. |
37 typedef uint32 AllocBitmap[kMaxBlocks / 32]; | 38 typedef uint32 AllocBitmap[kMaxBlocks / 32]; |
38 | 39 |
39 // A block-file is the file used to store information in blocks (could be | 40 // A block-file is the file used to store information in blocks (could be |
40 // EntryStore blocks, RankingsNode blocks or user-data blocks). | 41 // EntryStore blocks, RankingsNode blocks or user-data blocks). |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 }; | 122 }; |
122 | 123 |
123 // The number of blocks stored by a child entry. | 124 // The number of blocks stored by a child entry. |
124 const int kNumSparseBits = 1024; | 125 const int kNumSparseBits = 1024; |
125 COMPILE_ASSERT(sizeof(SparseData) == sizeof(SparseHeader) + kNumSparseBits / 8, | 126 COMPILE_ASSERT(sizeof(SparseData) == sizeof(SparseHeader) + kNumSparseBits / 8, |
126 Invalid_SparseData_bitmap); | 127 Invalid_SparseData_bitmap); |
127 | 128 |
128 } // namespace disk_cache | 129 } // namespace disk_cache |
129 | 130 |
130 #endif // NET_DISK_CACHE_DISK_FORMAT_BASE_H_ | 131 #endif // NET_DISK_CACHE_DISK_FORMAT_BASE_H_ |
OLD | NEW |