1 // Copyright 2013 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_HISTORY_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_HISTORY_H_ 7 8 #include <stdint.h> 9 10 #include "net/base/net_export.h" 11 12 namespace disk_cache::simplecache_v5 { 13 14 const uint64_t kSimpleInitialMagicNumber = UINT64_C(0xfcfb6d1ba7725c30); 15 const uint64_t kSimpleFinalMagicNumber = UINT64_C(0xf4fa6f45970d41d8); 16 17 // A file containing stream 0 and stream 1 in the Simple cache consists of: 18 // - a SimpleFileHeader. 19 // - the key. 20 // - the data from stream 1. 21 // - a SimpleFileEOF record for stream 1. 22 // - the data from stream 0. 23 // - a SimpleFileEOF record for stream 0. 24 25 // A file containing stream 2 in the Simple cache consists of: 26 // - a SimpleFileHeader. 27 // - the key. 28 // - the data. 29 // - at the end, a SimpleFileEOF record. 30 static const int kSimpleEntryFileCount = 2; 31 static const int kSimpleEntryStreamCount = 3; 32 33 struct NET_EXPORT_PRIVATE SimpleFileHeader { 34 SimpleFileHeader(); 35 36 uint64_t initial_magic_number; 37 uint32_t version; 38 uint32_t key_length; 39 uint32_t key_hash; 40 }; 41 42 struct NET_EXPORT_PRIVATE SimpleFileEOF { 43 enum Flags { 44 FLAG_HAS_CRC32 = (1U << 0), 45 }; 46 47 SimpleFileEOF(); 48 49 uint64_t final_magic_number; 50 uint32_t flags; 51 uint32_t data_crc32; 52 // |stream_size| is only used in the EOF record for stream 0. 53 uint32_t stream_size; 54 }; 55 56 } // namespace disk_cache::simplecache_v5 57 58 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_HISTORY_H_ 59