dfs: rename ReftableStack to DfsReftableStack
The functionality in ReftableStack is specific to DFS. Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Change-Id: If6003d104b1ecb0f3ca7e9c3815b233fa0abf077
This commit is contained in:
parent
33dc08c162
commit
d75a6b5d81
|
@ -744,7 +744,7 @@ private void writeReftable(DfsPackDescription pack) throws IOException {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try (ReftableStack stack = ReftableStack.open(ctx, reftablesBefore)) {
|
try (DfsReftableStack stack = DfsReftableStack.open(ctx, reftablesBefore)) {
|
||||||
ReftableCompactor compact = new ReftableCompactor();
|
ReftableCompactor compact = new ReftableCompactor();
|
||||||
compact.addAll(stack.readers());
|
compact.addAll(stack.readers());
|
||||||
compact.setIncludeDeletes(includeDeletes);
|
compact.setIncludeDeletes(includeDeletes);
|
||||||
|
|
|
@ -311,7 +311,7 @@ private void compactReftables(DfsReader ctx) throws IOException {
|
||||||
DfsObjDatabase objdb = repo.getObjectDatabase();
|
DfsObjDatabase objdb = repo.getObjectDatabase();
|
||||||
Collections.sort(srcReftables, objdb.reftableComparator());
|
Collections.sort(srcReftables, objdb.reftableComparator());
|
||||||
|
|
||||||
try (ReftableStack stack = ReftableStack.open(ctx, srcReftables)) {
|
try (DfsReftableStack stack = DfsReftableStack.open(ctx, srcReftables)) {
|
||||||
initOutDesc(objdb);
|
initOutDesc(objdb);
|
||||||
ReftableCompactor compact = new ReftableCompactor();
|
ReftableCompactor compact = new ReftableCompactor();
|
||||||
compact.addAll(stack.readers());
|
compact.addAll(stack.readers());
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class DfsReftableDatabase extends DfsRefDatabase {
|
||||||
|
|
||||||
private DfsReader ctx;
|
private DfsReader ctx;
|
||||||
|
|
||||||
private ReftableStack tableStack;
|
private DfsReftableStack tableStack;
|
||||||
|
|
||||||
private MergedReftable mergedTables;
|
private MergedReftable mergedTables;
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ protected Reftable reader() throws IOException {
|
||||||
* @throws java.io.IOException
|
* @throws java.io.IOException
|
||||||
* if tables cannot be opened.
|
* if tables cannot be opened.
|
||||||
*/
|
*/
|
||||||
protected ReftableStack stack() throws IOException {
|
protected DfsReftableStack stack() throws IOException {
|
||||||
lock.lock();
|
lock.lock();
|
||||||
try {
|
try {
|
||||||
if (tableStack == null) {
|
if (tableStack == null) {
|
||||||
|
@ -181,7 +181,7 @@ protected ReftableStack stack() throws IOException {
|
||||||
if (ctx == null) {
|
if (ctx == null) {
|
||||||
ctx = odb.newReader();
|
ctx = odb.newReader();
|
||||||
}
|
}
|
||||||
tableStack = ReftableStack.open(ctx,
|
tableStack = DfsReftableStack.open(ctx,
|
||||||
Arrays.asList(odb.getReftables()));
|
Arrays.asList(odb.getReftables()));
|
||||||
}
|
}
|
||||||
return tableStack;
|
return tableStack;
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
* Tracks multiple open
|
* Tracks multiple open
|
||||||
* {@link org.eclipse.jgit.internal.storage.reftable.Reftable} instances.
|
* {@link org.eclipse.jgit.internal.storage.reftable.Reftable} instances.
|
||||||
*/
|
*/
|
||||||
public class ReftableStack implements AutoCloseable {
|
public class DfsReftableStack implements AutoCloseable {
|
||||||
/**
|
/**
|
||||||
* Opens a stack of tables for reading.
|
* Opens a stack of tables for reading.
|
||||||
*
|
*
|
||||||
|
@ -67,9 +67,9 @@ public class ReftableStack implements AutoCloseable {
|
||||||
* @throws java.io.IOException
|
* @throws java.io.IOException
|
||||||
* a table could not be opened
|
* a table could not be opened
|
||||||
*/
|
*/
|
||||||
public static ReftableStack open(DfsReader ctx, List<DfsReftable> files)
|
public static DfsReftableStack open(DfsReader ctx, List<DfsReftable> files)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ReftableStack stack = new ReftableStack(files.size());
|
DfsReftableStack stack = new DfsReftableStack(files.size());
|
||||||
boolean close = true;
|
boolean close = true;
|
||||||
try {
|
try {
|
||||||
for (DfsReftable t : files) {
|
for (DfsReftable t : files) {
|
||||||
|
@ -88,7 +88,7 @@ public static ReftableStack open(DfsReader ctx, List<DfsReftable> files)
|
||||||
private final List<DfsReftable> files;
|
private final List<DfsReftable> files;
|
||||||
private final List<Reftable> tables;
|
private final List<Reftable> tables;
|
||||||
|
|
||||||
private ReftableStack(int tableCnt) {
|
private DfsReftableStack(int tableCnt) {
|
||||||
this.files = new ArrayList<>(tableCnt);
|
this.files = new ArrayList<>(tableCnt);
|
||||||
this.tables = new ArrayList<>(tableCnt);
|
this.tables = new ArrayList<>(tableCnt);
|
||||||
}
|
}
|
|
@ -405,7 +405,7 @@ private long nextUpdateIndex() throws IOException {
|
||||||
|
|
||||||
private boolean canCompactTopOfStack(ReftableConfig cfg)
|
private boolean canCompactTopOfStack(ReftableConfig cfg)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
ReftableStack stack = refdb.stack();
|
DfsReftableStack stack = refdb.stack();
|
||||||
List<Reftable> readers = stack.readers();
|
List<Reftable> readers = stack.readers();
|
||||||
if (readers.isEmpty()) {
|
if (readers.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue