Class FileReftableStack
- java.lang.Object
-
- org.eclipse.jgit.internal.storage.file.FileReftableStack
-
- All Implemented Interfaces:
AutoCloseable
public class FileReftableStack extends Object implements AutoCloseable
A mutable stack of reftables on local filesystem storage. Not thread-safe. This is an AutoCloseable because this object owns the file handles to the open reftables.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
FileReftableStack.Writer
Writer is a callable that writes data to a reftable under construction.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addReftable(FileReftableStack.Writer w)
Tries to add a new reftable to the stack.void
close()
MergedReftable
getMergedReftable()
-
-
-
Constructor Detail
-
FileReftableStack
public FileReftableStack(File stackPath, File reftableDir, @Nullable Runnable onChange, Supplier<Config> configSupplier) throws IOException
Creates a stack corresponding to the list of reftables in the argument- Parameters:
stackPath
- the filename for the stack.reftableDir
- the dir holding the tables.onChange
- hook to call if we notice a new writeconfigSupplier
- Config supplier- Throws:
IOException
- on I/O problems
-
-
Method Detail
-
getMergedReftable
public MergedReftable getMergedReftable()
- Returns:
- the merged reftable
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
-
addReftable
public boolean addReftable(FileReftableStack.Writer w) throws IOException
Tries to add a new reftable to the stack. Returns true if it succeeded, or false if there was a lock failure, due to races with other processes. This is package private so FileReftableDatabase can call into here.- Parameters:
w
- writer to write data to a reftable under construction- Returns:
- true if the transaction was successful.
- Throws:
IOException
- on I/O problems
-
-