Examples of RecordManager


Examples of org.apache.directory.mavibot.btree.RecordManager

    @Before
    public void createTable() throws Exception
    {
        destroyTable();

        recordMan = new RecordManager( tmpDir.getRoot().getAbsolutePath() );
       
        table = new MavibotMasterTable( recordMan, schemaManager, "master" );
        LOG.debug( "Created new table and populated it with data" );
    }
View Full Code Here

Examples of org.apache.directory.mavibot.btree.RecordManager

    @Before
    public void setup() throws IOException
    {
        dbFileDir = tempFolder.newFolder( MavibotIndexTest.class.getSimpleName() );

        recordMan = new RecordManager( dbFileDir.getAbsolutePath() );
    }
View Full Code Here

Examples of org.apache.directory.mavibot.btree.RecordManager

    {
        File tempFile = tempFolder.newFile( "mavibot.db" );
        String tempFileName = tempFile.getAbsolutePath();

        // Create page size of 32 only
        RecordManager recordManager = new RecordManager( tempFileName, 32 );
        Method storeMethod = RecordManager.class.getDeclaredMethod( "store", long.class, int.class, PageIO[].class );
        Method readIntMethod = RecordManager.class.getDeclaredMethod( "readInt", PageIO[].class, long.class );
        storeMethod.setAccessible( true );
        readIntMethod.setAccessible( true );

        // Allocate some Pages
        PageIO[] pageIos = new PageIO[2];
        pageIos[0] = new PageIO();
        pageIos[0].setData( ByteBuffer.allocate( recordManager.getPageSize() ) );
        pageIos[1] = new PageIO();
        pageIos[1].setData( ByteBuffer.allocate( recordManager.getPageSize() ) );

        // Set the int at the beginning
        storeMethod.invoke( recordManager, 0, 0x12345678, pageIos );

        // Read it back
        int readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 0 );

        assertEquals( 0x12345678, readValue );

        // Set the int at the end of the first page
        storeMethod.invoke( recordManager, 16, 0x12345678, pageIos );

        // Read it back
        readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 16 );

        assertEquals( 0x12345678, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 1 byte overlapping
        storeMethod.invoke( recordManager, 17, 0x12345678, pageIos );

        // Read it back
        readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 17 );

        assertEquals( 0x12345678, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 2 bytes overlapping
        storeMethod.invoke( recordManager, 18, 0x12345678, pageIos );

        // Read it back
        readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 18 );

        assertEquals( 0x12345678, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 3 bytes overlapping
        storeMethod.invoke( recordManager, 19, 0x12345678, pageIos );

        // Read it back
        readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 19 );

        assertEquals( 0x12345678, readValue );

        // Set the int at the beginning of the second page
        storeMethod.invoke( recordManager, 20, 0x12345678, pageIos );

        // Read it back
        readValue = ( Integer ) readIntMethod.invoke( recordManager, pageIos, 20 );

        recordManager.close();
    }
View Full Code Here

Examples of org.apache.directory.mavibot.btree.RecordManager

    {
        File tempFile = tempFolder.newFile( "mavibot.db" );
        String tempFileName = tempFile.getAbsolutePath();

        // Create page size of 32 only
        RecordManager recordManager = new RecordManager( tempFileName, 32 );
        Method storeMethod = RecordManager.class.getDeclaredMethod( "store", long.class, long.class, PageIO[].class );
        Method readLongMethod = RecordManager.class.getDeclaredMethod( "readLong", PageIO[].class, long.class );
        storeMethod.setAccessible( true );
        readLongMethod.setAccessible( true );

        // Allocate some Pages
        PageIO[] pageIos = new PageIO[2];
        pageIos[0] = new PageIO();
        pageIos[0].setData( ByteBuffer.allocate( recordManager.getPageSize() ) );
        pageIos[1] = new PageIO();
        pageIos[1].setData( ByteBuffer.allocate( recordManager.getPageSize() ) );

        // Set the int at the beginning
        storeMethod.invoke( recordManager, 0, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        long readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 0 );

        assertEquals( 0x0123456789ABCDEFL, readValue );

        // Set the int at the end of the first page
        storeMethod.invoke( recordManager, 12, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 12 );

        assertEquals( 0x0123456789ABCDEFL, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 1 byte overlapping
        storeMethod.invoke( recordManager, 13, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 13 );

        assertEquals( 0x0123456789ABCDEFL, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 2 bytes overlapping
        storeMethod.invoke( recordManager, 14, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 14 );

        assertEquals( 0x0123456789ABCDEFL, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 3 bytes overlapping
        storeMethod.invoke( recordManager, 15, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 15 );

        assertEquals( 0x0123456789ABCDEFL, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 4 bytes overlapping
        storeMethod.invoke( recordManager, 16, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 16 );

        assertEquals( 0x0123456789ABCDEFL, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 5 bytes overlapping
        storeMethod.invoke( recordManager, 17, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 17 );

        assertEquals( 0x0123456789ABCDEFL, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 6 bytes overlapping
        storeMethod.invoke( recordManager, 18, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 18 );

        assertEquals( 0x0123456789ABCDEFL, readValue );

        // Set the int at the end of the first page and overlapping on the second page
        // 7 bytes overlapping
        storeMethod.invoke( recordManager, 19, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 19 );

        assertEquals( 0x0123456789ABCDEFL, readValue );

        // Set the int at the beginning of the second page
        storeMethod.invoke( recordManager, 20, 0x0123456789ABCDEFL, pageIos );

        // Read it back
        readValue = ( Long ) readLongMethod.invoke( recordManager, pageIos, 20 );

        recordManager.close();
    }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.util.jdbm.RecordManager

     */
    public RecordManager createRecordManager( String name,
                                              Properties options )
        throws IOException
    {
        RecordManager  recman;

        recman = new BaseRecordManager( name );
        recman = getCachedRecordManager(recman, options);
        return recman;
    }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.util.jdbm.RecordManager

    public RecordManager createRecordManager ( File file,
                                              Properties options )
        throws IOException
    {
      RecordManager recman = new BaseRecordManager(file);
      recman = getCachedRecordManager(recman, options);
      return recman;
    }
View Full Code Here

Examples of org.apache.hadoop.hive.ql.util.jdbm.RecordManager

     */
    public RecordManager createRecordManager( String name,
                                              Properties options )
        throws IOException
    {
        RecordManager  recman;
        String         value;
        int            cacheSize;

        recman = new BaseRecordManager( name );

View Full Code Here

Examples of org.apache.hadoop.hive.ql.util.jdbm.RecordManager

            break;
          }
          newDir = new File("/tmp" + rand.nextInt());
        }
       
        RecordManager recman = RecordManagerFactory.createRecordManager(newDirName + "/" + pos, props );
        HTree hashTable = HTree.createInstance(recman);
       
        mapJoinTables.put(Byte.valueOf((byte)pos), hashTable);
      }
View Full Code Here

Examples of org.apache.mavibot.btree.RecordManager

            if ( !partitionDir.exists() && !partitionDir.mkdirs() )
            {
                throw new IOException( I18n.err( I18n.ERR_112_COULD_NOT_CREATE_DIRECORY, partitionDir ) );
            }

            recordMan = new RecordManager( partitionDir.getPath() );

            // Initialize the indexes
            super.doInit();

            // First, check if the file storing the data exists
View Full Code Here

Examples of org.apache.mavibot.btree.RecordManager

    @Before
    public void setup() throws IOException
    {
        dbFileDir = tempFolder.newFolder( MavibotIndexTest.class.getSimpleName() );

        recordMan = new RecordManager( dbFileDir.getAbsolutePath() );
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.