java.lang.Object
org.eclipse.jgit.internal.storage.file.FileReftableStack
- All Implemented Interfaces:
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 ClassesModifier and TypeClassDescriptionstatic interface
Writer is a callable that writes data to a reftable under construction. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Tries to add a new reftable to the stack.void
close()
Get merged reftable
-
Constructor Details
-
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 Details
-
getMergedReftable
Get merged reftable- Returns:
- the merged reftable
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
addReftable
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
-