git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 00/22] cache cursors: an introduction

From
CLChuck Lever <cel@citi.umich.edu>
Date
Sep 12, 2005, 16:37 UTC
Message-ID
<4325AED6.8050401@citi.umich.edu>
In-Reply-To
<4325A0D9.2000806@gmail.com>
A Large Angry SCM wrote:
> Since you are proposing an API, some basic documentation about how to 
> use the API would be nice. Comments in cache.h seems the best place, for 
> now.

actually it might be best to have a list discussion first. if i can answer questions and provide a few explanations here, the list archive might be a reasonable resting place for documentation.

the API is fairly simple and is documented via the function names. there isn't a whole lot of function-level documentation in the git code base that i have seen, so i erred on the side of less is more.

the first patch "introduce-cache-cursors provides most of the interface, and the subsequent patches demonstrate how to use it by changing parts of the git C code base to use the interface instead.

the main pieces are:
+  struct cache_cursor
which describes a position in the cache.
+  init_cc
which sets the given cursor to the top of the cache.
+  cc_to_ce
which extracts the cache entry that a cursor refers to.
+  next_cc, prev_cc, cache_eof
which allow cursor movement.
+  next_name
which skips to the next unique name in the cache.
+  walk_cache

which calls a function for each entry in the cache, in order. the given function is responsible for moving the cursor to the next position before returning.

+  cache_find_name

which returns a cache cursor pointing to the found entry or to the entry which can be used as an insertion point if nothing matches.

+  cache_find_entry

which is a wrapper around cache_find_name that returns an entry instead of a position.

> The sentence "This patch series is against the "proposed updates" 
> branch, as of a couple of days ago." should have also included a commit 
> ID. That way we would know where/when the patches would apply cleanly 
> for testing and dissection.
i'm a dork.
6ae3d6e6d0f87cfa75b4bf213a485ff687defce8
i will include the base ref in my future postings.

begin:vcard fn:Chuck Lever n:Lever;Charles org:Network Appliance, Incorporated;Linux NFS Client Development adr:535 West William Street, Suite 3100;;Center for Information Technology Integration;Ann Arbor;MI;48103-4943;USA email;internet:cel@citi.umich.edu title:Member of Technical Staff tel;work:+1 734 763 4415 tel;fax:+1 734 763 4434 tel;home:+1 734 668 1089 x-mozilla-html:FALSE url:http://www.monkey.org/~cel/ version:2.1 end:vcard

Previous: A Large Angry SCMNext: Daniel Barkalow
Message 36 of 49 in “cache cursors: an introduction”
  1. 00/22 cache cursors: an introductionChuck Lever, Sep 12, 2005
  2. 01/22 introduce facility to walk through the active cacheChuck Lever, Sep 12, 2005
  3. 02/22 use cache iterator in checkout-index.cChuck Lever, Sep 12, 2005
  4. 03/22 teach diff.c about cache iteratorsChuck Lever, Sep 12, 2005
  5. 04/22 teach diff-index.c about cache iteratorsChuck Lever, Sep 12, 2005
  6. 05/22 teach diff-files.c about cache iteratorsChuck Lever, Sep 12, 2005
  7. 06/22 teach diff-stages.c about cache iteratorsChuck Lever, Sep 12, 2005
  8. 07/22 teach fsck-objects.c to use cache iteratorsChuck Lever, Sep 12, 2005
  9. 08/22 teach ls-files.c to use cache iteratorsChuck Lever, Sep 12, 2005
  10. 09/22 teach read-tree.c to use cache iteratorsChuck Lever, Sep 12, 2005
  11. 10/22 teach update-index.c about cache cursorsChuck Lever, Sep 12, 2005
  12. 11/22 teach write-tree.c to use cache iteratorsChuck Lever, Sep 12, 2005
  13. 12/22 simplify write_cache() calling sequenceChuck Lever, Sep 12, 2005
  14. 13/22 move purge_cache() to read-cache.cChuck Lever, Sep 12, 2005
  15. 14/22 move read_cache_unmerged into read-cache.cChuck Lever, Sep 12, 2005
  16. 15/22 replace cache_name_posChuck Lever, Sep 12, 2005
  17. 16/22 teach apply.c to use cache_find_name()Chuck Lever, Sep 12, 2005
  18. 17/22 teach checkout-index.c to use cache_find_name()Chuck Lever, Sep 12, 2005
  19. 18/22 teach diff.c to use cache_find_name()Chuck Lever, Sep 12, 2005
  20. 19/22 teach ls-files.c to use cache_find_name()Chuck Lever, Sep 12, 2005
  21. 20/22 teach merge-index.c to use cache_find_name()Chuck Lever, Sep 12, 2005
  22. 21/22 teach the merge algorithm about cache iteratorsChuck Lever, Sep 12, 2005
  23. Daniel BarkalowSep 12, 2005
  24. Chuck LeverSep 13, 2005
  25. Chuck LeverSep 14, 2005
  26. Daniel BarkalowSep 14, 2005
  27. Junio C HamanoSep 14, 2005
  28. Chuck LeverSep 14, 2005
  29. Daniel BarkalowSep 14, 2005
  30. Chuck LeverSep 14, 2005
  31. Linus TorvaldsSep 14, 2005
  32. Daniel BarkalowSep 14, 2005
  33. Chuck LeverSep 15, 2005
  34. 22/22 teach read-cache.c to use cache_find_name()Chuck Lever, Sep 12, 2005
  35. A Large Angry SCMSep 12, 2005
  36. Chuck LeverSep 12, 2005
  37. Daniel BarkalowSep 12, 2005
  38. Junio C HamanoSep 12, 2005
  39. Tim OttingerSep 13, 2005
  40. Junio C HamanoSep 13, 2005
  41. Tim OttingerSep 13, 2005
  42. Catalin MarinasSep 14, 2005
  43. Chuck LeverSep 14, 2005
  44. Junio C HamanoSep 12, 2005
  45. Daniel BarkalowSep 12, 2005
  46. Junio C HamanoSep 12, 2005
  47. Chuck LeverSep 12, 2005
  48. Junio C HamanoSep 13, 2005
  49. Linus TorvaldsSep 13, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.