/** * Get the current revision * * @return The revision this cursor is based on */ public long getRevision() { return transaction.getRevision(); }
/** * Get the current revision * * @return The revision this cursor is based on */ public long getRevision() { return transaction.getRevision(); }
btreeRevisions.remove( transaction.getRevision() );
/** * Add a newly closd transaction into the closed transaction queue */ /* no qualifier */<K, V> void releaseTransaction( ReadTransaction<K, V> readTransaction ) { RevisionName revisionName = new RevisionName( readTransaction.getRevision(), readTransaction.getBtreeHeader().getBtree().getName() ); //closedTransactionsQueue.add( revisionName ); }
/** * {@inheritDoc} */ public TupleCursor<K, V> browseFrom( K key ) throws IOException { // Check that we have a TransactionManager if ( transactionManager == null ) { throw new BTreeCreationException( "We don't have a transactionLManager" ); } ReadTransaction<K, V> transaction = beginReadTransaction(); ParentPos<K, V>[] stack = ( ParentPos<K, V>[] ) Array.newInstance( ParentPos.class, 32 ); try { TupleCursor<K, V> cursor = getRootPage( transaction.getRevision() ).browse( key, transaction, stack, 0 ); return cursor; } catch ( KeyNotFoundException e ) { throw new IOException( e.getMessage() ); } }
/** * {@inheritDoc} */ public long getRevision() { // Check that we have a TransactionManager if ( transactionManager == null ) { throw new BTreeCreationException( "We don't have a transactionLManager" ); } ReadTransaction<K, V> transaction = beginReadTransaction(); if ( transaction == null ) { return -1L; } else { try { return transaction.getRevision(); } finally { transaction.close(); } } }
/** * {@inheritDoc} */ public TupleCursor<K, V> browseFrom( long revision, K key ) throws IOException, KeyNotFoundException { // Check that we have a TransactionManager if ( transactionManager == null ) { throw new BTreeCreationException( "We don't have a transactionLManager" ); } ReadTransaction<K, V> transaction = beginReadTransaction( revision ); if ( transaction == null ) { return new EmptyTupleCursor<K, V>(); } else { ParentPos<K, V>[] stack = ( ParentPos<K, V>[] ) Array.newInstance( ParentPos.class, 32 ); // And get the cursor TupleCursor<K, V> cursor = getRootPage( transaction.getRevision() ).browse( key, transaction, stack, 0 ); return cursor; } }
/** * {@inheritDoc} */ public TupleCursor<K, V> browse( long revision ) throws IOException, KeyNotFoundException { // Check that we have a TransactionManager if ( transactionManager == null ) { throw new BTreeCreationException( "We don't have a transactionLManager" ); } ReadTransaction<K, V> transaction = beginReadTransaction( revision ); if ( transaction == null ) { return new EmptyTupleCursor<K, V>(); } else { ParentPos<K, V>[] stack = ( ParentPos<K, V>[] ) Array.newInstance( ParentPos.class, 32 ); // And get the cursor TupleCursor<K, V> cursor = getRootPage( transaction.getRevision() ).browse( transaction, stack, 0 ); return cursor; } }
return getRootPage( transaction.getRevision() ).contains( key, value );
/** * {@inheritDoc} */ public V get( K key ) throws IOException, KeyNotFoundException { // Check that we have a TransactionManager if ( transactionManager == null ) { throw new BTreeCreationException( "We don't have a transactionLManager" ); } ReadTransaction<K, V> transaction = beginReadTransaction(); if ( transaction == null ) { return null; } else { try { return getRootPage( transaction.getRevision() ).get( key ); } finally { transaction.close(); } } }
/** * {@inheritDoc} */ public V get( long revision, K key ) throws IOException, KeyNotFoundException { // Check that we have a TransactionManager if ( transactionManager == null ) { throw new BTreeCreationException( "We don't have a transactionLManager" ); } ReadTransaction<K, V> transaction = beginReadTransaction( revision ); if ( transaction == null ) { return null; } else { try { return getRootPage( transaction.getRevision() ).get( key ); } finally { transaction.close(); } } }
/** * {@inheritDoc} */ public boolean contains( long revision, K key, V value ) throws IOException, KeyNotFoundException { // Check that we have a TransactionManager if ( transactionManager == null ) { throw new BTreeCreationException( "We don't have a transactionLManager" ); } // Fetch the root page for this revision ReadTransaction<K, V> transaction = beginReadTransaction( revision ); if ( transaction == null ) { return false; } else { try { return getRootPage( transaction.getRevision() ).contains( key, value ); } finally { transaction.close(); } } }
return getRootPage( transaction.getRevision() ).hasKey( key );
return getRootPage( transaction.getRevision() ).hasKey( key );
while ( txnItr.hasNext() ) inUseRevisions.add( txnItr.next().getRevision() );
/** * {@inheritDoc} */ public ValueCursor<V> getValues( K key ) throws IOException, KeyNotFoundException { // Check that we have a TransactionManager if ( transactionManager == null ) { throw new BTreeCreationException( "We don't have a transactionLManager" ); } ReadTransaction<K, V> transaction = beginReadTransaction(); if ( transaction == null ) { return new EmptyValueCursor<V>( 0L ); } else { try { return getRootPage( transaction.getRevision() ).getValues( key ); } finally { transaction.close(); } } }