Search in sources :

Example 21 with RotationStrategy

use of org.graylog2.plugin.indexer.rotation.RotationStrategy in project graylog2-server by Graylog2.

the class RotationStrategyResource method isEnabledRotationStrategy.

// Limit available rotation strategies to those specified by configuration parameter enabled_index_rotation_strategies
private boolean isEnabledRotationStrategy(String strategyName) {
    final Provider<RotationStrategy> provider = rotationStrategies.get(strategyName);
    if (provider == null) {
        throw new NotFoundException("Couldn't find rotation strategy for given type " + strategyName);
    }
    final RotationStrategy rotationStrategy = provider.get();
    return elasticsearchConfiguration.getEnabledRotationStrategies().contains(rotationStrategy.getStrategyName());
}
Also used : RotationStrategy(org.graylog2.plugin.indexer.rotation.RotationStrategy) NotFoundException(javax.ws.rs.NotFoundException)

Aggregations

IndexSetConfig (org.graylog2.indexer.indexset.IndexSetConfig)12 Test (org.junit.Test)12 RotationStrategyConfig (org.graylog2.plugin.indexer.rotation.RotationStrategyConfig)9 RotationStrategy (org.graylog2.plugin.indexer.rotation.RotationStrategy)8 DeletionRetentionStrategyConfig (org.graylog2.indexer.retention.strategies.DeletionRetentionStrategyConfig)6 MessageCountRotationStrategyConfig (org.graylog2.indexer.rotation.strategies.MessageCountRotationStrategyConfig)6 RetentionStrategyConfig (org.graylog2.plugin.indexer.retention.RetentionStrategyConfig)6 IndexSet (org.graylog2.indexer.IndexSet)3 IndexManagementConfig (org.graylog2.indexer.management.IndexManagementConfig)3 NullActivityWriter (org.graylog2.shared.system.activities.NullActivityWriter)3 InternalServerErrorException (javax.ws.rs.InternalServerErrorException)2 NotFoundException (javax.ws.rs.NotFoundException)2 DefaultIndexSetConfig (org.graylog2.indexer.indexset.DefaultIndexSetConfig)2 DeletionRetentionStrategy (org.graylog2.indexer.retention.strategies.DeletionRetentionStrategy)2 DateTime (org.joda.time.DateTime)2 Timed (com.codahale.metrics.annotation.Timed)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1 SchemaFactoryWrapper (com.fasterxml.jackson.module.jsonSchema.factories.SchemaFactoryWrapper)1 DuplicateKeyException (com.mongodb.DuplicateKeyException)1 ApiOperation (io.swagger.annotations.ApiOperation)1