Search in sources :

Example 76 with TupleStoreName

use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.

the class SamplingHelper method getSamples.

/**
 * Get the samples
 *
 * @param boundingBox
 * @param splitDimension
 * @param tables
 * @return
 * @throws StorageManagerException
 */
private static List<BoundingBox> getSamples(final BoundingBox boundingBox, final TupleStoreManagerRegistry tupleStoreManagerRegistry, final List<TupleStoreName> tables) throws StorageManagerException {
    final List<BoundingBox> allPointSamples = new ArrayList<>();
    for (final TupleStoreName ssTableName : tables) {
        logger.info("Create split samples for table: {} ", ssTableName.getFullname());
        final TupleStoreManager sstableManager = tupleStoreManagerRegistry.getTupleStoreManager(ssTableName);
        final List<ReadOnlyTupleStore> tupleStores = sstableManager.getAllTupleStorages();
        final List<BoundingBox> pointSamples = processTupleStores(tupleStores);
        allPointSamples.addAll(pointSamples);
        logger.info("Create split samples for table: {} DONE. Got {} samples.", ssTableName.getFullname(), pointSamples.size());
    }
    return allPointSamples;
}
Also used : BoundingBox(org.bboxdb.commons.math.BoundingBox) ArrayList(java.util.ArrayList) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) ReadOnlyTupleStore(org.bboxdb.storage.tuplestore.ReadOnlyTupleStore) TupleStoreManager(org.bboxdb.storage.tuplestore.manager.TupleStoreManager)

Example 77 with TupleStoreName

use of org.bboxdb.storage.entity.TupleStoreName in project bboxdb by jnidzwetzki.

the class TupleStoreConfigurationCache method getDuplicateResolverForTupleStore.

public synchronized DuplicateResolver<Tuple> getDuplicateResolverForTupleStore(final String tupleStorename) {
    if (!cache.containsKey(tupleStorename)) {
        try {
            final TupleStoreAdapter tupleStoreAdapter = ZookeeperClientFactory.getZookeeperClient().getTupleStoreAdapter();
            final TupleStoreName tupleStoreNameObject = new TupleStoreName(tupleStorename);
            if (!tupleStoreAdapter.isTableKnown(tupleStoreNameObject)) {
                logger.error("Table {} is not known, using do nothing duplicate resolver", tupleStorename);
                return new DoNothingDuplicateResolver();
            }
            final TupleStoreConfiguration tupleStoreConfiguration = tupleStoreAdapter.readTuplestoreConfiguration(tupleStoreNameObject);
            final DuplicateResolver<Tuple> resolver = TupleDuplicateResolverFactory.build(tupleStoreConfiguration);
            cache.put(tupleStorename, resolver);
        } catch (ZookeeperException e) {
            logger.error("Exception while reading zookeeper data", e);
            return new DoNothingDuplicateResolver();
        }
    }
    final DuplicateResolver<Tuple> duplicateResolver = cache.get(tupleStorename);
    return duplicateResolver;
}
Also used : ZookeeperException(org.bboxdb.distribution.zookeeper.ZookeeperException) TupleStoreConfiguration(org.bboxdb.storage.entity.TupleStoreConfiguration) TupleStoreAdapter(org.bboxdb.distribution.zookeeper.TupleStoreAdapter) DoNothingDuplicateResolver(org.bboxdb.storage.sstable.duplicateresolver.DoNothingDuplicateResolver) TupleStoreName(org.bboxdb.storage.entity.TupleStoreName) Tuple(org.bboxdb.storage.entity.Tuple)

Aggregations

TupleStoreName (org.bboxdb.storage.entity.TupleStoreName)77 Test (org.junit.Test)25 Tuple (org.bboxdb.storage.entity.Tuple)18 StorageManagerException (org.bboxdb.storage.StorageManagerException)15 ArrayList (java.util.ArrayList)14 PackageEncodeException (org.bboxdb.network.packages.PackageEncodeException)14 SpacePartitioner (org.bboxdb.distribution.partitioner.SpacePartitioner)13 ByteBuffer (java.nio.ByteBuffer)12 BoundingBox (org.bboxdb.commons.math.BoundingBox)12 DistributionRegionIdMapper (org.bboxdb.distribution.region.DistributionRegionIdMapper)12 BBoxDBException (org.bboxdb.misc.BBoxDBException)12 InsertTupleRequest (org.bboxdb.network.packages.request.InsertTupleRequest)12 RoutingHeader (org.bboxdb.network.routing.RoutingHeader)12 TupleStoreConfiguration (org.bboxdb.storage.entity.TupleStoreConfiguration)12 TupleStoreManager (org.bboxdb.storage.tuplestore.manager.TupleStoreManager)11 List (java.util.List)10 JoinedTuple (org.bboxdb.storage.entity.JoinedTuple)10 TupleStoreManagerRegistry (org.bboxdb.storage.tuplestore.manager.TupleStoreManagerRegistry)10 ErrorResponse (org.bboxdb.network.packages.response.ErrorResponse)9 DeletedTuple (org.bboxdb.storage.entity.DeletedTuple)9