Package org.iq80.leveldb

Examples of org.iq80.leveldb.Options


    try {
      iter.seek(key);
    } catch (DBException e) {
      throw e;
    } catch (RuntimeException e) {
      throw new DBException(e.getMessage(), e);
    }
  }
View Full Code Here


    try {
      iter.seekToFirst();
    } catch (DBException e) {
      throw e;
    } catch (RuntimeException e) {
      throw new DBException(e.getMessage(), e);
    }
  }
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

  }

  @Override
  @SuppressWarnings("unchecked")
  protected void serviceInit(Configuration conf) throws Exception {
    Options options = new Options();
    options.createIfMissing(true);
    options.cacheSize(conf.getLong(
        YarnConfiguration.TIMELINE_SERVICE_LEVELDB_READ_CACHE_SIZE,
        YarnConfiguration.DEFAULT_TIMELINE_SERVICE_LEVELDB_READ_CACHE_SIZE));
    JniDBFactory factory = new JniDBFactory();
    Path dbPath = new Path(
        conf.get(YarnConfiguration.TIMELINE_SERVICE_LEVELDB_PATH), FILENAME);
View Full Code Here

  @Override
  protected void initStorage(Configuration conf)
      throws IOException {
    Path storeRoot = createStorageDir(conf);
    Options options = new Options();
    options.createIfMissing(false);
    options.logger(new LeveldbLogger());
    LOG.info("Using state database at " + storeRoot + " for recovery");
    File dbfile = new File(storeRoot.toString());
    byte[] schemaVersionData = null;
    try {
      db = JniDBFactory.factory.open(dbfile, options);
      try {
        schemaVersionData = db.get(bytes(DB_SCHEMA_VERSION_KEY));
      } catch (DBException e) {
        throw new IOException(e.getMessage(), e);
      }
    } catch (NativeDB.DBException e) {
      if (e.isNotFound() || e.getMessage().contains(" does not exist ")) {
        LOG.info("Creating state database at " + dbfile);
        options.createIfMissing(true);
        try {
          db = JniDBFactory.factory.open(dbfile, options);
          schemaVersionData = bytes(DB_SCHEMA_VERSION);
          db.put(bytes(DB_SCHEMA_VERSION_KEY), schemaVersionData);
        } catch (DBException dbErr) {
View Full Code Here

      }
    }
  }

  private void startStore(Path recoveryRoot) throws IOException {
    Options options = new Options();
    options.createIfMissing(false);
    options.logger(new LevelDBLogger());
    Path dbPath = new Path(recoveryRoot, STATE_DB_NAME);
    LOG.info("Using state database at " + dbPath + " for recovery");
    File dbfile = new File(dbPath.toString());
    byte[] schemaVersionData;
    try {
      stateDb = JniDBFactory.factory.open(dbfile, options);
      schemaVersionData = stateDb.get(bytes(STATE_DB_SCHEMA_VERSION_KEY));
    } catch (NativeDB.DBException e) {
      if (e.isNotFound() || e.getMessage().contains(" does not exist ")) {
        LOG.info("Creating state database at " + dbfile);
        options.createIfMissing(true);
        try {
          stateDb = JniDBFactory.factory.open(dbfile, options);
          schemaVersionData = bytes(STATE_DB_SCHEMA_VERSION);
          stateDb.put(bytes(STATE_DB_SCHEMA_VERSION_KEY), schemaVersionData);
        } catch (DBException dbExc) {
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

   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

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.