diff options
author | Anna Papitto <annapapitto@google.com> | 2022-11-11 10:44:37 -0800 |
---|---|---|
committer | Ivan Frade <ifrade@google.com> | 2022-11-17 12:38:36 -0500 |
commit | accacc27a1b282c55e5ee92e69566a9edd1a4bb9 (patch) | |
tree | 58cca0de14fcf09ab0597b93e97b96a5737aeffc /org.eclipse.jgit | |
parent | 5c033a98f62e8959aaf6c4d2c8ba87c3d890a5c4 (diff) | |
download | jgit-accacc27a1b282c55e5ee92e69566a9edd1a4bb9.tar.gz jgit-accacc27a1b282c55e5ee92e69566a9edd1a4bb9.zip |
DfsStreamKey: Replace ForReverseIndex to separate metrics.
Keys used for identifying reverse indexes in the DfsBlockCache use a
custom subclass ForReverseIndex because there was no PackExt for them.
This conflates BlockCacheMetrics for reverse indexes with those for
packs, since the key falls back onto 0 when there is no extension.
Replace the custom ForReverseIndex with a DfsStreamKey usage to bring
keys for the new REVERSE_INDEX extension in line with INDEX and BITMAP
and separate reverse index and pack BlockCacheMetrics.
Change-Id: I305e2c16d2a8cb2a824855ea92e0c9a9b188fce5
Signed-off-by: Anna Papitto <annapapitto@google.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java | 4 | ||||
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java | 15 |
2 files changed, 2 insertions, 17 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java index f7a2c94d48..15511fed30 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsPackFile.java @@ -16,6 +16,7 @@ import static org.eclipse.jgit.internal.storage.dfs.DfsObjDatabase.PackSource.UN import static org.eclipse.jgit.internal.storage.pack.PackExt.BITMAP_INDEX; import static org.eclipse.jgit.internal.storage.pack.PackExt.INDEX; import static org.eclipse.jgit.internal.storage.pack.PackExt.PACK; +import static org.eclipse.jgit.internal.storage.pack.PackExt.REVERSE_INDEX; import java.io.BufferedInputStream; import java.io.EOFException; @@ -220,8 +221,7 @@ public final class DfsPackFile extends BlockBasedFile { } PackIndex idx = idx(ctx); - DfsStreamKey revKey = new DfsStreamKey.ForReverseIndex( - desc.getStreamKey(INDEX)); + DfsStreamKey revKey = desc.getStreamKey(REVERSE_INDEX); AtomicBoolean cacheHit = new AtomicBoolean(true); DfsBlockCache.Ref<PackReverseIndex> revref = cache.getOrLoadRef(revKey, REF_POSITION, () -> { diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java index 4a6723f830..f3f30914f6 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/dfs/DfsStreamKey.java @@ -95,19 +95,4 @@ public abstract class DfsStreamKey { return false; } } - - static final class ForReverseIndex extends DfsStreamKey { - private final DfsStreamKey idxKey; - - ForReverseIndex(DfsStreamKey idxKey) { - super(idxKey.hash + 1, null); - this.idxKey = idxKey; - } - - @Override - public boolean equals(Object o) { - return o instanceof ForReverseIndex - && idxKey.equals(((ForReverseIndex) o).idxKey); - } - } } |