Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / net / disk_cache / simple / simple_entry_format_history.h
blob89d378b620bfaac6c527cd010cfe13c1a34d461d
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_HISTORY_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_HISTORY_H_
8 #include <stdint.h>
10 #include "base/basictypes.h"
11 #include "net/base/net_export.h"
13 namespace disk_cache {
15 namespace simplecache_v5 {
17 const uint64 kSimpleInitialMagicNumber = UINT64_C(0xfcfb6d1ba7725c30);
18 const uint64 kSimpleFinalMagicNumber = UINT64_C(0xf4fa6f45970d41d8);
20 // A file containing stream 0 and stream 1 in the Simple cache consists of:
21 // - a SimpleFileHeader.
22 // - the key.
23 // - the data from stream 1.
24 // - a SimpleFileEOF record for stream 1.
25 // - the data from stream 0.
26 // - a SimpleFileEOF record for stream 0.
28 // A file containing stream 2 in the Simple cache consists of:
29 // - a SimpleFileHeader.
30 // - the key.
31 // - the data.
32 // - at the end, a SimpleFileEOF record.
33 static const int kSimpleEntryFileCount = 2;
34 static const int kSimpleEntryStreamCount = 3;
36 struct NET_EXPORT_PRIVATE SimpleFileHeader {
37 SimpleFileHeader();
39 uint64 initial_magic_number;
40 uint32 version;
41 uint32 key_length;
42 uint32 key_hash;
45 struct NET_EXPORT_PRIVATE SimpleFileEOF {
46 enum Flags {
47 FLAG_HAS_CRC32 = (1U << 0),
50 SimpleFileEOF();
52 uint64 final_magic_number;
53 uint32 flags;
54 uint32 data_crc32;
55 // |stream_size| is only used in the EOF record for stream 0.
56 uint32 stream_size;
59 } // namespace simplecache_v5
61 } // namespace disk_cache
63 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_HISTORY_H_