Class 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.
    • 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 write
        configSupplier - Config supplier
        Throws:
        IOException - on I/O problems
    • Method Detail

      • getMergedReftable

        public MergedReftable getMergedReftable()
        Returns:
        the merged reftable
      • 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