Package org.apache.druid.client
Class DataSourcesSnapshot
java.lang.Object
org.apache.druid.client.DataSourcesSnapshot
An immutable snapshot of metadata information about used segments and overshadowed segments, coming from
SegmentsMetadataManager.-
Method Summary
Modifier and TypeMethodDescriptionstatic DataSourcesSnapshotfromUsedSegments(Iterable<DataSegment> segments) static DataSourcesSnapshotfromUsedSegments(Iterable<DataSegment> segments, org.joda.time.DateTime snapshotTime) Creates a snapshot of all "used" segments that existed in the database at thesnapshotTime.static DataSourcesSnapshotfromUsedSegments(Map<String, Set<DataSegment>> datasourceToUsedSegments, org.joda.time.DateTime snapshotTime) Creates a snapshot of all "used" segments that existed in the database at thesnapshotTime.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.getDataSource(String dataSourceName) com.google.common.collect.ImmutableSet<DataSegment>org.joda.time.DateTimeTime when this snapshot was taken.Returns an iterable to go over all used segments in all data sources.
-
Method Details
-
fromUsedSegments
-
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 thesnapshotTime. -
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 thesnapshotTime. -
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
-
getDataSourcesMap
-
getDataSource
-
getUsedSegmentsTimelinesPerDataSource
-
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
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()) {...}
-