use of voldemort.store.bdb.PartitionPrefixedBdbStorageEngine in project voldemort by voldemort.
the class CatBdbStore method main.
public static void main(String[] args) throws Exception {
if (args.length != 2)
Utils.croak("USAGE: java " + CatBdbStore.class.getName() + " bdb_dir" + " storeName" + " server.properties.path");
String bdbDir = args[0];
String storeName = args[1];
String serverProperties = args[2];
VoldemortConfig config = new VoldemortConfig(new Props(new File(serverProperties)));
EnvironmentConfig environmentConfig = new EnvironmentConfig();
environmentConfig.setDurability(Durability.COMMIT_NO_SYNC);
environmentConfig.setAllowCreate(true);
environmentConfig.setTransactional(config.isBdbWriteTransactionsEnabled());
Environment environment = new Environment(new File(bdbDir), environmentConfig);
DatabaseConfig databaseConfig = new DatabaseConfig();
databaseConfig.setAllowCreate(true);
databaseConfig.setTransactional(config.isBdbWriteTransactionsEnabled());
databaseConfig.setSortedDuplicates(false);
Database database = environment.openDatabase(null, storeName, databaseConfig);
StorageEngine<ByteArray, byte[], byte[]> store = null;
if (config.getBdbPrefixKeysWithPartitionId()) {
store = new PartitionPrefixedBdbStorageEngine(storeName, environment, database, new BdbRuntimeConfig(), TestUtils.makeSingleNodeRoutingStrategy());
} else {
store = new BdbStorageEngine(storeName, environment, database, new BdbRuntimeConfig());
}
StorageEngine<String, String, String> stringStore = SerializingStorageEngine.wrap(store, new StringSerializer(), new StringSerializer(), new StringSerializer());
Iterator<Pair<String, Versioned<String>>> iter = stringStore.entries();
while (iter.hasNext()) {
Pair<String, Versioned<String>> entry = iter.next();
System.out.println(entry.getFirst() + " => " + entry.getSecond().getValue());
}
}
Aggregations