Commit Graph

17 Commits

Author SHA1 Message Date
Avi Kivity
24506efc43 uuid: fix serialization of least significant bytes
Shift amount was incorrect.
2015-03-23 22:42:34 +02:00
Tomasz Grabiec
f321b9e9b5 util: Make hash functions work on bytes_view 2015-03-17 15:56:28 +01:00
Dor Laor
a9e77e1211 uuid: add 'bytes' serialization helpers 2015-03-16 06:58:30 +02:00
Avi Kivity
b5125cc03e uuid: remove debug print 2015-03-11 14:42:42 +02:00
Avi Kivity
835c8b693c uuid: fix uuidgen thread safety
The instance must be thread local since it is mutable (last_nanos).
2015-03-11 14:42:42 +02:00
Asias He
5ddab29a3c utils: Convert utils/BoundedStatsDeque.java to C++ 2015-03-10 16:04:24 +08:00
Asias He
0ffdd1896f utils: Import utils/BoundedStatsDeque.java 2015-03-10 15:11:36 +08:00
Calle Wilund
d92971a2b4 Add hash function to UUID.
Signed-off-by: Calle Wilund <calle@cloudius-systems.com>
2015-03-05 11:02:46 +02:00
Avi Kivity
678c259c66 murmur3: switch to unsigned types
C++ doesn't define overflow on signed types, so use unsigned types instead.
Luckily all right shifts were unsigned anyway.

Some signed extension was happening (handling remainders after processing
8-byte chunks) but should still be there.

Caught by debug build.
2015-02-24 15:29:08 +02:00
Nadav Har'El
7c87c6cc27 UUID: add to_sstring() method
Add UUID::to_sstring() method, analogous to the Java UUID.toString(),
and I verified that it generates the same output as the original Java
method.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
[avi: make it build, using sprint() instead of sprintf()]
2015-01-14 14:43:45 +02:00
Avi Kivity
904db75cbb utils: add make_random_uuid() 2015-01-12 14:20:28 +02:00
Avi Kivity
63055f0306 uuid: add missing include 2015-01-12 14:19:33 +02:00
Avi Kivity
07947764b2 uuid: convert UUID_gen::get_UUID() 2015-01-11 15:46:03 +02:00
Nadav Har'El
31a982b41e Convert time (version 1) UUID to C++
Convert Cassandra's UUIDGen class, which generates time-dependent UUID,
and parts of the java.util.UUID which I thought we need, to C++.

It is possible I missed some needed features of java.util.UUID that we'll
need to add later.

Also, part of the version-1 UUID is supposed to be node-unique (so that
if two nodes happen to boot at the same time and get a UUID at exactly
the same time, they still get different UUIDs). Cassandra uses for this
a hash function of the IP address, we should use in the future the MAC
address (from Seastar's network stack). But currently we just use 0.
Left a FIXME to fix that.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
[avi: add to ./configure.py]
2015-01-07 16:13:42 +02:00
Asias He
516ef9e63b utils: Convert utils/FBUtilities.java 2015-01-06 17:23:46 +08:00
Asias He
3a5314bec8 utils: Import utils/FBUtilities.java 2015-01-06 16:59:16 +08:00
Nadav Har'El
774579d8b4 Move murmur_hash to the right directory
In the original Java code, MurmurHash was in the "utils" package, not
"util", so move it to a new "utils" directory (and namespace), not
"util".

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2014-12-30 17:43:30 +02:00