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
3 // found in the LICENSE file.
5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_
9 #include "base/basictypes.h"
10 #include "base/port.h"
11 #include "net/base/net_export.h"
17 namespace disk_cache
{
19 const uint64 kSimpleInitialMagicNumber
= GG_UINT64_C(0xfcfb6d1ba7725c30);
20 const uint64 kSimpleFinalMagicNumber
= GG_UINT64_C(0xf4fa6f45970d41d8);
21 const uint64 kSimpleSparseRangeMagicNumber
= GG_UINT64_C(0xeb97bf016553676b);
23 // A file containing stream 0 and stream 1 in the Simple cache consists of:
24 // - a SimpleFileHeader.
26 // - the data from stream 1.
27 // - a SimpleFileEOF record for stream 1.
28 // - the data from stream 0.
29 // - a SimpleFileEOF record for stream 0.
31 // A file containing stream 2 in the Simple cache consists of:
32 // - a SimpleFileHeader.
35 // - at the end, a SimpleFileEOF record.
36 static const int kSimpleEntryFileCount
= 2;
37 static const int kSimpleEntryStreamCount
= 3;
39 struct NET_EXPORT_PRIVATE SimpleFileHeader
{
42 uint64 initial_magic_number
;
48 struct NET_EXPORT_PRIVATE SimpleFileEOF
{
50 FLAG_HAS_CRC32
= (1U << 0),
55 uint64 final_magic_number
;
58 // |stream_size| is only used in the EOF record for stream 0.
62 struct SimpleFileSparseRangeHeader
{
63 SimpleFileSparseRangeHeader();
65 uint64 sparse_range_magic_number
;
71 } // namespace disk_cache
73 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_