object-store: factor out odb_loose_cache()

Add and use a function for loading the entries of a loose object
subdirectory for a given object ID.  It frees callers from deriving the
fanout key; they can use the returned oid_array reference for lookups or
forward range scans.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2019-01-06 17:45:30 +01:00
committed by Junio C Hamano
parent ecbdaf0899
commit 0000d6543f
3 changed files with 21 additions and 8 deletions

View File

@ -54,6 +54,13 @@ void add_to_alternates_memory(const char *dir);
*/
void odb_load_loose_cache(struct object_directory *odb, int subdir_nr);
/*
* Populate and return the loose object cache array corresponding to the
* given object ID.
*/
struct oid_array *odb_loose_cache(struct object_directory *odb,
const struct object_id *oid);
struct packed_git {
struct packed_git *next;
struct list_head mru;