use of org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver in project bboxdb by jnidzwetzki.
the class BBoxDBClient method queryBoundingBoxAndTime.
/* (non-Javadoc)
* @see org.bboxdb.network.client.BBoxDB#queryBoundingBoxAndTime(java.lang.String, org.bboxdb.storage.entity.BoundingBox)
*/
@Override
public TupleListFuture queryBoundingBoxAndTime(final String table, final BoundingBox boundingBox, final long timestamp) {
final RoutingHeader routingHeader = RoutingHeaderHelper.getRoutingHeaderForLocalSystemReadNE(table, boundingBox, false, connection.getServerAddress());
final NetworkOperationFuture future = getBoundingBoxAndTimeFuture(table, boundingBox, timestamp, routingHeader);
return new TupleListFuture(future, new DoNothingDuplicateResolver(), table);
}
use of org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver in project bboxdb by jnidzwetzki.
the class BBoxDBCluster method queryInsertedTime.
@Override
public TupleListFuture queryInsertedTime(final String table, final long timestamp) throws BBoxDBException {
if (membershipConnectionService.getNumberOfConnections() == 0) {
throw new BBoxDBException("queryTime called, but connection list is empty");
}
if (logger.isDebugEnabled()) {
logger.debug("Query by for timestamp {} in table {}", timestamp, table);
}
final DistributionRegion distributionRegion = getRootNode(table);
final Supplier<List<NetworkOperationFuture>> futureProvider = () -> {
final List<RoutingHop> hops = RoutingHopHelper.getRoutingHopsForRead(distributionRegion, BoundingBox.FULL_SPACE);
final List<NetworkOperationFuture> futures = new ArrayList<>();
for (final RoutingHop hop : hops) {
final BBoxDBInstance instance = hop.getDistributedInstance();
final BBoxDBConnection connection = membershipConnectionService.getConnectionForInstance(instance);
final RoutingHeader routingHeader = new RoutingHeader((short) 0, Arrays.asList(hop));
final NetworkOperationFuture future = connection.getBboxDBClient().getInsertedTimeFuture(table, timestamp, routingHeader);
futures.add(future);
}
return futures;
};
return new TupleListFuture(futureProvider, new DoNothingDuplicateResolver(), table);
}
use of org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver in project bboxdb by jnidzwetzki.
the class BBoxDBCluster method queryBoundingBoxAndTime.
@Override
public TupleListFuture queryBoundingBoxAndTime(final String table, final BoundingBox boundingBox, final long timestamp) throws BBoxDBException {
if (membershipConnectionService.getNumberOfConnections() == 0) {
throw new BBoxDBException("queryBoundingBoxAndTime called, but connection list is empty");
}
if (logger.isDebugEnabled()) {
logger.debug("Query by for bounding box {} in table {}", boundingBox, table);
}
final DistributionRegion distributionRegion = getRootNode(table);
final Supplier<List<NetworkOperationFuture>> futureProvider = () -> {
final List<RoutingHop> hops = RoutingHopHelper.getRoutingHopsForRead(distributionRegion, boundingBox);
final List<NetworkOperationFuture> futures = new ArrayList<>();
for (final RoutingHop hop : hops) {
final BBoxDBInstance instance = hop.getDistributedInstance();
final BBoxDBConnection connection = membershipConnectionService.getConnectionForInstance(instance);
final RoutingHeader routingHeader = new RoutingHeader((short) 0, Arrays.asList(hop));
final NetworkOperationFuture future = connection.getBboxDBClient().getBoundingBoxAndTimeFuture(table, boundingBox, timestamp, routingHeader);
futures.add(future);
}
return futures;
};
return new TupleListFuture(futureProvider, new DoNothingDuplicateResolver(), table);
}
use of org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver in project bboxdb by jnidzwetzki.
the class TestTupleHelper method testDoNothingTupleDuplicateResolverVersions.
/**
* Test the do nothing tuple resolver
*/
@Test(timeout = 60000)
public void testDoNothingTupleDuplicateResolverVersions() {
final Tuple tupleA = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 1);
final Tuple tupleB = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 2);
final Tuple tupleC = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 1);
final Tuple tupleD = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 4);
final Tuple tupleE = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 3);
final Tuple tupleF = new Tuple("abc", BoundingBox.FULL_SPACE, "abc".getBytes(), 1);
final List<Tuple> tupleList = new ArrayList<>(Arrays.asList(tupleA, tupleB, tupleC, tupleD, tupleE, tupleF));
final DuplicateResolver<Tuple> resolver = new DoNothingDuplicateResolver();
resolver.removeDuplicates(tupleList);
Assert.assertEquals(6, tupleList.size());
Assert.assertTrue(tupleList.contains(tupleA));
Assert.assertTrue(tupleList.contains(tupleB));
Assert.assertTrue(tupleList.contains(tupleC));
Assert.assertTrue(tupleList.contains(tupleD));
Assert.assertTrue(tupleList.contains(tupleF));
}
use of org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver in project bboxdb by jnidzwetzki.
the class TestTupleListFuture method testRejectedExeption.
@Test(expected = RejectedException.class)
public void testRejectedExeption() throws InterruptedException, RejectedException {
final TupleListFutureStore tupleListFutureStore = new TupleListFutureStore();
tupleListFutureStore.shutdown();
final BBoxDBConnection connection = Mockito.mock(BBoxDBConnection.class);
final Supplier<NetworkRequestPackage> supplier = () -> (null);
final NetworkOperationFuture networkOperationFuture = new NetworkOperationFuture(connection, supplier);
tupleListFutureStore.put(new TupleListFuture(networkOperationFuture, new DoNothingDuplicateResolver(), ""));
}
Aggregations