Examples of Iq80DBFactory


Examples of org.iq80.leveldb.impl.Iq80DBFactory

    private void openDatabase(String aDirectoryPath) {

        try {
            this.setDatabasePath(aDirectoryPath);

            DBFactory factory = new Iq80DBFactory();

            Options options = new Options();

            options.createIfMissing(true);

            this.setDatabase(factory.open(new File(aDirectoryPath), options));

            if (!this.cacheJournalSequence()) {
                this.repair();
            }
View Full Code Here

Examples of org.iq80.leveldb.impl.Iq80DBFactory

    }

    private DB openDatabase(String aDirectoryPath) {

        try {
            DBFactory factory = new Iq80DBFactory();

            Options options = new Options();

            options.createIfMissing(true);

            DB db = factory.open(new File(aDirectoryPath), options);

            return db;

        } catch (Throwable t) {
            throw new IllegalStateException(
View Full Code Here

Examples of org.iq80.leveldb.impl.Iq80DBFactory

            throw new IllegalStateException("Missing 'nodeStateDir'");
        }
        File nodeStateDir = _concatAndCreate(metadataRoot, path);
        _verifyDir(metadataRoot, true);

        Iq80DBFactory factory = Iq80DBFactory.factory;
        Options options = new Options();
        options = options
                .createIfMissing(true)
                .logger(_ldbLogger)
                // better safe than sorry, for store data?
                .verifyChecksums(true)
                .cacheSize(NODE_STATE_CACHE_SIZE)
                ;
       
        DB nodeStateDB;
        try {
            nodeStateDB = factory.open(nodeStateDir, options);
        } catch (IOException e) {
            throw new IllegalStateException("Failed to open Node state LevelDB: "+e.getMessage(), e);
        }
        return new LevelDBNodeStateStore<K,V>(null, keyConv, valueConv, nodeStateDB);
    }
View Full Code Here

Examples of org.iq80.leveldb.impl.Iq80DBFactory

        }
        File nodeStateDir = _concatAndCreate(metadataRoot, path + "/" + secondaryId);

        _verifyDir(metadataRoot, true);

        Iq80DBFactory factory = Iq80DBFactory.factory;
        Options options = new Options();
        options = options
                .createIfMissing(true)
                .logger(_ldbLogger)
                // better safe than sorry, for store data?
                .verifyChecksums(true)
                .cacheSize(NODE_STATE_CACHE_SIZE)
                ;
       
        DB nodeStateDB;
        try {
            nodeStateDB = factory.open(nodeStateDir, options);
        } catch (IOException e) {
            throw new IllegalStateException("Failed to open Remote Node state LevelDB (id '"+secondaryId
                    +"'): "+e.getMessage(), e);
        }
        return new LevelDBNodeStateStore<K,V>(null, keyConv, valueConv, nodeStateDB);
View Full Code Here

Examples of org.iq80.leveldb.impl.Iq80DBFactory

        File lastModDir = new File(dbRoot, LAST_MOD_DIR);
        _verifyDir(lastModDir, canCreate);
       
        StorableConverter storableConv = _storeConfig.createStorableConverter();

        Iq80DBFactory factory = Iq80DBFactory.factory;
        Options options = new Options();
        options = options
                .createIfMissing(canCreate)
                .logger(_ldbLogger)
                .verifyChecksums(false)
                ;
       
        DB dataDB;
        try {
            options = options.cacheSize(_levelDBConfig.dataCacheSize.getNumberOfBytes());
            dataDB = factory.open(dataDir, options);
        } catch (IOException e) {
            throw new IllegalStateException("Failed to open main data LevelDB: "+e.getMessage(), e);
        }
        DB indexDB;
        try {
            options = options.cacheSize(_levelDBConfig.dataCacheSize.getNumberOfBytes());
            indexDB = factory.open(lastModDir, options);
        } catch (IOException e) {
            throw new IllegalStateException("Failed to open last-mod index LevelDB: "+e.getMessage(), e);
        }
        return new LevelDBStoreBackend(storableConv, dbRoot, dataDB, indexDB);
    }
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.