Search in sources :

Example 1 with Writer

use of org.sirix.io.Writer 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

Writer (org.sirix.io.Writer)1 UberPage (org.sirix.page.UberPage)1