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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations