Search in sources :

Example 6 with DoNothingDuplicateResolver

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);
}
Also used : TupleListFuture(org.bboxdb.network.client.future.TupleListFuture) JoinedTupleListFuture(org.bboxdb.network.client.future.JoinedTupleListFuture) NetworkOperationFuture(org.bboxdb.network.client.future.NetworkOperationFuture) RoutingHeader(org.bboxdb.network.routing.RoutingHeader) DoNothingDuplicateResolver(org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver)

Example 7 with DoNothingDuplicateResolver

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);
}
Also used : DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) TupleListFuture(org.bboxdb.network.client.future.TupleListFuture) JoinedTupleListFuture(org.bboxdb.network.client.future.JoinedTupleListFuture) NetworkOperationFuture(org.bboxdb.network.client.future.NetworkOperationFuture) RoutingHeader(org.bboxdb.network.routing.RoutingHeader) DoNothingDuplicateResolver(org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver) ArrayList(java.util.ArrayList) List(java.util.List) RoutingHop(org.bboxdb.network.routing.RoutingHop) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance) BBoxDBException(org.bboxdb.misc.BBoxDBException)

Example 8 with DoNothingDuplicateResolver

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);
}
Also used : DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) TupleListFuture(org.bboxdb.network.client.future.TupleListFuture) JoinedTupleListFuture(org.bboxdb.network.client.future.JoinedTupleListFuture) NetworkOperationFuture(org.bboxdb.network.client.future.NetworkOperationFuture) RoutingHeader(org.bboxdb.network.routing.RoutingHeader) DoNothingDuplicateResolver(org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver) ArrayList(java.util.ArrayList) List(java.util.List) RoutingHop(org.bboxdb.network.routing.RoutingHop) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance) BBoxDBException(org.bboxdb.misc.BBoxDBException)

Example 9 with DoNothingDuplicateResolver

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));
}
Also used : ArrayList(java.util.ArrayList) DoNothingDuplicateResolver(org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver) Tuple(org.bboxdb.storage.entity.Tuple) JoinedTuple(org.bboxdb.storage.entity.JoinedTuple) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) Test(org.junit.Test)

Example 10 with DoNothingDuplicateResolver

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(), ""));
}
Also used : NetworkRequestPackage(org.bboxdb.network.packages.NetworkRequestPackage) TupleListFuture(org.bboxdb.network.client.future.TupleListFuture) NetworkOperationFuture(org.bboxdb.network.client.future.NetworkOperationFuture) DoNothingDuplicateResolver(org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver) BBoxDBConnection(org.bboxdb.network.client.BBoxDBConnection) TupleListFutureStore(org.bboxdb.network.client.tools.TupleListFutureStore) Test(org.junit.Test)

Aggregations

DoNothingDuplicateResolver (org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver)11 NetworkOperationFuture (org.bboxdb.network.client.future.NetworkOperationFuture)9 TupleListFuture (org.bboxdb.network.client.future.TupleListFuture)9 JoinedTupleListFuture (org.bboxdb.network.client.future.JoinedTupleListFuture)8 RoutingHeader (org.bboxdb.network.routing.RoutingHeader)8 ArrayList (java.util.ArrayList)5 List (java.util.List)4 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)4 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)4 RoutingHop (org.bboxdb.network.routing.RoutingHop)4 BBoxDBException (org.bboxdb.misc.BBoxDBException)3 Tuple (org.bboxdb.storage.entity.Tuple)2 Test (org.junit.Test)2 TupleStoreAdapter (org.bboxdb.distribution.zookeeper.TupleStoreAdapter)1 ZookeeperException (org.bboxdb.distribution.zookeeper.ZookeeperException)1 BBoxDBConnection (org.bboxdb.network.client.BBoxDBConnection)1 TupleListFutureStore (org.bboxdb.network.client.tools.TupleListFutureStore)1 NetworkRequestPackage (org.bboxdb.network.packages.NetworkRequestPackage)1 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)1 JoinedTuple (org.bboxdb.storage.entity.JoinedTuple)1