Package org.apache.druid.client
Class DruidDataSource
- java.lang.Object
-
- org.apache.druid.client.DruidDataSource
-
public class DruidDataSource extends Object
A mutable collection of metadata of segments (DataSegmentobjects), belonging to a particular data source. Concurrency: could be updated concurrently viaaddSegment(org.apache.druid.timeline.DataSegment),removeSegment(org.apache.druid.timeline.SegmentId), andremoveSegmentsIf(java.util.function.Predicate<org.apache.druid.timeline.DataSegment>), and accessed concurrently (e. g. viagetSegments()) as well.- See Also:
- an immutable counterpart of this class
-
-
Constructor Summary
Constructors Constructor Description DruidDataSource(String name, Map<String,String> properties)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DruidDataSourceaddSegment(org.apache.druid.timeline.DataSegment dataSegment)booleanaddSegmentIfAbsent(org.apache.druid.timeline.DataSegment dataSegment)Returns true if the segment was added, false if a segment with the sameSegmentIdalready existed in this DruidDataSource.booleanequals(Object o)StringgetName()Map<String,String>getProperties()org.apache.druid.timeline.DataSegmentgetSegment(org.apache.druid.timeline.SegmentId segmentId)Collection<org.apache.druid.timeline.DataSegment>getSegments()inthashCode()booleanisEmpty()org.apache.druid.timeline.DataSegmentremoveSegment(org.apache.druid.timeline.SegmentId segmentId)Returns the removed segment, or null if there was no segment with the givenSegmentIdin this DruidDataSource.voidremoveSegmentsIf(Predicate<org.apache.druid.timeline.DataSegment> filter)Removes segments for which the given filter returns true.ImmutableDruidDataSourcetoImmutableDruidDataSource()StringtoString()
-
-
-
Method Detail
-
getName
public String getName()
-
getSegment
@Nullable public org.apache.druid.timeline.DataSegment getSegment(org.apache.druid.timeline.SegmentId segmentId)
-
getSegments
public Collection<org.apache.druid.timeline.DataSegment> getSegments()
-
removeSegmentsIf
public void removeSegmentsIf(Predicate<org.apache.druid.timeline.DataSegment> filter)
Removes segments for which the given filter returns true.
-
addSegment
public DruidDataSource addSegment(org.apache.druid.timeline.DataSegment dataSegment)
-
addSegmentIfAbsent
public boolean addSegmentIfAbsent(org.apache.druid.timeline.DataSegment dataSegment)
Returns true if the segment was added, false if a segment with the sameSegmentIdalready existed in this DruidDataSource.
-
removeSegment
@Nullable public org.apache.druid.timeline.DataSegment removeSegment(org.apache.druid.timeline.SegmentId segmentId)
Returns the removed segment, or null if there was no segment with the givenSegmentIdin this DruidDataSource.
-
isEmpty
public boolean isEmpty()
-
toImmutableDruidDataSource
public ImmutableDruidDataSource toImmutableDruidDataSource()
-
-