Class SegmentIdProperties.Chain
java.lang.Object
me.ahoo.cosid.spring.boot.starter.segment.SegmentIdProperties.Chain
- Enclosing class:
- SegmentIdProperties
Configuration for chain-based segment ID generation.
Chain mode provides better performance by maintaining a chain of segments and prefetching new segments before the current one is exhausted.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfiguration for the prefetch worker that manages segment prefetching. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintGets the maximum number of segments a single prefetch may request.Gets the timeout of each background prefetch.Gets the prefetch worker configuration.intGets the safe distance for chain generation.voidsetMaxPrefetchDistance(int maxPrefetchDistance) Sets the maximum number of segments a single prefetch may request.voidsetPrefetchTimeout(Duration prefetchTimeout) Sets the timeout of each background prefetch.voidsetPrefetchWorker(SegmentIdProperties.Chain.PrefetchWorker prefetchWorker) Sets the prefetch worker configuration.voidsetSafeDistance(int safeDistance) Sets the safe distance for chain generation.
-
Constructor Details
-
Chain
public Chain()Constructs a new Chain configuration with default prefetch worker.
-
-
Method Details
-
getSafeDistance
public int getSafeDistance()Gets the safe distance for chain generation.- Returns:
- the safe distance
-
setSafeDistance
public void setSafeDistance(int safeDistance) Sets the safe distance for chain generation.- Parameters:
safeDistance- the safe distance to set
-
getMaxPrefetchDistance
public int getMaxPrefetchDistance()Gets the maximum number of segments a single prefetch may request.- Returns:
- the maximum prefetch distance
-
setMaxPrefetchDistance
public void setMaxPrefetchDistance(int maxPrefetchDistance) Sets the maximum number of segments a single prefetch may request.- Parameters:
maxPrefetchDistance- the maximum prefetch distance, at least the safe distance
-
getPrefetchTimeout
Gets the timeout of each background prefetch.- Returns:
- the prefetch timeout, zero for none
-
setPrefetchTimeout
Sets the timeout of each background prefetch.- Parameters:
prefetchTimeout- the prefetch timeout, zero for none
-
getPrefetchWorker
Gets the prefetch worker configuration.- Returns:
- the prefetch worker configuration
-
setPrefetchWorker
Sets the prefetch worker configuration.- Parameters:
prefetchWorker- the prefetch worker configuration to set
-