Search in sources :

Example 11 with UberPage

use of org.sirix.page.UberPage in project sirix by sirixdb.

the class XdmResourceManager method createPageWriteTransaction.

/**
 * Create a new {@link PageWriteTrx}.
 *
 * @param id the transaction ID
 * @param representRevision the revision which is represented
 * @param storeRevision the revision which is stored
 * @param abort determines if a transaction must be aborted (rollback) or not
 * @return a new {@link PageWriteTrx} instance
 */
PageWriteTrx<Long, Record, UnorderedKeyValuePage> createPageWriteTransaction(@Nonnegative final long id, @Nonnegative final int representRevision, @Nonnegative final int storeRevision, final Abort abort) {
    checkArgument(id >= 0, "id must be >= 0!");
    checkArgument(representRevision >= 0, "representRevision must be >= 0!");
    checkArgument(storeRevision >= 0, "storeRevision must be >= 0!");
    final Writer writer = mFac.createWriter();
    final int lastCommitedRev = mLastCommittedUberPage.get().getRevisionNumber();
    final UberPage lastCommitedUberPage = mLastCommittedUberPage.get();
    return new PageWriteTrxImpl(this, abort == Abort.YES && lastCommitedUberPage.isBootstrap() ? new UberPage() : new UberPage(lastCommitedUberPage, representRevision > 0 ? writer.readUberPageReference().getKey() : -1), writer, id, representRevision, storeRevision, lastCommitedRev, mBufferManager);
}
Also used : UberPage(org.sirix.page.UberPage) Writer(org.sirix.io.Writer)

Aggregations

UberPage (org.sirix.page.UberPage)11 PageReference (org.sirix.page.PageReference)6 SirixIOException (org.sirix.exception.SirixIOException)3 IOException (java.io.IOException)2 DatabaseEntry (com.sleepycat.je.DatabaseEntry)1 DatabaseException (com.sleepycat.je.DatabaseException)1 OperationStatus (com.sleepycat.je.OperationStatus)1 FileOutputStream (java.io.FileOutputStream)1 OutputStream (java.io.OutputStream)1 UncheckedIOException (java.io.UncheckedIOException)1 Path (java.nio.file.Path)1 PostCommitHook (org.sirix.api.PostCommitHook)1 PreCommitHook (org.sirix.api.PreCommitHook)1 ResourceManager (org.sirix.api.ResourceManager)1 Reader (org.sirix.io.Reader)1 Storage (org.sirix.io.Storage)1 Writer (org.sirix.io.Writer)1 FileStorage (org.sirix.io.file.FileStorage)1 RAMStorage (org.sirix.io.ram.RAMStorage)1 Record (org.sirix.node.interfaces.Record)1