Package org.iq80.leveldb

Examples of org.iq80.leveldb.Options


  @Provides
  public IdMap getIdMap(@Named("eventhub.userstorage.directory") String userStorageDirectory) throws IOException {
    String filename = userStorageDirectory + "/id_map.db";
    //noinspection ResultOfMethodCallIgnored
    new File(userStorageDirectory).mkdirs();
    Options options = new Options();
    options.createIfMissing(true);
    return IdMap.create(new DB(JniDBFactory.factory.open(new File(filename), options)));
  }
View Full Code Here


    try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))) {
      //noinspection unchecked
      Map<String, Integer> idMap = (Map<String, Integer>) ois.readObject();
      int currentId = ois.readInt();

      Options options = new Options();
      options.createIfMissing(true);
      try (DB idMapDb = JniDBFactory.factory.open(new File(userStorageDirectory + "/id_map.db"), options)) {
        try (WriteBatch batch = idMapDb.createWriteBatch()) {
          for (Map.Entry<String, Integer> entry : idMap.entrySet()) {
            batch.put(bytes(entry.getKey()), bytes("" + entry.getValue()));
          }
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

    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

    setProperty(String.valueOf(cacheSize), "cacheSize", properties);
    this.cacheSize = cacheSize;
  }
 
  protected Options getDataDbOptions() {
    Options options = new Options().createIfMissing(true);
   
    options.compressionType(CompressionType.valueOf(compressionType));
   
    if (blockSize != null) {
      options.blockSize(blockSize);
    }
   
    if (cacheSize != null) {
      options.cacheSize(cacheSize);
    }
   
    return options;
  }
View Full Code Here

   
    return options;
  }
 
  protected Options getExpiredDbOptions() {
    return new Options()
      .createIfMissing(true);
  }
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

    @Override
    public void doDelete() throws DataStoreFatalException {
        File databaseFile = getDatabaseFile();
        try {
      factory.destroy(databaseFile, new Options());
            databaseFile.delete();
        } catch (Exception e) {
            throw new DataStoreFatalException("Unable to delete " + databaseFile.getPath(), e);
        }
    }
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.