simple_entry_format_history.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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.
  4. #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_HISTORY_H_
  5. #define NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_HISTORY_H_
  6. #include <stdint.h>
  7. #include "net/base/net_export.h"
  8. namespace disk_cache::simplecache_v5 {
  9. const uint64_t kSimpleInitialMagicNumber = UINT64_C(0xfcfb6d1ba7725c30);
  10. const uint64_t kSimpleFinalMagicNumber = UINT64_C(0xf4fa6f45970d41d8);
  11. // A file containing stream 0 and stream 1 in the Simple cache consists of:
  12. // - a SimpleFileHeader.
  13. // - the key.
  14. // - the data from stream 1.
  15. // - a SimpleFileEOF record for stream 1.
  16. // - the data from stream 0.
  17. // - a SimpleFileEOF record for stream 0.
  18. // A file containing stream 2 in the Simple cache consists of:
  19. // - a SimpleFileHeader.
  20. // - the key.
  21. // - the data.
  22. // - at the end, a SimpleFileEOF record.
  23. static const int kSimpleEntryFileCount = 2;
  24. static const int kSimpleEntryStreamCount = 3;
  25. struct NET_EXPORT_PRIVATE SimpleFileHeader {
  26. SimpleFileHeader();
  27. uint64_t initial_magic_number;
  28. uint32_t version;
  29. uint32_t key_length;
  30. uint32_t key_hash;
  31. };
  32. struct NET_EXPORT_PRIVATE SimpleFileEOF {
  33. enum Flags {
  34. FLAG_HAS_CRC32 = (1U << 0),
  35. };
  36. SimpleFileEOF();
  37. uint64_t final_magic_number;
  38. uint32_t flags;
  39. uint32_t data_crc32;
  40. // |stream_size| is only used in the EOF record for stream 0.
  41. uint32_t stream_size;
  42. };
  43. } // namespace disk_cache::simplecache_v5
  44. #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_ENTRY_FORMAT_HISTORY_H_