]> git.argeo.org Git - lgpl/argeo-commons.git/blobdiff - org.argeo.api.uuid/src/org/argeo/api/uuid/TimeUuidState.java
Improve time based UUID speed and configuration.
[lgpl/argeo-commons.git] / org.argeo.api.uuid / src / org / argeo / api / uuid / TimeUuidState.java
index 4c9eec5a6178e0eddef1e92e8a242630f742fc0b..780e8ad337070e6fc129db45e91e6646509abaa2 100644 (file)
@@ -11,37 +11,21 @@ import java.time.ZonedDateTime;
  * @see https://datatracker.ietf.org/doc/html/rfc4122#section-4.2.1
  */
 public interface TimeUuidState {
+       long MOST_SIG_VERSION1 = (1l << 12);
+       long LEAST_SIG_RFC4122_VARIANT = (1l << 63);
 
        /** Start of the Gregorian time, used by time-based UUID (v1). */
        final static Instant GREGORIAN_START = ZonedDateTime.of(1582, 10, 15, 0, 0, 0, 0, ZoneOffset.UTC).toInstant();
 
-       long useTimestamp();
+       long getLastTimestamp();
 
        long getClockSequence();
 
-       static boolean isNoMacAddressNodeId(byte[] nodeId) {
-               return (nodeId[0] & 1) != 0;
-       }
-
-       static class Holder {
-               long lastTimestamp;
-               long clockSequence;
-
-               public long getLastTimestamp() {
-                       return lastTimestamp;
-               }
+       long getLeastSignificantBits();
 
-               public void setLastTimestamp(long lastTimestamp) {
-                       this.lastTimestamp = lastTimestamp;
-               }
-
-               public long getClockSequence() {
-                       return clockSequence;
-               }
-
-               public void setClockSequence(long clockSequence) {
-                       this.clockSequence = clockSequence;
-               }
+       long getMostSignificantBits();
 
+       static boolean isNoMacAddressNodeId(byte[] nodeId) {
+               return (nodeId[0] & 1) != 0;
        }
 }