Package org.apache.druid.client
Class FilteringSegmentCallback
- java.lang.Object
-
- org.apache.druid.client.FilteringSegmentCallback
-
- All Implemented Interfaces:
ServerView.SegmentCallback
public class FilteringSegmentCallback extends Object implements ServerView.SegmentCallback
A SegmentCallback that is called only when the given filter satisfies.segmentViewInitialized()is an exception and always called when the view is initialized without using the filter. Callback methods returnServerView.CallbackAction.CONTINUEwhen the filter does not satisfy.
-
-
Constructor Summary
Constructors Constructor Description FilteringSegmentCallback(ServerView.SegmentCallback callback, com.google.common.base.Predicate<org.apache.druid.java.util.common.Pair<DruidServerMetadata,org.apache.druid.timeline.DataSegment>> filter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServerView.CallbackActionsegmentAdded(DruidServerMetadata server, org.apache.druid.timeline.DataSegment segment)Called when a segment is added to a server.ServerView.CallbackActionsegmentRemoved(DruidServerMetadata server, org.apache.druid.timeline.DataSegment segment)Called when a segment is removed from a server.ServerView.CallbackActionsegmentSchemasAnnounced(SegmentSchemas segmentSchemas)Called when segment schema is announced.ServerView.CallbackActionsegmentViewInitialized()
-
-
-
Constructor Detail
-
FilteringSegmentCallback
public FilteringSegmentCallback(ServerView.SegmentCallback callback, com.google.common.base.Predicate<org.apache.druid.java.util.common.Pair<DruidServerMetadata,org.apache.druid.timeline.DataSegment>> filter)
-
-
Method Detail
-
segmentAdded
public ServerView.CallbackAction segmentAdded(DruidServerMetadata server, org.apache.druid.timeline.DataSegment segment)
Description copied from interface:ServerView.SegmentCallbackCalled when a segment is added to a server. The return value indicates if this callback has completed its work. Note that even if this callback indicates that it should be unregistered, it is not possible to guarantee that this callback will not get called again. There is a race condition between when this callback runs and other events that can cause the callback to be queued for running. Thus, callbacks shouldn't assume that they will not get called again after they are done. The contract is that the callback will eventually be unregistered, enforcing a happens-before relationship is not part of the contract.- Specified by:
segmentAddedin interfaceServerView.SegmentCallback- Parameters:
server- The server that added a segmentsegment- The segment that was added- Returns:
- UNREGISTER if the callback has completed its work and should be unregistered. CONTINUE if the callback should remain registered.
-
segmentRemoved
public ServerView.CallbackAction segmentRemoved(DruidServerMetadata server, org.apache.druid.timeline.DataSegment segment)
Description copied from interface:ServerView.SegmentCallbackCalled when a segment is removed from a server. The return value indicates if this callback has completed its work. Note that even if this callback indicates that it should be unregistered, it is not possible to guarantee that this callback will not get called again. There is a race condition between when this callback runs and other events that can cause the callback to be queued for running. Thus, callbacks shouldn't assume that they will not get called again after they are done. The contract is that the callback will eventually be unregistered, enforcing a happens-before relationship is not part of the contract.- Specified by:
segmentRemovedin interfaceServerView.SegmentCallback- Parameters:
server- The server that removed a segmentsegment- The segment that was removed- Returns:
- UNREGISTER if the callback has completed its work and should be unregistered. CONTINUE if the callback should remain registered.
-
segmentViewInitialized
public ServerView.CallbackAction segmentViewInitialized()
- Specified by:
segmentViewInitializedin interfaceServerView.SegmentCallback
-
segmentSchemasAnnounced
public ServerView.CallbackAction segmentSchemasAnnounced(SegmentSchemas segmentSchemas)
Description copied from interface:ServerView.SegmentCallbackCalled when segment schema is announced.- Specified by:
segmentSchemasAnnouncedin interfaceServerView.SegmentCallback- Parameters:
segmentSchemas- segment schema- Returns:
- continue or unregister
-
-