Search in sources :

Example 1 with DB

use of com.codecademy.eventhub.base.DB in project EventHub by Codecademy.

the class DatedEventIndexModule method getDatedEventIndex.

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

Example 2 with DB

use of com.codecademy.eventhub.base.DB 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 3 with DB

use of com.codecademy.eventhub.base.DB 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

DB (com.codecademy.eventhub.base.DB)3 Provides (com.google.inject.Provides)3 File (java.io.File)3 Options (org.iq80.leveldb.Options)3