Category: C++
-
Modern C++: Implementing a Merkle Tree
Merkle Trees store a hash of the sub-tree in each of the Nodes, so that the whole tree’s contents can be validated against tampering.They are used, for example, in Bitcoin’s blockchain, and in Cassandra to validate replicas.In this article, we will show how to implement a generic Merkle Tree using features of Modern C++. Previous…
-
Beware of C++11 `auto`
Here’s a puzzler for you: given the code below, what does the for loop print? using HandlersMap = std::map<std::string, std::function<std::string(const std::string&)>>; using MetaMap = std::map<std::string, HandlersMap>; void insert(MetaMap& meta, const std::string& key, const std::string& sub) { auto handlers = meta[key]; handlers[sub] = [=](const std::string& msg) { return “The response for ” + sub + “…
-
Gossip-based Failure Detectors – 0.8.0 released
We have just released version 0.8.0 of our distlib C++ library that implements a number of popular distributed systems algorithms. This concludes a first iteration of the “SWIM Gossip Protocol” for failure detection: the implementation is now fully thread-safe and can scale up to many servers with minimal process overhead. The gossip_example.cpp toy server shows how a client…
-
Apache Mesos Anonymous Module Example
Remote Commands Execution I have just published the code for a Mesos module to enable operators to execute remotely arbitrary commands on Apache Mesos Agent/Master nodes, out-of-band from the normal task execution framework. This is a Mesos anonymous module which can be loaded using the enclosed modules.json descriptor; this module will add HTTP endpoints such that: we can monitor…
-
libprocess – an Actor-based inter-process communication library
Introduction to libprocess In Apache Mesos we make heavy use of the Actor model implemented in the libprocess library: the most recent implementation can be found under the 3rdparty folder in the Mesos repository (here). libprocess was created originally at Berkley by Benjamin Hindman who is also the original creator of Mesos and implements “an…