Search in sources :

Example 1 with SpacePartitionerContext

use of org.bboxdb.distribution.partitioner.SpacePartitionerContext in project bboxdb by jnidzwetzki.

the class TestRegionSyncer method buildSyncer.

/**
 * Build a new syncer
 */
private DistributionRegionSyncer buildSyncer() {
    final Set<DistributionRegionCallback> callbacks = new CopyOnWriteArraySet<>();
    final DistributionRegionIdMapper distributionRegionIdMapper = new DistributionRegionIdMapper(GROUP);
    final SpacePartitionerContext spacePartitionerContext = new SpacePartitionerContext("", GROUP, ZookeeperClientFactory.getZookeeperClient(), callbacks, distributionRegionIdMapper);
    return new DistributionRegionSyncer(spacePartitionerContext);
}
Also used : SpacePartitionerContext(org.bboxdb.distribution.partitioner.SpacePartitionerContext) DistributionRegionCallback(org.bboxdb.distribution.region.DistributionRegionCallback) CopyOnWriteArraySet(java.util.concurrent.CopyOnWriteArraySet) DistributionRegionIdMapper(org.bboxdb.distribution.region.DistributionRegionIdMapper) DistributionRegionSyncer(org.bboxdb.distribution.region.DistributionRegionSyncer)

Example 2 with SpacePartitionerContext

use of org.bboxdb.distribution.partitioner.SpacePartitionerContext in project bboxdb by jnidzwetzki.

the class DistributionGroupAdapter method getSpaceparitioner.

/**
 * Get the space partitioner of a distribution group
 * @param mapper
 * @param callback
 * @return
 * @throws ZookeeperException
 * @throws ZookeeperNotFoundException
 */
public SpacePartitioner getSpaceparitioner(final String distributionGroup, final Set<DistributionRegionCallback> callback, final DistributionRegionIdMapper mapper) throws ZookeeperException, ZookeeperNotFoundException {
    final String path = getDistributionGroupPath(distributionGroup);
    if (!zookeeperClient.exists(path)) {
        final String exceptionMessage = MessageFormat.format("Unable to read {0}. Path {1} does not exist", distributionGroup, path);
        throw new ZookeeperException(exceptionMessage);
    }
    final DistributionGroupConfiguration config = DistributionGroupConfigurationCache.getInstance().getDistributionGroupConfiguration(distributionGroup);
    final SpacePartitionerContext spacePartitionerContext = new SpacePartitionerContext(config.getSpacePartitionerConfig(), distributionGroup, zookeeperClient, callback, mapper);
    return SpacePartitionerFactory.getSpacePartitionerForDistributionGroup(spacePartitionerContext);
}
Also used : SpacePartitionerContext(org.bboxdb.distribution.partitioner.SpacePartitionerContext) DistributionGroupConfiguration(org.bboxdb.storage.entity.DistributionGroupConfiguration)

Aggregations

SpacePartitionerContext (org.bboxdb.distribution.partitioner.SpacePartitionerContext)2 CopyOnWriteArraySet (java.util.concurrent.CopyOnWriteArraySet)1 DistributionRegionCallback (org.bboxdb.distribution.region.DistributionRegionCallback)1 DistributionRegionIdMapper (org.bboxdb.distribution.region.DistributionRegionIdMapper)1 DistributionRegionSyncer (org.bboxdb.distribution.region.DistributionRegionSyncer)1 DistributionGroupConfiguration (org.bboxdb.storage.entity.DistributionGroupConfiguration)1