@Test public void testSetData() throws TTException { final IBucketWriteTrx wtx = mHolder.getSession().beginBucketWtx(); final int elementsToSet = 16385; final int versionToWrite = 10; final List<DumbData> datas = new ArrayList<DumbData>(); for (int i = 0; i < elementsToSet; i++) { long dataKey = wtx.incrementDataKey(); DumbData data = CoreTestHelper.generateOne(); data.setDataKey(dataKey); datas.add(data); if (i == 0) { assertNull(wtx.getData(dataKey)); } else { try { wtx.getData(dataKey); fail(); } catch (NullPointerException | IllegalStateException exc) { } } wtx.setData(datas.get(i)); assertEquals(datas.get(i), wtx.getData(dataKey)); } wtx.commit(); int numbersToAdapt = 16; for (int j = 0; j < versionToWrite; j++) { for (int i = 0; i < elementsToSet; i++) { assertEquals(new StringBuilder("Datas differ in version ") .append(j).append(" and data ").append(i).toString(), datas.get(i), wtx.getData(i)); if (i % numbersToAdapt == 0) { DumbData data = CoreTestHelper.generateOne(); data.setDataKey(i); datas.set(i, data); wtx.setData(datas.get(i)); assertEquals(datas.get(i), wtx.getData(i)); } } CoreTestHelper.checkStructure(datas, wtx, 0); wtx.commit(); CoreTestHelper.checkStructure(datas, wtx, 0); numbersToAdapt++; } final IBucketReadTrx rtx = mHolder.getSession().beginBucketRtx( mHolder.getSession().getMostRecentVersion()); CoreTestHelper.checkStructure(datas, rtx, 0); CoreTestHelper.checkStructure(datas, wtx, 0); }
public long setData(final IData pData) throws TTException { checkState(!mDelegate.isClosed(), "Transaction already closed"); final long dataKey = pData.getDataKey(); final long seqBucketKey = dataKey >> IConstants.INDIRECT_BUCKET_COUNT[3]; final int dataBucketOffset = dataBucketOffset(dataKey); final LogValue container = prepareDataBucket(dataKey); final DataBucket modified = ((DataBucket)container.getModified()); final DataBucket complete = ((DataBucket)container.getComplete()); modified.setData(dataBucketOffset, pData); complete.setData(dataBucketOffset, pData); mLog.put(new LogKey(false, IConstants.INDIRECT_BUCKET_COUNT.length, seqBucketKey), container); return dataKey; }
BucketWriteTrx implements IBucketWriteTrx { public long setData(final IData pData) throws TTException { checkState(!mDelegate.isClosed(), "Transaction already closed"); final long dataKey = pData.getDataKey(); final long seqBucketKey = dataKey >> IConstants.INDIRECT_BUCKET_COUNT[3]; final int dataBucketOffset = dataBucketOffset(dataKey); final LogValue container = prepareDataBucket(dataKey); final DataBucket modified = ((DataBucket)container.getModified()); final DataBucket complete = ((DataBucket)container.getComplete()); modified.setData(dataBucketOffset, pData); complete.setData(dataBucketOffset, pData); mLog.put(new LogKey(false, IConstants.INDIRECT_BUCKET_COUNT.length, seqBucketKey), container); return dataKey; } }
BucketWriteTrx implements IBucketWriteTrx { public long setData(final IData pData) throws TTException { checkState(!mDelegate.isClosed(), "Transaction already closed"); final long dataKey = pData.getDataKey(); final long seqBucketKey = dataKey >> IConstants.INDIRECT_BUCKET_COUNT[3]; final int dataBucketOffset = dataBucketOffset(dataKey); final LogValue container = prepareDataBucket(dataKey); final DataBucket modified = ((DataBucket)container.getModified()); final DataBucket complete = ((DataBucket)container.getComplete()); modified.setData(dataBucketOffset, pData); complete.setData(dataBucketOffset, pData); mLog.put(new LogKey(false, IConstants.INDIRECT_BUCKET_COUNT.length, seqBucketKey), container); return dataKey; } protected  BucketWriteTrx(final ISession pSession, final UberBucket pUberBucket,
        final IBackendWriter pWriter, final long pRepresentRev); }
BucketWriteTrx implements IBucketWriteTrx { public long setData(final IData pData) throws TTException { checkState(!mDelegate.isClosed(), "Transaction already closed"); final long dataKey = pData.getDataKey(); final long seqBucketKey = dataKey >> IConstants.INDIRECT_BUCKET_COUNT[3]; final int dataBucketOffset = dataBucketOffset(dataKey); final LogValue container = prepareDataBucket(dataKey); final DataBucket modified = ((DataBucket)container.getModified()); final DataBucket complete = ((DataBucket)container.getComplete()); modified.setData(dataBucketOffset, pData); complete.setData(dataBucketOffset, pData); mLog.put(new LogKey(false, IConstants.INDIRECT_BUCKET_COUNT.length, seqBucketKey), container); return dataKey; } protected  BucketWriteTrx(final ISession pSession, final UberBucket pUberBucket,
        final IBackendWriter pWriter, final long pRepresentRev); long setData(final IData pData); @Override void removeData(final IData pData); IData getData(final long pDataKey); @Override void commit(); @Override void commitBlocked(); void clearLog(); @Override boolean close(); @Override long incrementDataKey(); @Override long getRevision(); @Override boolean isClosed(); @Override MetaBucket getMetaBucket(); @Override String toString(); }
BucketWriteTrx implements IBucketWriteTrx { public long setData(final IData pData) throws TTException { checkState(!mDelegate.isClosed(), "Transaction already closed"); final long dataKey = pData.getDataKey(); final long seqBucketKey = dataKey >> IConstants.INDIRECT_BUCKET_COUNT[3]; final int dataBucketOffset = dataBucketOffset(dataKey); final LogValue container = prepareDataBucket(dataKey); final DataBucket modified = ((DataBucket)container.getModified()); final DataBucket complete = ((DataBucket)container.getComplete()); modified.setData(dataBucketOffset, pData); complete.setData(dataBucketOffset, pData); mLog.put(new LogKey(false, IConstants.INDIRECT_BUCKET_COUNT.length, seqBucketKey), container); return dataKey; } protected  BucketWriteTrx(final ISession pSession, final UberBucket pUberBucket,
        final IBackendWriter pWriter, final long pRepresentRev); long setData(final IData pData); @Override void removeData(final IData pData); IData getData(final long pDataKey); @Override void commit(); @Override void commitBlocked(); void clearLog(); @Override boolean close(); @Override long incrementDataKey(); @Override long getRevision(); @Override boolean isClosed(); @Override MetaBucket getMetaBucket(); @Override String toString();  }