/** * Add the value in the subBTree */ private void addInBtree( V value ) { try { valueBtree.insert( value, null ); } catch ( IOException e ) { // TODO Auto-generated catch block e.printStackTrace(); } }
/** * Stores the copied pages into the CopiedPages B-tree * * @param name The B-tree name * @param revision The revision * @param copiedPages The pages that have been copied while creating this revision * @throws IOException If we weren't able to store the data on disk */ /* No Qualifier */void storeCopiedPages( String name, long revision, long[] copiedPages ) throws IOException { RevisionName revisionName = new RevisionName( revision, name ); copiedPageBtree.insert( revisionName, copiedPages ); }
/** * {@inheritDoc} */ @Override public void put( PartitionTxn partitionTxn, K key, V value ) throws LdapException { try { if ( ( value == null ) || ( key == null ) ) { throw new IllegalArgumentException( I18n.err( I18n.ERR_594 ) ); } V existingVal = bt.insert( key, value ); if ( existingVal == null ) { count++; } } catch ( IOException ioe ) { LOG.error( I18n.err( I18n.ERR_131, key, name ), ioe ); throw new LdapOtherException( ioe.getMessage(), ioe ); } }
valueBtree.insert( value, value );
/** * Add a new <btree, revision> tuple into the CopiedPages B-tree. * * @param name The B-tree name * @param revision The B-tree revision * @param btreeHeaderOffset The B-tree offset * @throws IOException If the update failed */ /* no qualifier */<K, V> void addInCopiedPagesBtree( String name, long revision, List<Page<K, V>> pages ) throws IOException { RevisionName revisionName = new RevisionName( revision, name ); long[] pageOffsets = new long[pages.size()]; int pos = 0; for ( Page<K, V> page : pages ) { pageOffsets[pos++] = ( ( AbstractPage<K, V> ) page ).getOffset(); } copiedPageBtree.insert( revisionName, pageOffsets ); // Update the CopiedPageBtree offset currentCopiedPagesBtreeOffset = ( ( AbstractBTree<RevisionName, long[]> ) copiedPageBtree ).getBtreeHeader().getBTreeHeaderOffset(); }
/** * Add a new <btree, revision> tuple into the B-tree of B-trees. * * @param name The B-tree name * @param revision The B-tree revision * @param btreeHeaderOffset The B-tree offset * @throws IOException If the update failed */ /* no qualifier */<K, V> void addInBtreeOfBtrees( String name, long revision, long btreeHeaderOffset ) throws IOException { checkOffset( btreeHeaderOffset ); NameRevision nameRevision = new NameRevision( name, revision ); btreeOfBtrees.insert( nameRevision, btreeHeaderOffset ); // Update the B-tree of B-trees offset currentBtreeOfBtreesOffset = getNewBTreeHeader( BTREE_OF_BTREES_NAME ).getBTreeHeaderOffset(); }
copiedPageBtree.insert( revisionName, pageOffsets );
/** * {@inheritDoc} */ @Override protected synchronized KrbIdentity doUpdateIdentity(KrbIdentity identity) throws KrbException { String p = identity.getPrincipalName(); try { if (!database.hasKey(p)) { throw new KrbException("No identity found with the principal " + p); } database.delete(p); return database.insert(p, identity); } catch (Exception e) { throw new KrbException("Failed to update the identity " + p); } }
/** * {@inheritDoc} */ @Override protected synchronized KrbIdentity doAddIdentity(KrbIdentity identity) throws KrbException { String p = identity.getPrincipalName(); try { if (database.hasKey(p)) { throw new KrbException("Identity already exists " + p); } return database.insert(p, identity); } catch (KeyNotFoundException e) { throw new KrbException("No such identity exists " + p); } catch (IOException e) { throw new KrbException("Failed to add the identity " + p); } }
btreeOfBtrees.insert( nameRevision, btreeHeaderOffset ); commit();
btreeOfBtrees.insert( nameRevision, btreeHeaderOffset );