Ensures some type safety by asserting on the request type.
Signed-off-by: Joao Eduardo Luis <joao@suse.de>
void Elector::dispatch(MonOpRequestRef op)
{
op->mark_event("elector:dispatch");
+ assert(op->is_type_election());
+
switch (op->get_req()->get_type()) {
case MSG_MON_ELECTION:
void Monitor::handle_command(MonOpRequestRef op)
{
+ assert(op->is_type_command());
MMonCommand *m = static_cast<MMonCommand*>(op->get_req());
if (m->fsid != monmap->fsid) {
dout(0) << "handle_command on fsid " << m->fsid << " != " << monmap->fsid << dendl;
void Paxos::dispatch(MonOpRequestRef op)
{
+ assert(op->is_type_paxos());
op->mark_paxos_event("dispatch");
PaxosServiceMessage *m = static_cast<PaxosServiceMessage*>(op->get_req());
// election in progress?
bool PaxosService::dispatch(MonOpRequestRef op)
{
+ assert(op->is_type_service() || op->is_type_command());
PaxosServiceMessage *m = static_cast<PaxosServiceMessage*>(op->get_req());
op->mark_event("psvc:dispatch");