Package com.sleepycat.bdb

Examples of com.sleepycat.bdb.DataStore


        SerialFormat keyFormat = new SerialFormat(catalog,
                                                  String.class);
        SerialFormat valueFormat = new SerialFormat(catalog,
                                                    TestSerial.class);
        store = new DataStore(openDb(STORE_FILE),
                              keyFormat, valueFormat, null);

        SerialBinding keyBinding = new SerialBinding(keyFormat);
        SerialBinding valueBinding = new SerialBinding(valueFormat);
        map = new StoredMap(store, keyBinding, valueBinding, true);
View Full Code Here


        int envFlags = Db.DB_INIT_MPOOL | Db.DB_CREATE;
        env = new DbEnv(0);
        env.open(dir.getAbsolutePath(), envFlags, 0);
        Db db = new Db(env, 0);
        db.open(null, "test.db", null, Db.DB_BTREE, Db.DB_CREATE, 0);
        store = new DataStore(db, dataFormat, dataFormat, null);
        view = new DataView(store, null, dataBinding, dataBinding, null, true);
    }
View Full Code Here

        // is not transactional because is not opened in a transaction
        //
        Db db = new Db(env, 0);
        db.open(null, null, null, Db.DB_BTREE, 0, 0);
        store = new DataStore(db, TestStore.BYTE_FORMAT,
                                  TestStore.BYTE_FORMAT, null);
        map = new StoredSortedMap(store,
                testStore.getKeyBinding(), testStore.getValueBinding(), true);
        assertTrue(!map.isTransactional());
        map.put(ONE, ONE);
        readCheck(map, ONE, ONE);
        store.close();

        // is transactional because is opened in a transaction
        //
        currentTxn.beginTxn();
        db = new Db(env, 0);
        db.open(currentTxn.getTxn(), null, null, Db.DB_BTREE, 0, 0);
        currentTxn.commitTxn();
        store = new DataStore(db, TestStore.BYTE_FORMAT,
                                  TestStore.BYTE_FORMAT, null);
        map = new StoredSortedMap(store,
                testStore.getKeyBinding(), testStore.getValueBinding(), true);
        assertTrue(map.isTransactional());
        currentTxn.beginTxn();
View Full Code Here

                                map.keySet()));
        checkDirtyReadProperty(StoredCollections.dirtyReadSortedSet(
                                (SortedSet) map.keySet()));

        // create a list just so we can call dirtyReadList()
        DataStore listStore = TestStore.RECNO_RENUM.open(env, null);
        List list = new StoredList(listStore, TestStore.VALUE_BINDING, true);
        checkDirtyReadProperty(StoredCollections.dirtyReadList(list));
        listStore.close();

        doDirtyRead(dirtyMap);
    }
View Full Code Here

     * key assignment is used.
     */
    public DataStore newDataStore(Db db, Class baseClass,
                                  PrimaryKeyAssigner keyAssigner) {

        return new DataStore(db, TUPLE_FORMAT,
                             new SerialFormat(catalog, baseClass),
                             keyAssigner);
    }
View Full Code Here

        int fixedLen = (isQueueOrRecno() ? 1 : 0);
        Db db = openDb(env, fileName, fixedLen);
        PrimaryKeyAssigner keyAssigner =
            isQueueOrRecno() null : getKeyAssigner();
        return new DataStore(db, keyFormat, BYTE_FORMAT, keyAssigner);
    }
View Full Code Here

        // is not very useful. Duplicate keys are not allowed for any entity
        // with indexes or foreign key relationships.
        //
        Db partDb = new Db(env, 0);
        partDb.open(null, PART_STORE, null, Db.DB_BTREE, flags, 0);
        partStore = new DataStore(partDb, partKeyFormat,
                                  partValueFormat, null);

        Db supplierDb = new Db(env, 0);
        supplierDb.open(null, SUPPLIER_STORE, null, Db.DB_BTREE, flags, 0);
        supplierStore = new DataStore(supplierDb, supplierKeyFormat,
                                      supplierValueFormat, null);

        Db shipmentDb = new Db(env, 0);
        shipmentDb.open(null, SHIPMENT_STORE, null, Db.DB_BTREE, flags, 0);
        shipmentStore = new DataStore(shipmentDb, shipmentKeyFormat,
                                      shipmentValueFormat, null);

        // Create the KeyExtractor objects for the part and supplier
        // indices of the shipment store.  Each key extractor object defines
        // its associated index, since it is responsible for mapping between
View Full Code Here

        // data format is used.  Duplicate keys are not allowed for any entity
        // with indexes or foreign key relationships.
        //
        Db partDb = new Db(env, 0);
        partDb.open(null, PART_STORE, null, Db.DB_BTREE, flags, 0);
        partStore = new DataStore(partDb, partKeyFormat,
                                  partValueFormat, null);

        Db supplierDb = new Db(env, 0);
        supplierDb.open(null, SUPPLIER_STORE, null, Db.DB_BTREE, flags, 0);
        supplierStore = new DataStore(supplierDb, supplierKeyFormat,
                                      supplierValueFormat, null);

        Db shipmentDb = new Db(env, 0);
        shipmentDb.open(null, SHIPMENT_STORE, null, Db.DB_BTREE, flags, 0);
        shipmentStore = new DataStore(shipmentDb, shipmentKeyFormat,
                                      shipmentValueFormat, null);

        // Create the KeyExtractor objects for the part and supplier
        // indices of the shipment store.  Each key extractor object defines
        // its associated index, since it is responsible for mapping between
View Full Code Here

        SerialBinding valueBinding = new SerialBinding(valueFormat);

        // open a BTREE (sorted) data store
        Db db = new Db(env, 0);
        db.open(null, "data.db", null, Db.DB_BTREE, dbFlags, 0);
        this.store = new DataStore(db, keyFormat, valueFormat, null);

        // create a map view of the data store
        this.map = new StoredSortedMap(store, keyBinding, valueBinding, true);
    }
View Full Code Here

        // is not very useful. Duplicate keys are not allowed for any entity
        // with indexes or foreign key relationships.
        //
        Db partDb = new Db(env, 0);
        partDb.open(null, PART_STORE, null, Db.DB_BTREE, flags, 0);
        partStore = new DataStore(partDb, partKeyFormat, partValueFormat,
                                  null);

        Db supplierDb = new Db(env, 0);
        supplierDb.open(null, SUPPLIER_STORE, null, Db.DB_BTREE, flags, 0);
        supplierStore = new DataStore(supplierDb, supplierKeyFormat,
                                      supplierValueFormat, null);

        Db shipmentDb = new Db(env, 0);
        shipmentDb.open(null, SHIPMENT_STORE, null, Db.DB_BTREE, flags, 0);
        shipmentStore = new DataStore(shipmentDb, shipmentKeyFormat,
                                      shipmentValueFormat, null);
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.bdb.DataStore

Copyright © 2018 www.massapicom. 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.