Class TailCutLayer.TailCutLayerBuilder
java.lang.Object
org.apache.opendal.layer.TailCutLayer.TailCutLayerBuilder
- Enclosing class:
TailCutLayer
Configures the latency history and adaptive deadline.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a tail-cut layer with the configured settings.maxDeadline(Duration maxDeadline) Sets the upper bound for the adaptive deadline.minDeadline(Duration minDeadline) Sets the lower bound for the adaptive deadline.minSamples(int minSamples) Sets the minimum number of latency samples required to enable cancellation.percentile(int percentile) Sets the latency percentile used to calculate the deadline.safetyFactor(double safetyFactor) Sets the multiplier applied to the observed latency percentile.Sets the sliding window for collecting latency statistics.
-
Method Details
-
percentile
Sets the latency percentile used to calculate the deadline.- Parameters:
percentile- the percentile, from 50 to 99 inclusive- Returns:
- this builder
- Throws:
IllegalArgumentException- if the percentile is outside the allowed range
-
safetyFactor
Sets the multiplier applied to the observed latency percentile.- Parameters:
safetyFactor- the multiplier, from 1.0 to 5.0 inclusive- Returns:
- this builder
- Throws:
IllegalArgumentException- if the multiplier is NaN or outside the allowed range
-
window
Sets the sliding window for collecting latency statistics.- Parameters:
window- the window duration- Returns:
- this builder
- Throws:
IllegalArgumentException- if the window is null, negative, or longer than 120 seconds
-
minSamples
Sets the minimum number of latency samples required to enable cancellation.- Parameters:
minSamples- the minimum number of samples- Returns:
- this builder
- Throws:
IllegalArgumentException- if the minimum is negative
-
minDeadline
Sets the lower bound for the adaptive deadline.- Parameters:
minDeadline- the minimum deadline- Returns:
- this builder
- Throws:
IllegalArgumentException- if the deadline is null, negative, or exceedsLong.MAX_VALUEnanoseconds
-
maxDeadline
Sets the upper bound for the adaptive deadline.- Parameters:
maxDeadline- the maximum deadline- Returns:
- this builder
- Throws:
IllegalArgumentException- if the deadline is null, negative, or exceedsLong.MAX_VALUEnanoseconds
-
build
Builds a tail-cut layer with the configured settings.- Returns:
- a new tail-cut layer
- Throws:
IllegalArgumentException- if the minimum deadline exceeds the maximum deadline
-