Package org.apache.druid.segment.loading
Interface StorageLocationSelectorStrategy
- All Known Implementing Classes:
LeastBytesUsedStorageLocationSelectorStrategy,MostAvailableSizeStorageLocationSelectorStrategy,RandomStorageLocationSelectorStrategy,RoundRobinStorageLocationSelectorStrategy
public interface StorageLocationSelectorStrategy
This interface describes the storage location selection strategy which is responsible for ordering the
available multiple
StorageLocations for segment distribution.
Only a snapshot of the locations is returned here. The implemntations currently do not handle all kinds of
concurrency issues and accesses to the underlying storage. Please see
https://github.com/apache/druid/pull/8038#discussion_r325520829 of PR https://github
.com/apache/druid/pull/8038 for more details.-
Method Summary
Modifier and TypeMethodDescriptionFinds the best ordering of theStorageLocations to load aDataSegmentaccording to the location selector strategy.
-
Method Details
-
getLocations
Iterator<StorageLocation> getLocations()Finds the best ordering of theStorageLocations to load aDataSegmentaccording to the location selector strategy. This method returns an iterator instead of a single best location. The caller is responsible for iterating over the locations and callingStorageLocation.reserve(java.lang.String, org.apache.druid.timeline.DataSegment)method. This is because a single location may be problematic like failed disk or might become unwritable for whatever reasons. This method can be called by different threads and so should be thread-safe.- Returns:
- An iterator of
StorageLocations from which the callers can iterate and pick a location.
-