/** * Loads a B-tree holding the values of a duplicate key * This tree is also called as dups tree or sub tree * * @param offset the offset of the B-tree header * @return the deserialized B-tree */ /* No qualifier */<K, V> BTree<V, V> loadDupsBtree( long btreeHeaderOffset, BTree<K, V> parentBtree ) { PageIO[] pageIos = null; try { pageIos = readPageIOs( btreeHeaderOffset, Long.MAX_VALUE ); BTree<V, V> subBtree = BTreeFactory.<V, V> createPersistedBTree( BTreeTypeEnum.PERSISTED_SUB ); loadBtree( pageIos, subBtree, parentBtree ); return subBtree; } catch ( Exception e ) { // should not happen throw new BTreeCreationException( e ); } }
btreeOfBtrees = BTreeFactory.<NameRevision, Long> createPersistedBTree( BTreeTypeEnum.BTREE_OF_BTREES ); copiedPageBtree = BTreeFactory.<RevisionName, long[]> createPersistedBTree( BTreeTypeEnum.COPIED_PAGES_BTREE ); BTree<?, ?> btree = BTreeFactory.<NameRevision, Long> createPersistedBTree();
/** * Create a new Sub-BTree to store the values. */ protected void createSubTree() { PersistedBTreeConfiguration<V, V> configuration = new PersistedBTreeConfiguration<V, V>(); configuration.setAllowDuplicates( false ); configuration.setKeySerializer( valueSerializer ); configuration.setName( UUID.randomUUID().toString() ); configuration.setValueSerializer( valueSerializer ); configuration.setParentBTree( parentBtree ); configuration.setBtreeType( BTreeTypeEnum.PERSISTED_SUB ); valueBtree = BTreeFactory.createPersistedBTree( configuration ); ( ( PersistedBTree<V, V> ) valueBtree ).setRecordManager( parentBtree.getRecordManager() ); }
/** * Create the B-treeOfBtrees */ private void createBtreeOfBtrees() { PersistedBTreeConfiguration<NameRevision, Long> configuration = new PersistedBTreeConfiguration<NameRevision, Long>(); configuration.setKeySerializer( NameRevisionSerializer.INSTANCE ); configuration.setName( BTREE_OF_BTREES_NAME ); configuration.setValueSerializer( LongSerializer.INSTANCE ); configuration.setBtreeType( BTreeTypeEnum.BTREE_OF_BTREES ); configuration.setCacheSize( PersistedBTree.DEFAULT_CACHE_SIZE ); btreeOfBtrees = BTreeFactory.createPersistedBTree( configuration ); }
config.setValueSerializer(KrbIdentitySerializer.INSTANCE); database = BTreeFactory.createPersistedBTree(config); rm.manage(database);
/** * Create the CopiedPagesBtree */ private void createCopiedPagesBtree() { PersistedBTreeConfiguration<RevisionName, long[]> configuration = new PersistedBTreeConfiguration<RevisionName, long[]>(); configuration.setKeySerializer( RevisionNameSerializer.INSTANCE ); configuration.setName( COPIED_PAGE_BTREE_NAME ); configuration.setValueSerializer( LongArraySerializer.INSTANCE ); configuration.setBtreeType( BTreeTypeEnum.COPIED_PAGES_BTREE ); configuration.setCacheSize( PersistedBTree.DEFAULT_CACHE_SIZE ); copiedPageBtree = BTreeFactory.createPersistedBTree( configuration ); }
@SuppressWarnings("unchecked") public BTree<K, V> build( Iterator<Tuple<K, V>> sortedTupleItr ) throws Exception BTree<K, V> btree = BTreeFactory.createPersistedBTree( name, keySerializer, valueSerializer );
bt = BTreeFactory.createPersistedBTree( name, keySerializer, valueSerializer, allowDuplicates, cacheSize );