Search in sources :

Example 21 with IndexRange

use of org.graylog2.indexer.ranges.IndexRange in project graylog2-server by Graylog2.

the class IndexRangesResource method list.

@GET
@Timed
@ApiOperation(value = "Get a list of all index ranges")
@Produces(MediaType.APPLICATION_JSON)
public IndexRangesResponse list() {
    final SortedSet<IndexRange> all = indexRangeService.findAll();
    final List<IndexRangeSummary> ranges = Lists.newArrayListWithCapacity(all.size());
    for (IndexRange range : all) {
        if (!isPermitted(RestPermissions.INDEXRANGES_READ, range.indexName())) {
            continue;
        }
        final IndexRangeSummary indexRange = IndexRangeSummary.create(range.indexName(), range.begin(), range.end(), range.calculatedAt(), range.calculationDuration());
        ranges.add(indexRange);
    }
    return IndexRangesResponse.create(ranges.size(), ranges);
}
Also used : IndexRange(org.graylog2.indexer.ranges.IndexRange) IndexRangeSummary(org.graylog2.rest.models.system.indexer.responses.IndexRangeSummary) Produces(javax.ws.rs.Produces) Timed(com.codahale.metrics.annotation.Timed) GET(javax.ws.rs.GET) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

IndexRange (org.graylog2.indexer.ranges.IndexRange)17 DateTime (org.joda.time.DateTime)11 Test (org.junit.Test)10 MongoIndexRange (org.graylog2.indexer.ranges.MongoIndexRange)9 ZonedDateTime (java.time.ZonedDateTime)8 IndexSet (org.graylog2.indexer.IndexSet)5 TimeRange (org.graylog2.plugin.indexer.searches.timeranges.TimeRange)5 NotFoundException (org.graylog2.database.NotFoundException)3 SearchResult (org.graylog2.indexer.results.SearchResult)3 Timed (com.codahale.metrics.annotation.Timed)2 Stopwatch (com.google.common.base.Stopwatch)2 ImmutableSortedSet (com.google.common.collect.ImmutableSortedSet)2 UsingDataSet (com.lordofthejars.nosqlunit.annotation.UsingDataSet)2 ApiOperation (io.swagger.annotations.ApiOperation)2 GET (javax.ws.rs.GET)2 Produces (javax.ws.rs.Produces)2 TimeValue (org.elasticsearch.common.unit.TimeValue)2 SearchHits (org.elasticsearch.search.SearchHits)2 AbstractAlertCondition (org.graylog2.alerts.AbstractAlertCondition)2 AlertConditionTest (org.graylog2.alerts.AlertConditionTest)2