diff options
| author | Alan Conway <aconway@apache.org> | 2008-07-04 19:07:33 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2008-07-04 19:07:33 +0000 |
| commit | d738d179e4c040e62438516bc0992736d00b902f (patch) | |
| tree | 73694d534d1fd2526dfe64b874f60944ab5a92b7 /cpp/src/qpid/cluster/Cpg.h | |
| parent | 3a00f4fdffe6de06873e9d4d3569bb7531adda85 (diff) | |
| download | qpid-python-d738d179e4c040e62438516bc0992736d00b902f.tar.gz | |
Cluster prototype: handles client-initiated commands (not dequeues)
Details
- Cluster.cpp: serializes all frames thru cluster (see below)
- broker/ConnectionManager: Added handler chain in front of Connection::received.
- sys::Fork and ForkWithMessage - abstractions for forking with posix impl.
- tests/ForkedBroker.h: test utility to fork a broker process.
- broker/SignalHandler: Encapsulated signal handling from qpidd.cpp
- Various minor logging & error message improvements to aid debugging.
NB: current impl will not scale. It is functional working starting point so we
can start testing & profiling to find the right optimizations.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@674107 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/cluster/Cpg.h')
| -rw-r--r-- | cpp/src/qpid/cluster/Cpg.h | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/cpp/src/qpid/cluster/Cpg.h b/cpp/src/qpid/cluster/Cpg.h index 1ed362f94e..a918fb0cbf 100644 --- a/cpp/src/qpid/cluster/Cpg.h +++ b/cpp/src/qpid/cluster/Cpg.h @@ -22,6 +22,8 @@ #include "qpid/Exception.h" #include "qpid/cluster/Dispatchable.h" +#include <boost/tuple/tuple.hpp> +#include <boost/tuple/tuple_comparison.hpp> #include <cassert> #include <string.h> @@ -55,16 +57,14 @@ class Cpg : public Dispatchable { std::string str() const { return std::string(value, length); } }; - - struct Id { - uint64_t id; - Id(uint64_t n=0) : id(n) {} - Id(uint32_t nodeid, uint32_t pid) { id=(uint64_t(nodeid)<<32)+ pid; } - Id(const cpg_address& addr) : id(Id(addr.nodeid, addr.pid)) {} - - operator uint64_t() const { return id; } - uint32_t nodeId() const { return id >> 32; } - pid_t pid() const { return id & 0xFFFF; } + + + // boost::tuple gives us == and < for free. + struct Id : public boost::tuple<uint32_t, uint32_t> { + Id(uint32_t n=0, uint32_t p=0) : boost::tuple<uint32_t, uint32_t>(n, p) {} + Id(const cpg_address& addr) : boost::tuple<uint32_t, uint32_t>(addr.nodeid, addr.pid) {} + uint32_t getNodeId() const { return boost::get<0>(*this); } + uint32_t getPid() const { return boost::get<1>(*this); } }; static std::string str(const cpg_name& n) { @@ -131,6 +131,8 @@ class Cpg : public Dispatchable { cpg_handle_t getHandle() const { return handle; } + Id self() const; + private: class Handles; struct ClearHandleOnExit; |
