Examples of BabuDBConfig


Examples of org.xtreemfs.babudb.config.BabuDBConfig

        database.shutdown();
    }
   
    @Test
    public void testMultipleIndices() throws Exception {
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 1, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        Database db = database.getDatabaseManager().createDatabase("test", 3);
       
        DatabaseInsertGroup ir = db.createInsertGroup();
        ir.addInsert(0, "Key1".getBytes(), "Value1".getBytes());
        ir.addInsert(1, "Key2".getBytes(), "Value2".getBytes());
        ir.addInsert(2, "Key3".getBytes(), "Value3".getBytes());
        db.insert(ir, null).get();
       
        database.getCheckpointer().checkpoint();
        database.shutdown();
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 2, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        db = database.getDatabaseManager().getDatabase("test");
       
        byte[] result = db.lookup(0, "Key1".getBytes(), null).get();
        assertNotNull(result);
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

        database.shutdown();
    }
   
    @Test
    public void testMultipleIndicesAndCheckpoint() throws Exception {
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 1, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        Database db = database.getDatabaseManager().createDatabase("test", 4);
       
        DatabaseInsertGroup ir = db.createInsertGroup();
        ir.addInsert(0, "Key1".getBytes(), "Value1".getBytes());
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    }
   
    @Test
    public void testUserDefinedLookup() throws Exception {
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 1, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        Database db = database.getDatabaseManager().createDatabase("test", 3);
       
        DatabaseInsertGroup ir = db.createInsertGroup();
        ir.addInsert(0, "Key1".getBytes(), "Value1".getBytes());
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    @Test
    public void testDirectAccess() throws Exception {
       
        Logging.logMessage(Logging.LEVEL_DEBUG, Category.test, this, BufferPool.getStatus());
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 0, 0, SyncMode.ASYNC, 0,
            50, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        Database db = database.getDatabaseManager().createDatabase("test", 2);
       
        for (int i = 0; i < 100000; i++) {
            DatabaseInsertGroup ir = db.createInsertGroup();
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    }
   
    @Test
    public void testInsDelGet() throws Exception {
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        Database db = database.getDatabaseManager().createDatabase("test", 3);
       
        for (int i = 0; i < 1000; i++) {
            DatabaseInsertGroup ir = db.createInsertGroup();
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    }
   
    @Test
    public void testInsPrefLookup() throws Exception {
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        Database db = database.getDatabaseManager().createDatabase("test", 3);
       
        for (int i = 1000; i < 2000; i++) {
            DatabaseInsertGroup ir = db.createInsertGroup();
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    }
   
    @Test
    public void testInsRangeLookup() throws Exception {
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        Database db = database.getDatabaseManager().createDatabase("test", 3);
       
        for (int i = 1000; i < 2000; i++) {
            DatabaseInsertGroup ir = db.createInsertGroup();
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

        database.shutdown();
    }
   
    public void testInitScript() throws BabuDBException {
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL), new StaticInitialization() {
           
            @Override
            public void initialize(DatabaseManager dbMan, SnapshotManager sMan) {
                try {
                    Database db = dbMan.createDatabase("test", 3);
                    DatabaseInsertGroup ig = db.createInsertGroup();
                    ig.addInsert(0, "Yagga".getBytes(), "Brabbel".getBytes());
                    ig.addInsert(1, "Brabbel".getBytes(), "Blupp".getBytes());
                    ig.addInsert(2, "Blupp".getBytes(), "Blahh".getBytes());
                    db.insert(ig, null).get();
                } catch (Exception e) {
                    e.printStackTrace();
                    fail("No error should occur.");
                }
            }
        });
       
        Database db = database.getDatabaseManager().getDatabase("test");
        byte[] result = db.lookup(0, "Yagga".getBytes(), null).get();
        assertNotNull(result);
        String value = new String(result);
        assertEquals(value, "Brabbel");
       
        result = db.lookup(1, "Brabbel".getBytes(), null).get();
        assertNotNull(result);
        value = new String(result);
        assertEquals(value, "Blupp");
       
        result = db.lookup(2, "Blupp".getBytes(), null).get();
        assertNotNull(result);
        value = new String(result);
        assertEquals(value, "Blahh");
       
        database.shutdown();
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL), new StaticInitialization() {
           
            @Override
            public void initialize(DatabaseManager dbMan, SnapshotManager sMan) {
                fail("May not be executed if database is not empty.");
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    @Before
    public void setUp() throws Exception {
       
        FSUtils.delTree(new File(baseDir));
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 3, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
       
        System.out.println("=== " + getName() + " ===");
    }
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

        txn.insertRecord("test", 1, "key".getBytes(), "value".getBytes());
        dbMan.executeTransaction(txn);
       
        // shutdown and restart the database
        database.shutdown();
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 1, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
       
        // retrieve the dbMan of the restarted BabuDB
        dbMan = database.getDatabaseManager();
       
        // check if the database is there
        Database db = dbMan.getDatabase("test");
        assertNotNull(db);
        assertEquals("test", db.getName());
        assertEquals(2, db.getComparators().length);
       
        // check if the records are there
        byte[] value = db.lookup(0, "hello".getBytes(), null).get();
        assertEquals("world", new String(value));
       
        value = db.lookup(1, "key".getBytes(), null).get();
        assertEquals("value", new String(value));
       
        // enforce a checkpoint
        database.getCheckpointer().checkpoint();
       
        // shutdown and restart the database
        database.shutdown();
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
       
        // retrieve the dbMan of the restarted BabuDB
        dbMan = database.getDatabaseManager();
       
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.