DfsPackFile: make #getReverseIdx public

The DfsPackFile#getReverseIdx method, which wraps creating a
PackReverseIndex in caching, was package-private. This caused
implementations on top of DfsPackFile to directly instantiate a
PackReverseIndex in cases where it would benefit from caching.

Instead, make #getReverseIdx public so that the caching logic can be
reused by implementations where appropriate.

Change-Id: I4553e514a4ac320bfe2455c00023343ad97f9d15
Signed-off-by: Anna Papitto <annapapitto@google.com>
This commit is contained in:
Anna Papitto 2023-06-27 13:22:20 -07:00
parent 55230e2b95
commit 91b23cc552
1 changed files with 11 additions and 1 deletions

View File

@ -259,7 +259,17 @@ public CommitGraph getCommitGraph(DfsReader ctx) throws IOException {
return commitGraph;
}
PackReverseIndex getReverseIdx(DfsReader ctx) throws IOException {
/**
* Get the PackReverseIndex for this PackFile.
*
* @param ctx
* reader context to support reading from the backing store if
* the index is not already loaded in memory
* @return the PackReverseIndex
* @throws java.io.IOException
* the pack index is not available, or is corrupt
*/
public PackReverseIndex getReverseIdx(DfsReader ctx) throws IOException {
if (reverseIndex != null) {
return reverseIndex;
}