001 package org.fusesource.hawtdb.api; 002 003 004 /** 005 * Implemented by objects to provides transactional access 006 * to a page file. 007 * 008 * @author chirino 009 */ 010 public interface TxPageFile { 011 012 /** 013 * Creates a new transaction. 014 * 015 * The transaction object implements the {@link Paged} interface 016 * so it is what allows you access and mutate the page file data. 017 * 018 * @return 019 */ 020 public abstract Transaction tx(); 021 022 /** 023 * Once this method returns, any previously committed transactions 024 * are flushed and to the disk, ensuring that they will not be lost 025 * upon failure. 026 */ 027 public abstract void flush(); 028 029 /** 030 * If the transaction page file is configured to use a worker thread, 031 * then this method performs a non-blocking flush otherwise this 032 * method blocks until the flush is completed. 033 * 034 * The specified runnable is executed once the flush completes. 035 * 036 * @param onComplete 037 */ 038 public void flush(Runnable onComplete); 039 040 }