Commit Graph

13 Commits

Author SHA1 Message Date
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
Avi Kivity
6f7dff825c dht: add global partitioner
Skip configuration for now and go for murmur3 instead.
2015-02-23 11:37:12 +02:00
Avi Kivity
d0dae3f938 dht: add murmur3_partitioner
We don't follow origin precisely in normalizing the token (converting a
zero to something else).  We probably should, to allow direct import of
a database.
2015-02-23 11:37:12 +02:00
Avi Kivity
fd9f90f45a dht: implement token minimum and midpoint
Rather than converting to unsigned longs for the fractional computations,
do them it bytes.  The overhead of allocating longs will be larger than
the computation, given that tokens are usually short (8 bytes), and
our bytes type stores them inline.
2015-02-23 10:20:24 +02:00
Avi Kivity
edc4ac4231 dht: de-virtualize token
Origin uses abstract types for Token; for two reasons:

 1. To create a distinction between tokens for keys and tokens
    that represent the end of the range
 2. To use different implementations for tokens belonging to different
    partitioners.

Using abstract types carries a penalty of indirection, more complex
memory management, and performance.  We can eliminate it by using
a concrete type, and defer any differences in the implementation
to the partitioner.  End-of-range token representation is folded into
the token class.
2015-02-23 10:20:24 +02:00
Avi Kivity
41ba192590 dht: make i_partitioner's methods public, and add a destructor 2015-02-23 10:20:22 +02:00
Avi Kivity
a166f74a54 dht: rename DecoratedKey and Token to fit with naming conventions 2015-02-22 17:53:32 +02:00
Asias He
bf78e14d17 db: Switch to seastar shared_ptr from std::shared_ptr 2015-01-15 09:05:48 +08:00
Asias He
dfc19433bb dht: Switch to i_partitioner in ring_position 2015-01-14 14:51:06 +02:00
Asias He
65173589b9 dht: Convert dht/IPartitioner.java to C++ 2015-01-07 20:49:57 +08:00
Asias He
0581c0de12 dht: Import dht/IPartitioner.java 2015-01-07 20:44:55 +08:00
Asias He
e145946c97 dht: Convert dht/RingPosition.java to C++ 2015-01-07 20:44:54 +08:00
Asias He
348d447bf1 dht: Import dht/RingPosition.java 2015-01-07 20:44:54 +08:00