Search in sources :

Example 26 with Options

use of org.iq80.leveldb.Options in project EventHub by Codecademy.

the class UserStorageModule method getIdMap.

@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)));
}
Also used : Options(org.iq80.leveldb.Options) File(java.io.File) DB(com.codecademy.eventhub.base.DB) Provides(com.google.inject.Provides)

Example 27 with Options

use of org.iq80.leveldb.Options in project EventHub by Codecademy.

the class PropertiesIndexModule method getPropertiesIndex.

@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)));
}
Also used : Options(org.iq80.leveldb.Options) File(java.io.File) DB(com.codecademy.eventhub.base.DB) Provides(com.google.inject.Provides)

Aggregations

Options (org.iq80.leveldb.Options)26 File (java.io.File)21 IOException (java.io.IOException)14 DB (org.iq80.leveldb.DB)10 Path (org.apache.hadoop.fs.Path)8 NativeDB (org.fusesource.leveldbjni.internal.NativeDB)6 DBException (org.iq80.leveldb.DBException)6 WriteOptions (org.iq80.leveldb.WriteOptions)5 DB (com.codecademy.eventhub.base.DB)3 Provides (com.google.inject.Provides)3 FileSystem (org.apache.hadoop.fs.FileSystem)3 JniDBFactory (org.fusesource.leveldbjni.JniDBFactory)3 RandomAccessFile (java.io.RandomAccessFile)2 CompoundTag (cn.nukkit.nbt.tag.CompoundTag)1 DistributedLogNamespace (com.twitter.distributedlog.namespace.DistributedLogNamespace)1 FileInputStream (java.io.FileInputStream)1 ObjectInputStream (java.io.ObjectInputStream)1 URI (java.net.URI)1 Map (java.util.Map)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1