Record Class CosIdProperties.Generator

java.lang.Object
java.lang.Record
me.ahoo.cosid.spring.autoconfigure.CosIdProperties.Generator
Record Components:
strategy - snowflake, cosid80, segment, periodic-segment, custom or uuidv7
disabled - declared but not created (D24): its bean throws GeneratorDisabledException
layout - time-based: the layout preset; snowflake: SNOWFLAKE_MS (default), SNOWFLAKE_S, JS_SAFE_MS or JS_SAFE_S; cosid80: COSID_80 (default) only
epoch - snowflake: overrides the preset's epoch; cosid80 keeps the Unix epoch
unit - snowflake: overrides the preset's time unit, MILLIS or SECONDS; cosid80 keeps milliseconds
timeBits - time-based: overrides the preset's time bits (4.x timestamp-bit)
nodeBits - time-based: overrides the preset's node bits (4.x machine-bit)
seqBits - time-based: overrides the preset's sequence bits (4.x sequence-bit)
seqResetThreshold - time-based: overrides the highest sequence a new time unit may start from (4.x sequence-reset-threshold); default the preset's, or half the sequence range when seq-bits is set
machine - time-based: the machine whose slot the ids carry, a cosid.machines name (D37); default the cosid.machine
ref - custom: the bean name of the user IdGenerator (D41); the runtime does not own it
regression - time-based: the clock regression policy
store - segment: the store name
step - segment: the smallest reservation; default 100
initialOffset - segment: where a new key starts; default 1, so no generator issues 0
lookahead - segment: how long the ids at hand should last; default 1s, 0 disables prefetching
maxBatch - segment: the largest reservation; default max(step * 1000, 2^20) rounded to the step
reserveTimeout - segment: how long a caller waits for a refill; default 3s
rangeTtl - segment: a range unused this long is dropped; default never
period - periodic-segment: YEAR, YEAR_MONTH or YEAR_MONTH_DAY
zone - periodic-segment: the time zone of the periods; default the system zone
prewarm - periodic-segment: the next period is warmed up this long before; default 1m
sealAfter - periodic-segment: a period's key is sealed this long after it ends; default never
codec - the codec list, applied in order; for periodic-segment a period item where the period key goes (or a first date-prefix item: the period first), for cosid80 a single radix or friendly item
Enclosing class:
CosIdProperties

public static record CosIdProperties.Generator(String strategy, boolean disabled, String layout, Instant epoch, ChronoUnit unit, Integer timeBits, Integer nodeBits, Integer seqBits, Long seqResetThreshold, String machine, String ref, CosIdProperties.Regression regression, String store, long step, long initialOffset, Duration lookahead, Long maxBatch, Duration reserveTimeout, Duration rangeTtl, String period, ZoneId zone, Duration prewarm, Duration sealAfter, List<CosIdProperties.Codec> codec) extends Record
A generator. Which fields apply depends on the strategy.
  • Constructor Details

    • Generator

      public Generator(String strategy, boolean disabled, String layout, Instant epoch, ChronoUnit unit, Integer timeBits, Integer nodeBits, Integer seqBits, Long seqResetThreshold, String machine, String ref, @DefaultValue CosIdProperties.Regression regression, String store, @DefaultValue("100") long step, @DefaultValue("1") long initialOffset, @DefaultValue("1s") Duration lookahead, Long maxBatch, @DefaultValue("3s") Duration reserveTimeout, Duration rangeTtl, String period, ZoneId zone, @DefaultValue("1m") Duration prewarm, Duration sealAfter, List<CosIdProperties.Codec> codec)
      Creates an instance of a Generator record class.
      Parameters:
      strategy - the value for the strategy record component
      disabled - the value for the disabled record component
      layout - the value for the layout record component
      epoch - the value for the epoch record component
      unit - the value for the unit record component
      timeBits - the value for the timeBits record component
      nodeBits - the value for the nodeBits record component
      seqBits - the value for the seqBits record component
      seqResetThreshold - the value for the seqResetThreshold record component
      machine - the value for the machine record component
      ref - the value for the ref record component
      regression - the value for the regression record component
      store - the value for the store record component
      step - the value for the step record component
      initialOffset - the value for the initialOffset record component
      lookahead - the value for the lookahead record component
      maxBatch - the value for the maxBatch record component
      reserveTimeout - the value for the reserveTimeout record component
      rangeTtl - the value for the rangeTtl record component
      period - the value for the period record component
      zone - the value for the zone record component
      prewarm - the value for the prewarm record component
      sealAfter - the value for the sealAfter record component
      codec - the value for the codec record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • strategy

      public String strategy()
      Returns the value of the strategy record component.
      Returns:
      the value of the strategy record component
    • disabled

      public boolean disabled()
      Returns the value of the disabled record component.
      Returns:
      the value of the disabled record component
    • layout

      public String layout()
      Returns the value of the layout record component.
      Returns:
      the value of the layout record component
    • epoch

      public Instant epoch()
      Returns the value of the epoch record component.
      Returns:
      the value of the epoch record component
    • unit

      public ChronoUnit unit()
      Returns the value of the unit record component.
      Returns:
      the value of the unit record component
    • timeBits

      public Integer timeBits()
      Returns the value of the timeBits record component.
      Returns:
      the value of the timeBits record component
    • nodeBits

      public Integer nodeBits()
      Returns the value of the nodeBits record component.
      Returns:
      the value of the nodeBits record component
    • seqBits

      public Integer seqBits()
      Returns the value of the seqBits record component.
      Returns:
      the value of the seqBits record component
    • seqResetThreshold

      public Long seqResetThreshold()
      Returns the value of the seqResetThreshold record component.
      Returns:
      the value of the seqResetThreshold record component
    • machine

      public String machine()
      Returns the value of the machine record component.
      Returns:
      the value of the machine record component
    • ref

      public String ref()
      Returns the value of the ref record component.
      Returns:
      the value of the ref record component
    • regression

      public CosIdProperties.Regression regression()
      Returns the value of the regression record component.
      Returns:
      the value of the regression record component
    • store

      public String store()
      Returns the value of the store record component.
      Returns:
      the value of the store record component
    • step

      public long step()
      Returns the value of the step record component.
      Returns:
      the value of the step record component
    • initialOffset

      public long initialOffset()
      Returns the value of the initialOffset record component.
      Returns:
      the value of the initialOffset record component
    • lookahead

      public Duration lookahead()
      Returns the value of the lookahead record component.
      Returns:
      the value of the lookahead record component
    • maxBatch

      public Long maxBatch()
      Returns the value of the maxBatch record component.
      Returns:
      the value of the maxBatch record component
    • reserveTimeout

      public Duration reserveTimeout()
      Returns the value of the reserveTimeout record component.
      Returns:
      the value of the reserveTimeout record component
    • rangeTtl

      public Duration rangeTtl()
      Returns the value of the rangeTtl record component.
      Returns:
      the value of the rangeTtl record component
    • period

      public String period()
      Returns the value of the period record component.
      Returns:
      the value of the period record component
    • zone

      public ZoneId zone()
      Returns the value of the zone record component.
      Returns:
      the value of the zone record component
    • prewarm

      public Duration prewarm()
      Returns the value of the prewarm record component.
      Returns:
      the value of the prewarm record component
    • sealAfter

      public Duration sealAfter()
      Returns the value of the sealAfter record component.
      Returns:
      the value of the sealAfter record component
    • codec

      public List<CosIdProperties.Codec> codec()
      Returns the value of the codec record component.
      Returns:
      the value of the codec record component