public CollatedViewIndexBuilder(ColumnFamilyStore cfs, Set<Index> indexers, ReducingKeyIterator iter) { this.cfs = cfs; this.indexers = indexers; this.iter = iter; this.compactionId = UUIDGen.getTimeUUID(); }
if (uuid != null) { bb.putShort((short) 16); bb.put(UUIDGen.decompose(uuid)); bb.put((i == -1) && lastIsOne ? (byte) 1 : (byte) 0); if (i != -1) {
public LogEntry(String keyspace, ByteBuffer rowKey, ConsistencyLevel consistencyLevel, String host, long timestamp, Collection<String> columnNames) { this.keyspace = keyspace; this.rowKey = rowKey; this.uuid = UUIDGen.getUUID(ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes())).toString(); this.status = LogEntryStatus.PREPARING; this.consistencyLevel = consistencyLevel; this.timestamp = timestamp; this.host = host; this.columnNames = columnNames; }
/** * Returns a 16 byte representation of a type 1 UUID (a time-based UUID), * based on the current system time. * * @return a type 1 UUID represented as a byte[] */ public static byte[] getTimeUUIDBytes() { return createTimeUUIDBytes(instance.createTimeSafe()); }
/** * Creates a type 1 UUID (time-based UUID) with the timestamp of @param when, in milliseconds. * * @return a UUID instance */ public static UUID getTimeUUID(long when) { return new UUID(createTime(fromUnixTimestamp(when)), clockSeqAndNode); }
/** * Converts a milliseconds-since-epoch timestamp into the 16 byte representation * of a type 1 UUID (a time-based UUID). * * <p><i><b>Deprecated:</b> This method goes again the principle of a time * UUID and should not be used. For queries based on timestamp, minTimeUUID() and * maxTimeUUID() can be used but this method has questionable usefulness. This is * only kept because CQL2 uses it (see TimeUUID.fromStringCQL2) and we * don't want to break compatibility.</i></p> * * <p><i><b>Warning:</b> This method is not guaranteed to return unique UUIDs; Multiple * invocations using identical timestamps will result in identical UUIDs.</i></p> * * @param timeMillis * @return a type 1 UUID represented as a byte[] */ public static byte[] getTimeUUIDBytes(long timeMillis) { return createTimeUUIDBytes(instance.createTimeUnsafe(timeMillis)); }
public ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { ByteBuffer bb = parameters.get(0); if (bb == null) return null; return ByteBufferUtil.bytes(UUIDGen.unixTimestamp(UUIDGen.getUUID(bb))); } };
public ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { return ByteBuffer.wrap(UUIDGen.getTimeUUIDBytes()); } };
/** * @param uuid * @return seconds since Unix epoch */ public static int unixTimestampInSec(UUID uuid) { return Ints.checkedCast(TimeUnit.MILLISECONDS.toSeconds(unixTimestamp(uuid))); }
@Override public String toString() { return UUIDGen.getUUID(id).toString(); }
/** * Creates a type 1 UUID (time-based UUID). * * @return a UUID instance */ public static UUID getTimeUUID() { return new UUID(instance.createTimeSafe(), clockSeqAndNode); }
public ByteBuffer execute(List<ByteBuffer> parameters) { ByteBuffer bb = parameters.get(0); if (bb == null) return null; return ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.maxTimeUUID(TimestampType.instance.compose(bb).getTime()))); } };
public ByteBuffer execute(List<ByteBuffer> parameters) { ByteBuffer bb = parameters.get(0); if (bb == null) return null; return ByteBuffer.wrap(UUIDGen.decompose(UUIDGen.minTimeUUID(TimestampType.instance.compose(bb).getTime()))); } };
private long createTimeUnsafe(long when, int nanos) { long nanosSince = ((when - START_EPOCH) * 10000) + nanos; return createTime(nanosSince); }
/** * @param timestamp milliseconds since Unix epoch * @return */ private static long fromUnixTimestamp(long timestamp) { return fromUnixTimestamp(timestamp, 0L); }
/** @param when time in milliseconds */ private long createTimeUnsafe(long when) { return createTimeUnsafe(when, 0); }
public ByteBuffer execute(ProtocolVersion protocolVersion, List<ByteBuffer> parameters) { ByteBuffer bb = parameters.get(0); if (bb == null) return null; long timeInMillis = UUIDGen.unixTimestamp(UUIDGen.getUUID(bb)); return SimpleDateType.instance.fromTimeInMillis(timeInMillis); } };
/** * Returns the smaller possible type 1 UUID having the provided timestamp. * * <b>Warning:</b> this method should only be used for querying as this * doesn't at all guarantee the uniqueness of the resulting UUID. */ public static UUID minTimeUUID(long timestamp) { return new UUID(createTime(fromUnixTimestamp(timestamp)), MIN_CLOCK_SEQ_AND_NODE); }
/** * Converts a 100-nanoseconds precision timestamp into the 16 byte representation * of a type 1 UUID (a time-based UUID). * * To specify a 100-nanoseconds precision timestamp, one should provide a milliseconds timestamp and * a number {@code 0 <= n < 10000} such that n*100 is the number of nanoseconds within that millisecond. * * <p><i><b>Warning:</b> This method is not guaranteed to return unique UUIDs; Multiple * invocations using identical timestamps will result in identical UUIDs.</i></p> * * @return a type 1 UUID represented as a byte[] */ public static byte[] getTimeUUIDBytes(long timeMillis, int nanos) { if (nanos >= 10000) throw new IllegalArgumentException(); return createTimeUUIDBytes(instance.createTimeUnsafe(timeMillis, nanos)); }
/** * Returns a 16 byte representation of a type 1 UUID (a time-based UUID), * based on the current system time. * * @return a type 1 UUID represented as a byte[] */ public static byte[] getTimeUUIDBytes() { return createTimeUUIDBytes(instance.createTimeSafe()); }