Add a test (using the Boost unit-test framework) for the functions of
util/serealization.hh for serializing and de-serializing primitive types
like integers and strings.
The test checks that the round-trip is correct, i.e., taking an original
data, serializing it and de-serializing it back, gets the same data back.
Moreover, it compares the result of serialization to pre-computed expected
results (which were produced by a Java program), to confirm that our code
generates the same serialization as Java.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
The gossiped application state is a list of key/version pairs. The keys
come from the application_state enum in this patch.
This is a trivial conversion of the Java enum. It is possible we may need
to add more features to this enum class (Java enums have all sorts of weird
capabilities beyond C++ enums), but with any luck, we won't...
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
version_generator is a trivial class which keeps a global "version"
counter, starting with 0 and counting up on a single Cassandra node.
It is used by the gossip protocol to keep a version number for each
piece of state information, so a remote node which gets two pieces of
conflicting gossip can know which is the newer information.
In Cassandra, the counter is an atomic integer. In our implementation,
because there will be just a single gossiper per SMP machine, and the
gossiper will run on a single CPU, it can be a regular integer. But
this doesn't really help performance anyway (the version number changes
rarely, so performance of this code is insignifcant).
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Fix compilation errors in the shared_ptr pointer cast functions and
update shared_ptr constructor to take shared_ptr_count_base.
Suggested by Avi.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
Network tx path inversion, from Gleb:
"Instead of pushing packets from upper layers towards HW those patches
change networking stack to do the opposite: HW polls upper layers for
packets to send. There are several advantages to this approach. First
one is that now, instead of getting packets one by one HW will get them
in bulks. Another is that packet queueing happens closer to an application
layer where sender can be stopped more accurately without dropping packets."
Currently udp sender my send whenever it has data and if it does
this faster than packets can be transmitted we will run out of memory.
This patch limits how much outstanding data each native udp channel may
have.
L4 will provide the callback to be called by L3 after the packet is
handled to lower layers for transmission. L4 will know that it can queue
more data from user at this point. The patch also change send function
that can no longer block to return void instead of future<>.
This is the directory from which we will read the sstables.
Code to actually parse them will come later.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
In some cases, deserialize() can return a null object (if there were zero
input bytes).
In others, it cannot (for string or blob types).
Change the return type to optional<any> and adapt the deserialiation code
to deal with it.
Dynamic types come and go, so they need to be reference counted.
Switch data_type to using a shared_ptr<> for its implementation.
Since thread_ptr is not thread safe, the global primitive types must be
thread_local.
The first argument is a synthetic this pointer that we require users to
pass around. Change it to shared_ptr<term> instead to make it accessible
to all callers.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>