Class SegmentIdProperties.Chain

java.lang.Object
me.ahoo.cosid.spring.boot.starter.segment.SegmentIdProperties.Chain
Enclosing class:
SegmentIdProperties

public static class SegmentIdProperties.Chain extends Object
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.

  • 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

      public Duration getPrefetchTimeout()
      Gets the timeout of each background prefetch.
      Returns:
      the prefetch timeout, zero for none
    • setPrefetchTimeout

      public void setPrefetchTimeout(Duration prefetchTimeout)
      Sets the timeout of each background prefetch.
      Parameters:
      prefetchTimeout - the prefetch timeout, zero for none
    • getPrefetchWorker

      public SegmentIdProperties.Chain.PrefetchWorker getPrefetchWorker()
      Gets the prefetch worker configuration.
      Returns:
      the prefetch worker configuration
    • setPrefetchWorker

      public void setPrefetchWorker(SegmentIdProperties.Chain.PrefetchWorker prefetchWorker)
      Sets the prefetch worker configuration.
      Parameters:
      prefetchWorker - the prefetch worker configuration to set