Package org.apache.druid.client
Class DruidServer
java.lang.Object
org.apache.druid.client.DruidServer
- All Implemented Interfaces:
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDruidServer(String name, String hostAndPort, String hostAndTlsPort, long maxSize, ServerType type, String tier, int priority) DruidServer(DruidServerMetadata metadata) DruidServer(DruidNode node, DruidServerConfig config, ServerType type) -
Method Summary
Modifier and TypeMethodDescriptionaddDataSegment(DataSegment segment) addDataSegments(DruidServer server) intbooleanlonggetDataSource(String dataSource) getHost()longgetName()intgetSegment(SegmentId segmentId) getTier()intReturns the current number of segments, stored in this DruidServer object.getType()inthashCode()booleanbooleanbooleanReturns an iterable to go over all segments in all data sources, stored on this DruidServer.removeDataSegment(SegmentId segmentId) toString()
-
Field Details
-
DEFAULT_PRIORITY
public static final int DEFAULT_PRIORITY- See Also:
-
DEFAULT_NUM_REPLICANTS
public static final int DEFAULT_NUM_REPLICANTS- See Also:
-
DEFAULT_TIER
- See Also:
-
-
Constructor Details
-
DruidServer
-
DruidServer
public DruidServer(String name, String hostAndPort, String hostAndTlsPort, long maxSize, ServerType type, String tier, int priority) -
DruidServer
-
-
Method Details
-
getName
-
getMetadata
-
getHost
-
getHostAndPort
-
getHostAndTlsPort
-
getCurrSize
public long getCurrSize() -
getMaxSize
public long getMaxSize() -
getType
-
getTier
-
isSegmentReplicationTarget
public boolean isSegmentReplicationTarget() -
isSegmentBroadcastTarget
public boolean isSegmentBroadcastTarget() -
isSegmentReplicationOrBroadcastTarget
public boolean isSegmentReplicationOrBroadcastTarget() -
getPriority
public int getPriority() -
getScheme
-
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 ifiterateAllSegments()is iterated about the same time, because segments might be added or removed in parallel. -
getSegment
-
addDataSegment
-
addDataSegments
-
removeDataSegment
-
getDataSource
-
getDataSources
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<DruidServer>
-
toImmutableDruidServer
-
copyWithoutSegments
-