Class DruidServer

java.lang.Object
org.apache.druid.client.DruidServer
All Implemented Interfaces:
Comparable<DruidServer>

public class DruidServer extends Object implements Comparable<DruidServer>
A mutable collection of metadata of segments (DataSegment objects), stored on a particular Druid server (typically historical). This class should not be subclassed, it isn't declared final only to make it possible to mock the class with EasyMock in tests.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public String getName()
    • getMetadata

      public DruidServerMetadata getMetadata()
    • getHost

      public String getHost()
    • getHostAndPort

      public String getHostAndPort()
    • getHostAndTlsPort

      public String getHostAndTlsPort()
    • getCurrSize

      public long getCurrSize()
    • getMaxSize

      public long getMaxSize()
    • getType

      public ServerType getType()
    • getTier

      public String getTier()
    • isSegmentReplicationTarget

      public boolean isSegmentReplicationTarget()
    • isSegmentBroadcastTarget

      public boolean isSegmentBroadcastTarget()
    • isSegmentReplicationOrBroadcastTarget

      public boolean isSegmentReplicationOrBroadcastTarget()
    • getPriority

      public int getPriority()
    • getScheme

      public String getScheme()
    • iterateAllSegments

      public Iterable<DataSegment> iterateAllSegments()
      Returns an iterable to go over all segments in all data sources, stored on this DruidServer. The order in which segments are iterated is unspecified. Since this DruidServer can be mutated concurrently, the set of segments observed during an iteration may _not_ be a momentary snapshot of the segments on the server, in other words, it may be that there was no moment when the DruidServer stored exactly the returned set of segments. 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.
    • getTotalSegments

      public int getTotalSegments()
      Returns the current number of segments, stored in this DruidServer object. This number if weakly consistent with the number of segments if iterateAllSegments() is iterated about the same time, because segments might be added or removed in parallel.
    • getSegment

      public DataSegment getSegment(SegmentId segmentId)
    • addDataSegment

      public DruidServer addDataSegment(DataSegment segment)
    • addDataSegments

      public DruidServer addDataSegments(DruidServer server)
    • removeDataSegment

      @Nullable public DataSegment removeDataSegment(SegmentId segmentId)
    • getDataSource

      public DruidDataSource getDataSource(String dataSource)
    • getDataSources

      public Collection<DruidDataSource> getDataSources()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • compareTo

      public int compareTo(DruidServer o)
      Specified by:
      compareTo in interface Comparable<DruidServer>
    • toImmutableDruidServer

      public ImmutableDruidServer toImmutableDruidServer()
    • copyWithoutSegments

      public DruidServer copyWithoutSegments()