Added drift tolerance of 10 seconds to preserve monotonicity when the
system clock is adjusted by NTP after a small clock drift or when the
system clock jumps back by 1 second due to leap second.
The random component is incremented when the current time:
- is the same as the previous time;
- has moved backwards up to 10 seconds.
The time component is also incremented if the random component is
exceeded, which is quite rare.
Now you call `UlidFactory.newInstance()` and it's variants to get a new
`UlidFactory`.
List of changes:
- Added `UlidFactory.newInstance()`
- Added `UlidFactory.newInstance(Random)`
- Added `UlidFactory.newInstance(Supplier<byte[]>)`
- Added `UlidFactory.newMonotonicInstance()`
- Added `UlidFactory.newMonotonicInstance(Random)`
- Added `UlidFactory.newMonotonicInstance(Supplier<byte[]>)`
- Added benchmark code to compare ULID with UUID
- Removed `DefaultFactory`
- Removed `MonotonicFactory`
- Removed `Ulid.toUpperCase()`
- Removed `RandomGenerator`
Add static methods to Ulid:
- Ulid.getInstant(String);
- Ulid.getTime(String);
- Ulid.getRandom(String);
List of changes:
Updated Ulid
Updated test cases
Updated README.md
Test coverage 99.4%
Changed the uuid-creator to generate two types of ULID: default
(non-monotonic) and monotonic.
Until version 2.x.x this library only created monotonic ULIDs.
The version 3.0.0 breaks compatibility.
List of changes:
Changed UlidCreator
Created Ulid
Created UlidSpecCreator // abstract
Created DefaultUlidSpecCreator // implementation
Created MonotonicUlidSpecCreator // implementation
Removed UlidConverter
Removed UlidUtil
Removed UlidStruct
Create and update test cases
and more...
Test coverage: 93.5%
It's not needed to parse the whole ULID timestamp. All is needed is to
check the first two bits. They are extra bits added by the base-32
encoding. Both bits must be ZERO.
Moved v4 generators to UlidStruct
List of Changes:
Create UlidStruct.toUuid4()
Create UlidStruct.toString4()
Create UlidCreatorUuidTest // test cases
Create UlidCreatorStringTest // test cases
Add UlidUtil.extractUnixMilliseconds(UUID ulid)
Add UlidUtil.extractUnixMilliseconds(String ulid)
Now it can generate UUIDs and ULIDs compatible with RFC-4122 UUID v4.
List of Changes:
Created UlidCreator.getUlid4();
Created UlidCreator.getUlidString4();
Updated README.md
Coverage 94.1%
Now the generation of ULID in string format is 2.5x faster than before.
List of changes:
Optimize UlidSpecCreator
Optimize UlidConverter
Optimize UlidValidator
Create UlidStruct // class for internal use and test cases
Add test cases
Update README.md
Update javadoc
Coverage 94.3%
Remove UlidCreatorException // extremely unlikely to occur overrun
Add UlidCreator.toString() // from UUID to crockford base 32
Change DefaultRandomStrategy // no need for thread local SecureRandom
Update test cases
Update README.md
Update javadoc
Test coverage: 94.2%
Rename UlidBasedGuidCreator to UlidSpecCreator
Add method UlidCreator.fromString()
Add RandomStrategy for UlidSpecCreator
Add DefaultRandomStrategy using thread local SecureRandom
Add OtherRandomStrategy for any instance of Random
Add tests cases
Optimize UlidConverter.fromString()
Optimize UlidConverter.toString()
Optimize UlidValidator.isValid()
Optimize UlidSpecCreator
Update README.md
Update tests cases
In the previous implementation an exception was thrown when the random
part reached 2^80. It meant that if the first random generated within a
millisecond was (2^80 - 1000), the generator could thrown the exception
when only 1000 requests was made. It was very difficult, but possible.
Now it only occurs in the extremely unlikely event that you manage to
generate more than 2^80 ULIDs within the same millisecond.