Search in sources :

Example 1 with CompactionConfigurer

use of org.apache.accumulo.core.client.admin.compaction.CompactionConfigurer in project accumulo by apache.

the class CompactableUtils method computeOverrides.

static Map<String, String> computeOverrides(Tablet tablet, Set<CompactableFile> files, PluginConfig cfg) {
    CompactionConfigurer configurer = CompactableUtils.newInstance(tablet.getTableConfiguration(), cfg.getClassName(), CompactionConfigurer.class);
    final ServiceEnvironment senv = new ServiceEnvironmentImpl(tablet.getContext());
    configurer.init(new CompactionConfigurer.InitParameters() {

        @Override
        public Map<String, String> getOptions() {
            return cfg.getOptions();
        }

        @Override
        public PluginEnvironment getEnvironment() {
            return senv;
        }

        @Override
        public TableId getTableId() {
            return tablet.getExtent().tableId();
        }
    });
    var overrides = configurer.override(new CompactionConfigurer.InputParameters() {

        @Override
        public Collection<CompactableFile> getInputFiles() {
            return files;
        }

        @Override
        public PluginEnvironment getEnvironment() {
            return senv;
        }

        @Override
        public TableId getTableId() {
            return tablet.getExtent().tableId();
        }
    });
    if (overrides.getOverrides().isEmpty()) {
        return null;
    }
    return overrides.getOverrides();
}
Also used : PluginEnvironment(org.apache.accumulo.core.client.PluginEnvironment) TableId(org.apache.accumulo.core.data.TableId) ServiceEnvironment(org.apache.accumulo.core.spi.common.ServiceEnvironment) CompactionConfigurer(org.apache.accumulo.core.client.admin.compaction.CompactionConfigurer) ServiceEnvironmentImpl(org.apache.accumulo.server.ServiceEnvironmentImpl) Collection(java.util.Collection) SummaryCollection(org.apache.accumulo.core.summary.SummaryCollection) Map(java.util.Map) SortedMap(java.util.SortedMap) HashMap(java.util.HashMap)

Aggregations

Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 SortedMap (java.util.SortedMap)1 PluginEnvironment (org.apache.accumulo.core.client.PluginEnvironment)1 CompactionConfigurer (org.apache.accumulo.core.client.admin.compaction.CompactionConfigurer)1 TableId (org.apache.accumulo.core.data.TableId)1 ServiceEnvironment (org.apache.accumulo.core.spi.common.ServiceEnvironment)1 SummaryCollection (org.apache.accumulo.core.summary.SummaryCollection)1 ServiceEnvironmentImpl (org.apache.accumulo.server.ServiceEnvironmentImpl)1