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.
4
5#ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_
6#define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_
7
8
9#include "base/basictypes.h"
10#include "base/port.h"
11#include "net/base/net_export.h"
12
13namespace base {
14class Time;
15}
16
17namespace disk_cache {
18
19const uint64 kSimpleInitialMagicNumber = GG_UINT64_C(0xfcfb6d1ba7725c30);
20const uint64 kSimpleFinalMagicNumber = GG_UINT64_C(0xf4fa6f45970d41d8);
21
22// A file in the Simple cache consists of a SimpleFileHeader followed
23// by data.
24
25// A file in the Simple cache consists of:
26//   - a SimpleFileHeader.
27//   - the key.
28//   - the data.
29//   - at the end, a SimpleFileEOF record.
30const uint32 kSimpleVersion = 4;
31
32static const int kSimpleEntryFileCount = 3;
33
34struct NET_EXPORT_PRIVATE SimpleFileHeader {
35  SimpleFileHeader();
36
37  uint64 initial_magic_number;
38  uint32 version;
39  uint32 key_length;
40  uint32 key_hash;
41};
42
43struct SimpleFileEOF {
44  enum Flags {
45    FLAG_HAS_CRC32 = (1U << 0),
46  };
47
48  SimpleFileEOF();
49
50  uint64 final_magic_number;
51  uint32 flags;
52  uint32 data_crc32;
53};
54
55}  // namespace disk_cache
56
57#endif  // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_H_
58