public class StorageLocation extends Object
path via reserve(java.lang.String, org.apache.druid.timeline.DataSegment), so that the total size of stored files doesn't exceed the maxSizeBytes
and available space is always kept smaller than freeSpaceToKeep.
This class is thread-safe, so that multiple threads can update its state at the same time.
One example usage is that a historical can use multiple threads to load different segments in parallel
from deep storage.| Constructor and Description |
|---|
StorageLocation(File path,
long maxSizeBytes,
Double freeSpacePercent) |
| Modifier and Type | Method and Description |
|---|---|
long |
availableSizeBytes() |
long |
currSizeBytes() |
File |
getPath() |
void |
removeFile(File file)
Remove a segment file from this location.
|
void |
removeSegmentDir(File segmentDir,
DataSegment segment)
Remove a segment dir from this location.
|
File |
reserve(String segmentDir,
DataSegment segment)
Reserves space to store the given segment.
|
File |
reserve(String segmentFilePathToAdd,
String segmentId,
long segmentSize)
Reserves space to store the given segment.
|
public File getPath()
public void removeFile(File file)
public void removeSegmentDir(File segmentDir, DataSegment segment)
@Nullable public File reserve(String segmentDir, DataSegment segment)
@Nullable public File reserve(String segmentFilePathToAdd, String segmentId, long segmentSize)
public long availableSizeBytes()
public long currSizeBytes()
Copyright © 2011–2020 The Apache Software Foundation. All rights reserved.