// The structure of the whole index file.
struct Index {
  IndexHeader header;
  CacheAddr   table[kIndexTablesize];  // Default size. Actual size
controlled
                                       // by header.table_len.
};

A given entry on the cache is identified by its key (the name of the
resource). A 32-bit hash is generated from the key. The low order bits of
the hash are used to index the actual table (usually 16 bits), and the value
stored on the table is just a "cache address" that indicates if the entry is
actually part of the cache, and where to find it. The entry itself is not
located on the index file.

The function that I mention before performs the last part of the lookup:
once you have the CacheAddr for the entry that you're looking for, it reads
the entry from the appropriate place. The external interface of the cache is
located on net/disk_cache/disk_cache.h, and it is implemented on
net/disk_cache/backend_impl.cc.   The basic methods to locate an entry
are OpenEntry and CreateEntry, but of course they assume that you know what
you are looking for (require a key). Through them you can see how the index
file is used.

If you don't know what you're looking for, OpenNextEntry is the method to
use, but following that code is harder to see what the index file is doing.


On Mon, Oct 6, 2008 at 11:48 PM, Mils Dz <[EMAIL PROTECTED]> wrote:

>
> M. Ricardo thanks for your hints
> I still don't know what is the index file used for if it's not filled !
> I read index is a hash table that map all cache enties... confusing
>
> 2008/10/6 Ricardo Vargas <[EMAIL PROTECTED]>:
> > The cache stores whatever comes over the wire, so if the server is using
> > compression, the data will be compressed.
> > From your page, the following resources are cached:
> > http://rafb.net/nopaste_favicon.gif
> > http://rafb.net/styles/nopaste_print.css
> > http://rafb.net/styles/nopaste.css
> > http://rafb.net/p/S3NMeh91.html
> > However, your code is attempting to read the entries right after the
> index
> > header (from the same file), and that is not the case. The entries
> > themselves are stored on data_xx files (you'll have to read from data_1
> to
> > see EntryStore structures).
> > You can see code that reads an entry from disk on
> BackendImpl::NewEntry(),
> > (net/disk_cache/backend_impl.cc). After that, EntryImpl::ReadData()
> > (net/disk_cache/entry_impl.cc) is used to read the two chunks of data
> that
> > you see when you use view_cache. See net/disk_cache/addr.h to understand
> > what a cache address means.
> > On Mon, Oct 6, 2008 at 5:23 AM, Mils Dz <[EMAIL PROTECTED]> wrote:
> >>
> >> Hi back.
> >>
> >> Well guys there's something I don't understand !
> >> I initialized a cache, and then visited a simple web page, 3 entries
> >> has been added to that cache (tested with cache viewer).
> >> Now I'm supposed to find 1 entry referencing the page in the index
> >> file but I'm getting nothing ôO
> >> When I read the index header I find "3" for the "num_entries" field,
> >> but I only find 0 values...
> >> here's my test app: http://rafb.net/p/S3NMeh91.html
> >>
> >> Am I missing something ?
> >> Thank you
> >>
> >> 2008/10/4 Mils Dz <[EMAIL PROTECTED]>:
> >> > Ahhhh didn't thought about this.
> >> > Thank you :-)
> >> >
> >> > And some hints about funtions used to write down cache info?
> >> > Thanks :)
> >> >
> >> > 2008/10/4 Den Molib <[EMAIL PROTECTED]>:
> >> >>
> >> >> Mils Dz wrote:
> >> >>> Guys. I'm very sorry I reread the comments and now I know why it
> >> >>> creates those f_XXX files ...etc
> >> >>> But still confused about the Bin/txt modes.
> >> >>>
> >> >>> Cheers
> >> >> Maybe they're stored compressed if compression was used by the server
> >> >> to
> >> >> transmit?
> >> >>
> >> >> >>
> >> >>
> >> >
> >> >
> >> >
> >> > --
> >> > www.auresdev.org
> >> > Free and open source project
> >> >
> >>
> >>
> >>
> >> --
> >> www.auresdev.org
> >> Free and open source project
> >>
> >>
> >
> >
> > >
> >
>
>
>
> --
> www.auresdev.org
> Free and open source project
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-dev" group.
To post to this group, send email to chromium-dev@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/chromium-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to