OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ | 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ |
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ | 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 class Time; | 13 class Time; |
14 } | 14 } |
15 | 15 |
16 namespace disk_cache { | 16 namespace disk_cache { |
17 | 17 |
18 const uint64_t kSimpleInitialMagicNumber = UINT64_C(0xfcfb6d1ba7725c30); | 18 const uint64_t kSimpleInitialMagicNumber = UINT64_C(0xfcfb6d1ba7725c30); |
19 const uint64_t kSimpleFinalMagicNumber = UINT64_C(0xf4fa6f45970d41d8); | 19 const uint64_t kSimpleFinalMagicNumber = UINT64_C(0xf4fa6f45970d41d8); |
20 const uint64_t kSimpleSparseRangeMagicNumber = UINT64_C(0xeb97bf016553676b); | 20 const uint64_t kSimpleSparseRangeMagicNumber = UINT64_C(0xeb97bf016553676b); |
21 | 21 |
22 // The magic number for SimpleEntryVersion 5 | |
23 | |
22 // A file containing stream 0 and stream 1 in the Simple cache consists of: | 24 // A file containing stream 0 and stream 1 in the Simple cache consists of: |
23 // - a SimpleFileHeader. | 25 // - a SimpleFileHeader. |
24 // - the key. | 26 // - the key. |
25 // - the data from stream 1. | 27 // - the data from stream 1. |
26 // - a SimpleFileEOF record for stream 1. | 28 // - a SimpleFileEOF record for stream 1. |
27 // - the data from stream 0. | 29 // - the data from stream 0. |
28 // - a SimpleFileEOF record for stream 0. | 30 // - a SimpleFileEOF record for stream 0. |
Randy Smith (Not in Mondays)
2016/05/19 19:38:49
Update the comment by noting the possible suffix o
gavinp
2016/05/20 01:42:31
Done.
| |
29 | 31 |
30 // A file containing stream 2 in the Simple cache consists of: | 32 // A file containing stream 2 in the Simple cache consists of: |
31 // - a SimpleFileHeader. | 33 // - a SimpleFileHeader. |
32 // - the key. | 34 // - the key. |
33 // - the data. | 35 // - the data. |
34 // - at the end, a SimpleFileEOF record. | 36 // - at the end, a SimpleFileEOF record. |
35 static const int kSimpleEntryFileCount = 2; | 37 static const int kSimpleEntryFileCount = 2; |
36 static const int kSimpleEntryStreamCount = 3; | 38 static const int kSimpleEntryStreamCount = 3; |
37 | 39 |
38 struct NET_EXPORT_PRIVATE SimpleFileHeader { | 40 struct NET_EXPORT_PRIVATE SimpleFileHeader { |
39 SimpleFileHeader(); | 41 SimpleFileHeader(); |
40 | 42 |
41 uint64_t initial_magic_number; | 43 uint64_t initial_magic_number; |
42 uint32_t version; | 44 uint32_t version; |
43 uint32_t key_length; | 45 uint32_t key_length; |
44 uint32_t key_hash; | 46 uint32_t key_hash; |
45 }; | 47 }; |
46 | 48 |
47 struct NET_EXPORT_PRIVATE SimpleFileEOF { | 49 struct NET_EXPORT_PRIVATE SimpleFileEOF { |
48 enum Flags { | 50 enum Flags { |
49 FLAG_HAS_CRC32 = (1U << 0), | 51 FLAG_HAS_CRC32 = (1U << 0), |
52 FLAG_HAS_KEY_SHA256 = (2U << 1), | |
50 }; | 53 }; |
51 | 54 |
52 SimpleFileEOF(); | 55 SimpleFileEOF(); |
53 | 56 |
54 uint64_t final_magic_number; | 57 uint64_t final_magic_number; |
55 uint32_t flags; | 58 uint32_t flags; |
56 uint32_t data_crc32; | 59 uint32_t data_crc32; |
57 // |stream_size| is only used in the EOF record for stream 0. | 60 // |stream_size| is only used in the EOF record for stream 0. |
58 uint32_t stream_size; | 61 uint32_t stream_size; |
59 }; | 62 }; |
60 | 63 |
61 struct SimpleFileSparseRangeHeader { | 64 struct SimpleFileSparseRangeHeader { |
62 SimpleFileSparseRangeHeader(); | 65 SimpleFileSparseRangeHeader(); |
63 | 66 |
64 uint64_t sparse_range_magic_number; | 67 uint64_t sparse_range_magic_number; |
65 int64_t offset; | 68 int64_t offset; |
66 int64_t length; | 69 int64_t length; |
67 uint32_t data_crc32; | 70 uint32_t data_crc32; |
68 }; | 71 }; |
69 | 72 |
70 } // namespace disk_cache | 73 } // namespace disk_cache |
71 | 74 |
72 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ | 75 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_ |
OLD | NEW |