Package org.iq80.leveldb.impl

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


    }

    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

            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

        }
        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

        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

    DbIterator internalIterator()
    {
        mutex.lock();
        try {
            // merge together the memTable, immutableMemTable, and tables in version set
            MemTableIterator iterator = null;
            if (immutableMemTable != null) {
                iterator = immutableMemTable.iterator();
            }
            Version current = versions.getCurrent();
            return new DbIterator(memTable.iterator(), iterator, current.getLevel0Files(), current.getLevelIterators(), internalKeyComparator);
View Full Code Here

    {
        Slice record = Slices.allocate(SIZE_OF_LONG + SIZE_OF_INT + updates.getApproximateSize());
        final SliceOutput sliceOutput = record.output();
        sliceOutput.writeLong(sequenceBegin);
        sliceOutput.writeInt(updates.size());
        updates.forEach(new Handler()
        {
            @Override
            public void put(Slice key, Slice value)
            {
                sliceOutput.writeByte(VALUE.getPersistentId());
View Full Code Here

    }

    private BlockIterator getNextBlock()
    {
        Slice blockHandle = blockIterator.next().getValue();
        Block dataBlock = table.openBlock(blockHandle);
        return dataBlock.iterator();
    }
View Full Code Here

        DBComparator comparator = options.comparator();
        UserComparator userComparator;
        if (comparator != null) {
            userComparator = new CustomUserComparator(comparator);
        }else{
            userComparator = new BytewiseComparator();
        }
        internalKeyComparator = new InternalKeyComparator(userComparator);
        memTable = new MemTable(internalKeyComparator);
        immutableMemTable = null;
View Full Code Here

        //use custom comparator if set
        DBComparator comparator = options.comparator();
        UserComparator userComparator;
        if (comparator != null) {
            userComparator = new CustomUserComparator(comparator);
        }else{
            userComparator = new BytewiseComparator();
        }
        internalKeyComparator = new InternalKeyComparator(userComparator);
        memTable = new MemTable(internalKeyComparator);
View Full Code Here

TOP

Related Classes of org.iq80.leveldb.impl.Iq80DBFactory

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.