Class FileReftableStack

  • All Implemented Interfaces:

    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,
                                 Runnable onChange,
                                 Supplier<Config> configSupplier)
                          throws IOException
        Creates a stack corresponding to the list of reftables in the argument
        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
        IOException - on I/O problems
    • Method Detail

      • getMergedReftable

        public MergedReftable getMergedReftable()
        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.
        w - writer to write data to a reftable under construction
        true if the transaction was successful.
        IOException - on I/O problems