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,customoruuidv7disabled- declared but not created (D24): its bean throwsGeneratorDisabledExceptionlayout- time-based: the layout preset; snowflake:SNOWFLAKE_MS(default),SNOWFLAKE_S,JS_SAFE_MSorJS_SAFE_S; cosid80:COSID_80(default) onlyepoch- snowflake: overrides the preset's epoch; cosid80 keeps the Unix epochunit- snowflake: overrides the preset's time unit,MILLISorSECONDS; cosid80 keeps millisecondstimeBits- time-based: overrides the preset's time bits (4.xtimestamp-bit)nodeBits- time-based: overrides the preset's node bits (4.xmachine-bit)seqBits- time-based: overrides the preset's sequence bits (4.xsequence-bit)seqResetThreshold- time-based: overrides the highest sequence a new time unit may start from (4.xsequence-reset-threshold); default the preset's, or half the sequence range whenseq-bitsis setmachine- time-based: the machine whose slot the ids carry, acosid.machinesname (D37); default thecosid.machineref- custom: the bean name of the userIdGenerator(D41); the runtime does not own itregression- time-based: the clock regression policystore- segment: the store namestep- segment: the smallest reservation; default 100initialOffset- segment: where a new key starts; default 1, so no generator issues 0lookahead- segment: how long the ids at hand should last; default 1s, 0 disables prefetchingmaxBatch- segment: the largest reservation; defaultmax(step * 1000, 2^20)rounded to the stepreserveTimeout- segment: how long a caller waits for a refill; default 3srangeTtl- segment: a range unused this long is dropped; default neverperiod- periodic-segment:YEAR,YEAR_MONTHorYEAR_MONTH_DAYzone- periodic-segment: the time zone of the periods; default the system zoneprewarm- periodic-segment: the next period is warmed up this long before; default 1msealAfter- periodic-segment: a period's key is sealed this long after it ends; default nevercodec- the codec list, applied in order; for periodic-segment aperioditem where the period key goes (or a firstdate-prefixitem: the period first), for cosid80 a singleradixorfriendlyitem
- 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 Summary
ConstructorsConstructorDescriptionGenerator(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) Creates an instance of aGeneratorrecord class. -
Method Summary
Modifier and TypeMethodDescriptioncodec()Returns the value of thecodecrecord component.booleandisabled()Returns the value of thedisabledrecord component.epoch()Returns the value of theepochrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.longReturns the value of theinitialOffsetrecord component.layout()Returns the value of thelayoutrecord component.Returns the value of thelookaheadrecord component.machine()Returns the value of themachinerecord component.maxBatch()Returns the value of themaxBatchrecord component.nodeBits()Returns the value of thenodeBitsrecord component.period()Returns the value of theperiodrecord component.prewarm()Returns the value of theprewarmrecord component.rangeTtl()Returns the value of therangeTtlrecord component.ref()Returns the value of therefrecord component.Returns the value of theregressionrecord component.Returns the value of thereserveTimeoutrecord component.Returns the value of thesealAfterrecord component.seqBits()Returns the value of theseqBitsrecord component.Returns the value of theseqResetThresholdrecord component.longstep()Returns the value of thesteprecord component.store()Returns the value of thestorerecord component.strategy()Returns the value of thestrategyrecord component.timeBits()Returns the value of thetimeBitsrecord component.final StringtoString()Returns a string representation of this record class.unit()Returns the value of theunitrecord component.zone()Returns the value of thezonerecord component.
-
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 aGeneratorrecord class.- Parameters:
strategy- the value for thestrategyrecord componentdisabled- the value for thedisabledrecord componentlayout- the value for thelayoutrecord componentepoch- the value for theepochrecord componentunit- the value for theunitrecord componenttimeBits- the value for thetimeBitsrecord componentnodeBits- the value for thenodeBitsrecord componentseqBits- the value for theseqBitsrecord componentseqResetThreshold- the value for theseqResetThresholdrecord componentmachine- the value for themachinerecord componentref- the value for therefrecord componentregression- the value for theregressionrecord componentstore- the value for thestorerecord componentstep- the value for thesteprecord componentinitialOffset- the value for theinitialOffsetrecord componentlookahead- the value for thelookaheadrecord componentmaxBatch- the value for themaxBatchrecord componentreserveTimeout- the value for thereserveTimeoutrecord componentrangeTtl- the value for therangeTtlrecord componentperiod- the value for theperiodrecord componentzone- the value for thezonerecord componentprewarm- the value for theprewarmrecord componentsealAfter- the value for thesealAfterrecord componentcodec- the value for thecodecrecord component
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
strategy
Returns the value of thestrategyrecord component.- Returns:
- the value of the
strategyrecord component
-
disabled
public boolean disabled()Returns the value of thedisabledrecord component.- Returns:
- the value of the
disabledrecord component
-
layout
Returns the value of thelayoutrecord component.- Returns:
- the value of the
layoutrecord component
-
epoch
Returns the value of theepochrecord component.- Returns:
- the value of the
epochrecord component
-
unit
Returns the value of theunitrecord component.- Returns:
- the value of the
unitrecord component
-
timeBits
Returns the value of thetimeBitsrecord component.- Returns:
- the value of the
timeBitsrecord component
-
nodeBits
Returns the value of thenodeBitsrecord component.- Returns:
- the value of the
nodeBitsrecord component
-
seqBits
Returns the value of theseqBitsrecord component.- Returns:
- the value of the
seqBitsrecord component
-
seqResetThreshold
Returns the value of theseqResetThresholdrecord component.- Returns:
- the value of the
seqResetThresholdrecord component
-
machine
Returns the value of themachinerecord component.- Returns:
- the value of the
machinerecord component
-
ref
Returns the value of therefrecord component.- Returns:
- the value of the
refrecord component
-
regression
Returns the value of theregressionrecord component.- Returns:
- the value of the
regressionrecord component
-
store
Returns the value of thestorerecord component.- Returns:
- the value of the
storerecord component
-
step
public long step()Returns the value of thesteprecord component.- Returns:
- the value of the
steprecord component
-
initialOffset
public long initialOffset()Returns the value of theinitialOffsetrecord component.- Returns:
- the value of the
initialOffsetrecord component
-
lookahead
Returns the value of thelookaheadrecord component.- Returns:
- the value of the
lookaheadrecord component
-
maxBatch
Returns the value of themaxBatchrecord component.- Returns:
- the value of the
maxBatchrecord component
-
reserveTimeout
Returns the value of thereserveTimeoutrecord component.- Returns:
- the value of the
reserveTimeoutrecord component
-
rangeTtl
Returns the value of therangeTtlrecord component.- Returns:
- the value of the
rangeTtlrecord component
-
period
Returns the value of theperiodrecord component.- Returns:
- the value of the
periodrecord component
-
zone
Returns the value of thezonerecord component.- Returns:
- the value of the
zonerecord component
-
prewarm
Returns the value of theprewarmrecord component.- Returns:
- the value of the
prewarmrecord component
-
sealAfter
Returns the value of thesealAfterrecord component.- Returns:
- the value of the
sealAfterrecord component
-
codec
Returns the value of thecodecrecord component.- Returns:
- the value of the
codecrecord component
-