From 7d4e3a8bef1d62195eea2a4190a626a058bf5f23 Mon Sep 17 00:00:00 2001 From: "rvargas@google.com" Date: Thu, 9 Jul 2009 22:01:29 +0000 Subject: Disk cache: Add explicit support for eviction / deletion of sparse entries. I started to add code to modify the children_map of the parent entry when a child is evicted but that ended up being too much trouble for too little gain. We have to be prepared to handle the case of not finding a child entry because there is no way to make sure that the process doesn't go away at any time, so adding a lot of complexity just to avoid an extra entry lookup is just not worth it. On the other hand, potentially freeing up a lot of space when a sparse entry is deleted (insetad of just waiting for the eviction code to do the cleanup) seems like a good thing. BUG=12258 TEST=unittest Review URL: http://codereview.chromium.org/149306 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20325 0039d316-1c4b-4281-b951-d872f2087c98 --- net/disk_cache/disk_format.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'net/disk_cache/disk_format.h') diff --git a/net/disk_cache/disk_format.h b/net/disk_cache/disk_format.h index d1f7fed..c98fc34 100644 --- a/net/disk_cache/disk_format.h +++ b/net/disk_cache/disk_format.h @@ -123,7 +123,8 @@ struct EntryStore { CacheAddr long_key; // Optional address of a long key. int32 data_size[4]; // We can store up to 4 data streams for each CacheAddr data_addr[4]; // entry. - int32 pad[6]; + uint32 flags; // Any combination of EntryFlags. + int32 pad[5]; char key[256 - 24 * 4]; // null terminated }; @@ -138,6 +139,12 @@ enum EntryState { ENTRY_DOOMED // The entry was doomed. }; +// Flags that can be applied to an entry. +enum EntryFlags { + PARENT_ENTRY = 1, // This entry has children (sparse) entries. + CHILD_ENTRY = 1 << 1 // Child entry that stores sparse data. +}; + #pragma pack(push, 4) // Rankings information for a given entry. struct RankingsNode { -- cgit v1.1