@Test public void testTruncate() throws TTException { try { assertTrue(mHolder.getSession().close()); mHolder.getSession().truncate(); fail(); } catch (IllegalStateException exc) { } ISession session = mHolder.getStorage().getSession( new SessionConfiguration(CoreTestHelper.RESOURCENAME, StandardSettings.KEY)); assertTrue(session.truncate()); try { session.truncate(); } catch (IllegalStateException exc) { } }
public boolean truncate() throws TTException { checkState(!mClosed, "Session must be opened to truncate."); waitForRunningCommit(); if (mResourceConfig.mBackend.truncate()) { for (final IBucketReadTrx rtx : mBucketTrxs) { rtx.close(); } mLastCommittedUberBucket = null; mBucketTrxs.clear(); mDatabase.mSessions.remove(mSessionConfig.getResource()); mClosed = true; return IOUtils.recursiveDelete(new File(new File(mDatabase.getLocation(), StorageConfiguration.Paths.Data.getFile().getName()), mSessionConfig.getResource())); } else { return false; } }
Session implements ISession { public boolean truncate() throws TTException { checkState(!mClosed, "Session must be opened to truncate."); waitForRunningCommit(); if (mResourceConfig.mBackend.truncate()) { for (final IBucketReadTrx rtx : mBucketTrxs) { rtx.close(); } mLastCommittedUberBucket = null; mBucketTrxs.clear(); mDatabase.mSessions.remove(mSessionConfig.getResource()); mClosed = true; return IOUtils.recursiveDelete(new File(new File(mDatabase.getLocation(), StorageConfiguration.Paths.Data.getFile().getName()), mSessionConfig.getResource())); } else { return false; } } }
Session implements ISession { public boolean truncate() throws TTException { checkState(!mClosed, "Session must be opened to truncate."); waitForRunningCommit(); if (mResourceConfig.mBackend.truncate()) { for (final IBucketReadTrx rtx : mBucketTrxs) { rtx.close(); } mLastCommittedUberBucket = null; mBucketTrxs.clear(); mDatabase.mSessions.remove(mSessionConfig.getResource()); mClosed = true; return IOUtils.recursiveDelete(new File(new File(mDatabase.getLocation(), StorageConfiguration.Paths.Data.getFile().getName()), mSessionConfig.getResource())); } else { return false; } } protected  Session(final Storage pStorage, final ResourceConfiguration pResourceConf,
        final SessionConfiguration pSessionConf, final UberBucket pBucket); }
Session implements ISession { public boolean truncate() throws TTException { checkState(!mClosed, "Session must be opened to truncate."); waitForRunningCommit(); if (mResourceConfig.mBackend.truncate()) { for (final IBucketReadTrx rtx : mBucketTrxs) { rtx.close(); } mLastCommittedUberBucket = null; mBucketTrxs.clear(); mDatabase.mSessions.remove(mSessionConfig.getResource()); mClosed = true; return IOUtils.recursiveDelete(new File(new File(mDatabase.getLocation(), StorageConfiguration.Paths.Data.getFile().getName()), mSessionConfig.getResource())); } else { return false; } } protected  Session(final Storage pStorage, final ResourceConfiguration pResourceConf,
        final SessionConfiguration pSessionConf, final UberBucket pBucket); IBucketReadTrx beginBucketRtx(final long pRevKey); IBucketWriteTrx beginBucketWtx(); IBucketWriteTrx beginBucketWtx(final long mRepresentRevision); synchronized boolean close(); boolean truncate(); @Override long getMostRecentVersion(); @Override ResourceConfiguration getConfig(); @Override boolean deregisterBucketTrx(IBucketReadTrx pTrx); @Override String toString(); @Override void waitForRunningCommit(); @Override void setRunningCommit(Future<Void> pRunningCommit); }
Session implements ISession { public boolean truncate() throws TTException { checkState(!mClosed, "Session must be opened to truncate."); waitForRunningCommit(); if (mResourceConfig.mBackend.truncate()) { for (final IBucketReadTrx rtx : mBucketTrxs) { rtx.close(); } mLastCommittedUberBucket = null; mBucketTrxs.clear(); mDatabase.mSessions.remove(mSessionConfig.getResource()); mClosed = true; return IOUtils.recursiveDelete(new File(new File(mDatabase.getLocation(), StorageConfiguration.Paths.Data.getFile().getName()), mSessionConfig.getResource())); } else { return false; } } protected  Session(final Storage pStorage, final ResourceConfiguration pResourceConf,
        final SessionConfiguration pSessionConf, final UberBucket pBucket); IBucketReadTrx beginBucketRtx(final long pRevKey); IBucketWriteTrx beginBucketWtx(); IBucketWriteTrx beginBucketWtx(final long mRepresentRevision); synchronized boolean close(); boolean truncate(); @Override long getMostRecentVersion(); @Override ResourceConfiguration getConfig(); @Override boolean deregisterBucketTrx(IBucketReadTrx pTrx); @Override String toString(); @Override void waitForRunningCommit(); @Override void setRunningCommit(Future<Void> pRunningCommit);  }