Search in sources :

Example 16 with NetworkOperationFuture

use of org.bboxdb.network.client.future.NetworkOperationFuture in project bboxdb by jnidzwetzki.

the class BBoxDBClient method lockTuple.

@Override
public EmptyResultFuture lockTuple(final String table, final Tuple tuple) throws BBoxDBException {
    final RoutingHeader routingHeader = RoutingHeaderHelper.getRoutingHeaderForLocalSystemWriteNE(table, BoundingBox.FULL_SPACE, true, connection.getServerAddress());
    final NetworkOperationFuture future = createLockTupleFuture(table, tuple, routingHeader);
    // When version locking fails, try again with another version
    return new EmptyResultFuture(future, FutureRetryPolicy.RETRY_POLICY_NONE);
}
Also used : NetworkOperationFuture(org.bboxdb.network.client.future.NetworkOperationFuture) RoutingHeader(org.bboxdb.network.routing.RoutingHeader) EmptyResultFuture(org.bboxdb.network.client.future.EmptyResultFuture)

Example 17 with NetworkOperationFuture

use of org.bboxdb.network.client.future.NetworkOperationFuture in project bboxdb by jnidzwetzki.

the class BBoxDBClient method queryKey.

/* (non-Javadoc)
	 * @see org.bboxdb.network.client.BBoxDB#queryKey(java.lang.String, java.lang.String)
	 */
@Override
public TupleListFuture queryKey(final String table, final String key) {
    final RoutingHeader routingHeader = RoutingHeaderHelper.getRoutingHeaderForLocalSystemReadNE(table, BoundingBox.FULL_SPACE, true, connection.getServerAddress());
    final NetworkOperationFuture future = getQueryKeyFuture(table, key, routingHeader);
    final DuplicateResolver<Tuple> duplicateResolver = TupleStoreConfigurationCache.getInstance().getDuplicateResolverForTupleStore(table);
    return new TupleListFuture(future, duplicateResolver, 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) Tuple(org.bboxdb.storage.entity.Tuple) DeletedTuple(org.bboxdb.storage.entity.DeletedTuple)

Example 18 with NetworkOperationFuture

use of org.bboxdb.network.client.future.NetworkOperationFuture in project bboxdb by jnidzwetzki.

the class BBoxDBClient method queryInsertedTime.

/* (non-Javadoc)
	 * @see org.bboxdb.network.client.BBoxDB#queryTime(java.lang.String, long)
	 */
@Override
public TupleListFuture queryInsertedTime(final String table, final long timestamp) {
    final RoutingHeader routingHeader = RoutingHeaderHelper.getRoutingHeaderForLocalSystemReadNE(table, BoundingBox.FULL_SPACE, true, connection.getServerAddress());
    final NetworkOperationFuture future = getInsertedTimeFuture(table, 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 19 with NetworkOperationFuture

use of org.bboxdb.network.client.future.NetworkOperationFuture 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 20 with NetworkOperationFuture

use of org.bboxdb.network.client.future.NetworkOperationFuture in project bboxdb by jnidzwetzki.

the class BBoxDBCluster method deleteTuple.

@Override
public EmptyResultFuture deleteTuple(final String table, final String key, final long timestamp) throws BBoxDBException {
    final DeletedTuple tuple = new DeletedTuple(key);
    final DistributionRegion distributionRegion = getRootNode(table);
    final Supplier<List<NetworkOperationFuture>> supplier = () -> {
        final List<RoutingHop> hops = RoutingHopHelper.getRoutingHopsForWrite(distributionRegion, tuple.getBoundingBox());
        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().getInsertTupleFuture(table, tuple, routingHeader);
            futures.add(future);
        }
        return futures;
    };
    return new EmptyResultFuture(supplier);
}
Also used : DeletedTuple(org.bboxdb.storage.entity.DeletedTuple) DistributionRegion(org.bboxdb.distribution.region.DistributionRegion) NetworkOperationFuture(org.bboxdb.network.client.future.NetworkOperationFuture) RoutingHeader(org.bboxdb.network.routing.RoutingHeader) ArrayList(java.util.ArrayList) List(java.util.List) RoutingHop(org.bboxdb.network.routing.RoutingHop) BBoxDBInstance(org.bboxdb.distribution.membership.BBoxDBInstance) EmptyResultFuture(org.bboxdb.network.client.future.EmptyResultFuture)

Aggregations

NetworkOperationFuture (org.bboxdb.network.client.future.NetworkOperationFuture)31 RoutingHeader (org.bboxdb.network.routing.RoutingHeader)16 List (java.util.List)12 JoinedTupleListFuture (org.bboxdb.network.client.future.JoinedTupleListFuture)12 TupleListFuture (org.bboxdb.network.client.future.TupleListFuture)11 DoNothingDuplicateResolver (org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver)9 ArrayList (java.util.ArrayList)8 BBoxDBInstance (org.bboxdb.distribution.membership.BBoxDBInstance)8 DistributionRegion (org.bboxdb.distribution.region.DistributionRegion)8 RoutingHop (org.bboxdb.network.routing.RoutingHop)8 Test (org.junit.Test)8 OperationFutureImpl (org.bboxdb.network.client.future.OperationFutureImpl)6 EmptyResultFuture (org.bboxdb.network.client.future.EmptyResultFuture)5 BBoxDBException (org.bboxdb.misc.BBoxDBException)4 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)3 BBoxDBConnection (org.bboxdb.network.client.BBoxDBConnection)2 NetworkRequestPackage (org.bboxdb.network.packages.NetworkRequestPackage)2 Tuple (org.bboxdb.storage.entity.Tuple)2 IOException (java.io.IOException)1 SocketException (java.net.SocketException)1