use of org.neo4j.helpers.Pair in project neo4j-mobile-android by neo4j-contrib.
the class OrderedByTypeExpander method doExpand.
@Override
Iterator<Relationship> doExpand(final Node start) {
return new NestingIterator<Relationship, Pair<RelationshipType, Direction>>(orderedTypes.iterator()) {
@Override
protected Iterator<Relationship> createNestedIterator(Pair<RelationshipType, Direction> entry) {
RelationshipType type = entry.first();
Direction dir = entry.other();
return ((dir == Direction.BOTH) ? start.getRelationships(type) : start.getRelationships(type, dir)).iterator();
}
};
}
use of org.neo4j.helpers.Pair in project graphdb by neo4j-attic.
the class HighlyAvailableGraphDatabase method getSlaveContext.
@Override
public SlaveContext getSlaveContext(int eventIdentifier) {
XaDataSourceManager localDataSourceManager = getConfig().getTxModule().getXaDataSourceManager();
Collection<XaDataSource> dataSources = localDataSourceManager.getAllRegisteredDataSources();
@SuppressWarnings("unchecked") Pair<String, Long>[] txs = new Pair[dataSources.size()];
int i = 0;
for (XaDataSource dataSource : dataSources) {
txs[i++] = Pair.of(dataSource.getName(), dataSource.getLastCommittedTxId());
}
return new SlaveContext(machineId, eventIdentifier, txs);
}
use of org.neo4j.helpers.Pair in project graphdb by neo4j-attic.
the class HighlyAvailableGraphDatabase method copyStoreFromMaster.
private void copyStoreFromMaster(Pair<Master, Machine> master) throws Exception {
msgLog.logMessage("Copying store from master");
Response<Void> response = master.first().copyStore(new SlaveContext(machineId, 0, new Pair[0]), new ToFileStoreWriter(storeDir));
EmbeddedGraphDatabase tempDb = new EmbeddedGraphDatabase(storeDir);
try {
MasterUtil.applyReceivedTransactions(response, tempDb, MasterUtil.txHandlerForFullCopy());
} finally {
tempDb.shutdown();
}
msgLog.logMessage("Done copying store from master");
}
use of org.neo4j.helpers.Pair in project graphdb by neo4j-attic.
the class OnlineBackup method slaveContextOf.
@SuppressWarnings("unchecked")
private SlaveContext slaveContextOf(GraphDatabaseService graphDb) {
XaDataSourceManager dsManager = ((AbstractGraphDatabase) graphDb).getConfig().getTxModule().getXaDataSourceManager();
List<Pair<String, Long>> txs = new ArrayList<Pair<String, Long>>();
for (XaDataSource ds : dsManager.getAllRegisteredDataSources()) {
txs.add(Pair.of(ds.getName(), ds.getLastCommittedTxId()));
}
return new SlaveContext(0, 0, txs.toArray(new Pair[0]));
}
use of org.neo4j.helpers.Pair in project graphdb by neo4j-attic.
the class TestChangingOfLogFormat method inabilityToStartFromOldFormatFromNonCleanShutdown.
@Test
public void inabilityToStartFromOldFormatFromNonCleanShutdown() throws Exception {
String storeDir = "target/var/oldlog";
deleteFileOrDirectory(storeDir);
GraphDatabaseService db = new EmbeddedGraphDatabase(storeDir);
Transaction tx = db.beginTx();
db.createNode();
tx.success();
tx.finish();
Pair<Pair<File, File>, Pair<File, File>> copy = copyLogicalLog(storeDir);
decrementLogFormat(copy.other().other());
db.shutdown();
renameCopiedLogicalLog(storeDir);
try {
db = new EmbeddedGraphDatabase(storeDir);
fail("Shouldn't be able to do recovery (and upgrade log format version) on non-clean shutdown");
} catch (Exception e) {
// Good
e.printStackTrace();
}
}
Aggregations