Package org.iq80.leveldb

Examples of org.iq80.leveldb.Options


    }

    @Override
    public void doOpen() throws DataStoreFatalException {
  path = getDatabaseFile();
  Options options = new Options();
  options.createIfMissing(true);
  options.logger(new org.iq80.leveldb.Logger() {
    public void log (String message) {
        logger.trace("leveldb: {}", message);
    }
      });
  try {
View Full Code Here


  private DB database;

  public LevelDBState(String dbName, DBSerializer<K> keySerializer,
      DBSerializer<V> valueSerializer) {
    super(keySerializer, valueSerializer);
    Options options = new Options();
    File file = new File(dbName);
    options.createIfMissing(true);
    try {
      factory.destroy(file, options);
      database = factory.open(file, options);
    } catch (IOException e) {
      throw new RuntimeException(e);
View Full Code Here

  private String name;
   
  public DatabaseImpl(String name) {
      // Initialize Database
        this.name = name;
    Options options = new Options();
    options.createIfMissing(true);
    options.compressionType(CompressionType.NONE);
    try {
      logger.debug("Opening database");
            File dbLocation = new File(System.getProperty("user.dir") + "/" +
                                       SystemProperties.CONFIG.databaseDir() + "/");
            File fileLocation = new File(dbLocation, name);
View Full Code Here

    }   
  }
 
  public void destroyDB(File fileLocation) {
    logger.debug("Destroying existing database");
    Options options = new Options();
    try {
      factory.destroy(fileLocation, options);
    } catch (IOException e) {
      logger.error(e.getMessage(), e);
    }
View Full Code Here

  }

  private DB openTable(String tableName) throws IOException {
    String dbPath = getDBPath(basePath, tableName);

    Options options = new Options();
    options.createIfMissing(false);
    options.errorIfExists(false);
    options.comparator(new KeyValueDBComparator());
    options.blockSize(blockSize);
    options.cacheSize(cacheSize);

    // unfortunately, with the java version of leveldb, with createIfMissing set to false, factory.open will
    // see that there is no table and throw an exception, but it wont clean up after itself and will leave a
    // directory there with a lock.  So we want to avoid calling open if the path doesn't already exist and
    // throw the exception ourselves.
View Full Code Here

  }

  private void createTable(String name) throws IOException {
    String dbPath = getDBPath(basePath, name);

    Options options = new Options();
    options.createIfMissing(true);
    options.errorIfExists(false);
    options.comparator(new KeyValueDBComparator());
    options.blockSize(blockSize);
    options.cacheSize(cacheSize);

    DB db = factory.open(new File(dbPath), options);
    tables.put(name, db);
  }
View Full Code Here

    DB db = tables.remove(name);
    if (db != null) {
      db.close();
    }
    String dbPath = getDBPath(basePath, name);
    factory.destroy(new File(dbPath), 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

      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

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.