Class DataSourcesSnapshot

java.lang.Object
org.apache.druid.client.DataSourcesSnapshot

public class DataSourcesSnapshot extends Object
An immutable snapshot of metadata information about used segments and overshadowed segments, coming from SegmentsMetadataManager.
  • Method Details

    • fromUsedSegments

      public static DataSourcesSnapshot fromUsedSegments(Iterable<DataSegment> segments)
    • fromUsedSegments

      public static DataSourcesSnapshot fromUsedSegments(Map<String,Set<DataSegment>> datasourceToUsedSegments, org.joda.time.DateTime snapshotTime)
      Creates a snapshot of all "used" segments that existed in the database at the snapshotTime.
    • fromUsedSegments

      public static DataSourcesSnapshot fromUsedSegments(Iterable<DataSegment> segments, org.joda.time.DateTime snapshotTime)
      Creates a snapshot of all "used" segments that existed in the database at the snapshotTime.
    • getSnapshotTime

      public org.joda.time.DateTime getSnapshotTime()
      Time when this snapshot was taken. Since polling segments from the database may be a slow operation, this represents the poll start time.
    • getDataSourcesWithAllUsedSegments

      public Collection<ImmutableDruidDataSource> getDataSourcesWithAllUsedSegments()
    • getDataSourcesMap

      public Map<String,ImmutableDruidDataSource> getDataSourcesMap()
    • getDataSource

      @Nullable public ImmutableDruidDataSource getDataSource(String dataSourceName)
    • getUsedSegmentsTimelinesPerDataSource

      public Map<String,SegmentTimeline> getUsedSegmentsTimelinesPerDataSource()
    • getOvershadowedSegments

      public com.google.common.collect.ImmutableSet<DataSegment> getOvershadowedSegments()
    • getAllUsedNonOvershadowedSegments

      public Set<DataSegment> getAllUsedNonOvershadowedSegments(String dataSource, org.joda.time.Interval interval)
      Gets all the used segments for the datasource that overlap with the given interval and are not completely overshadowed.
    • iterateAllUsedSegmentsInSnapshot

      public Iterable<DataSegment> iterateAllUsedSegmentsInSnapshot()
      Returns an iterable to go over all used segments in all data sources. The order in which segments are iterated is unspecified. Note: the iteration may not be as trivially cheap as, for example, iteration over an ArrayList. Try (to some reasonable extent) to organize the code so that it iterates the returned iterable only once rather than several times. This method's name starts with "iterate" because the result is expected to be consumed immediately in a for-each statement or a stream pipeline, like for (DataSegment segment : snapshot.iterateAllUsedSegmentsInSnapshot()) {...}