]> source.dussan.org Git - jgit.git/commit
DfsPackFile: Do not set primery index local ref from cache callback 02/1192802/8
authorIvan Frade <ifrade@google.com>
Tue, 9 Apr 2024 20:25:43 +0000 (13:25 -0700)
committerIvan Frade <ifrade@google.com>
Fri, 28 Jun 2024 21:09:16 +0000 (14:09 -0700)
commite57c52dfb97a70975f05b8bc1bcaf424f46ee7c0
tree6823c62637ab412a8cbd43097ea019e8da3b91e2
parent025ef8dfd9a3437e4c234430ce2a062ddfb01fc9
DfsPackFile: Do not set primery index local ref from cache callback

DfsPackFile assumes the indices are in pack streams, but we would like
to consider other formats and storage. Currently, the local ref in the
DfsPackFile to the index is set in the cache loading callback, which
prevents abstracting the loading.

Reorganize the code so: the loadPackIndex function just parses the bytes
returning a reference and the caller sets the loaded index in the local
ref and DfsBlockCache.

We will follow this pattern with other indices in follow-up
changes. Note that although DfsPackFile is used only in one thread,
the loading in DfsBlockCache can happen from multiple threads
concurrently and we want to keep only one ref around.

Change-Id: Ie99de6c80784225484c0f99c51caa44c6a372c45
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java