Package org.iq80.leveldb

Examples of org.iq80.leveldb.Options


      return options;
   }

   private Options expiredDbOptions() {
      return new Options().createIfMissing(true);
   }
View Full Code Here


      return dbFactory.open(dir, options);
   }

   protected void destroyDatabase(String location) throws IOException {
      File dir = new File(location);
      dbFactory.destroy(dir, new Options());
   }
View Full Code Here

        if (LOG.isDebugEnabled()) {
            LOG.debug("Starting LevelDB using file: {}", getFile());
        }

        Options options = new Options().writeBufferSize(writeBufferSize).maxOpenFiles(maxOpenFiles)
                .blockRestartInterval(blockRestartInterval).blockSize(blockSize).verifyChecksums(verifyChecksums)
                .paranoidChecks(paranoidChecks).cacheSize(cacheSize);

        if ("snappy".equals(compressionType)) {
            options.compressionType(CompressionType.SNAPPY);
        } else {
            options.compressionType(CompressionType.NONE);
        }

        options.createIfMissing(true);
        try {
            getFile().getParentFile().mkdirs();
            db = factory.open(getFile(), options);
        } catch (IOException ioe) {
            throw new RuntimeException("Error opening LevelDB with file " + getFile(), ioe);
View Full Code Here

      String dbPath = System.getProperty("montric.db.absPath");
      if (dbPath == null) {
        throw new RuntimeException("Property montric.db.absPath is NULL.Please configure in config.properties");
      }
     
      Options options = new Options();
      options.createIfMissing(true);
      logger.info("Creating LevelDB Factory");
      try {
        db = Iq80DBFactory.factory.open(new File(dbPath), options);
      } catch (IOException e) {
        logger.info("Unable to open LeveLDB Factory: " + e.getMessage());
View Full Code Here

   private String getQualifiedExpiredLocation() {
      return configuration.expiredLocation() + sanitizedCacheName();
   }

   private Options dataDbOptions() {
      Options options = new Options().createIfMissing(true);

      options.compressionType(CompressionType.valueOf(configuration.compressionType().name()));

      if (configuration.blockSize() != null) {
         options.blockSize(configuration.blockSize());
      }

      if (configuration.cacheSize() != null) {
         options.cacheSize(configuration.cacheSize());
      }

      return options;
   }
View Full Code Here

      return options;
   }

   private Options expiredDbOptions() {
      return new Options().createIfMissing(true);
   }
View Full Code Here

      return dbFactory.open(dir, options);
   }

   protected void destroyDatabase(String location) throws IOException {
      File dir = new File(location);
      dbFactory.destroy(dir, new Options());
   }
View Full Code Here

        {
            factory = newDBFactory();
        }

        // Apply configuration
        Options options = new Options();
        options.createIfMissing( true );
        if( config.blockRestartInterval().get() != null )
        {
            options.blockRestartInterval( config.blockRestartInterval().get() );
        }
        if( config.blockSize().get() != null )
        {
            options.blockSize( config.blockSize().get() );
        }
        if( config.cacheSize().get() != null )
        {
            options.cacheSize( config.cacheSize().get() );
        }
        if( config.compression().get() != null )
        {
            options.compressionType( config.compression().get()
                                     ? CompressionType.SNAPPY
                                     : CompressionType.NONE );
        }
        if( config.maxOpenFiles().get() != null )
        {
            options.maxOpenFiles( config.maxOpenFiles().get() );
        }
        if( config.paranoidChecks().get() != null )
        {
            options.paranoidChecks( config.paranoidChecks().get() );
        }
        if( config.verifyChecksums().get() != null )
        {
            options.verifyChecksums( config.verifyChecksums().get() );
        }
        if( config.writeBufferSize().get() != null )
        {
            options.writeBufferSize( config.writeBufferSize().get() );
        }

        // Open/Create the database
        File dbFile = new File( fileConfig.dataDirectory(), descriptor.identity() );
        db = factory.open( dbFile, options );
View Full Code Here

  }

  @Provides
  public DatedEventIndex getDatedEventIndex(
      @Named("eventhub.directory") String eventIndexDirectory) throws IOException {
    Options options = new Options();
    options.createIfMissing(true);
    DB db = new DB(
        JniDBFactory.factory.open(new File(eventIndexDirectory + "/dated_event_index.db"), options));

    return DatedEventIndex.create(db);
  }
View Full Code Here

  @Provides
  public PropertiesIndex getPropertiesIndex(
      @Named("eventhub.directory") String eventIndexDirectory) throws IOException {
    //noinspection ResultOfMethodCallIgnored
    new File(eventIndexDirectory).mkdirs();
    Options options = new Options();
    options.createIfMissing(true);
    return new PropertiesIndex(new DB(
        JniDBFactory.factory.open(new File(eventIndexDirectory + "/properties_index.db"), options)));
  }
View Full Code Here

TOP

Related Classes of org.iq80.leveldb.Options

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.