mon: Monitor: have reply functions for op requests

Signed-off-by: Joao Eduardo Luis <joao@redhat.com>
This commit is contained in:
Joao Eduardo Luis 2015-02-27 19:06:56 +00:00 committed by Joao Eduardo Luis
parent 53bd1ba510
commit df9486bcc7
2 changed files with 20 additions and 0 deletions

View File

@ -3008,6 +3008,17 @@ void Monitor::reply_command(MMonCommand *m, int rc, const string &rs, bufferlist
send_reply(m, reply);
}
void Monitor::reply_command(MonOpRequestRef op, int rc, const string &rs,
bufferlist& rdata, version_t version)
{
MMonCommand *m = static_cast<MMonCommand*>(op->get_req());
assert(m->get_type() == MSG_MON_COMMAND);
MMonCommandAck *reply = new MMonCommandAck(m->cmd, rc, rs, version);
reply->set_tid(m->get_tid());
reply->set_data(rdata);
send_reply(op, reply);
}
// ------------------------
// request/reply routing
@ -3159,6 +3170,13 @@ void Monitor::try_send_message(Message *m, const entity_inst_t& to)
}
}
void Monitor::send_reply(MonOpRequestRef op, Message *reply)
{
dout(2) << __func__ << " " << op << " " << *reply << dendl;
op->send_reply(reply);
}
void Monitor::send_reply(PaxosServiceMessage *req, Message *reply)
{
ConnectionRef connection = req->get_connection();

View File

@ -761,6 +761,7 @@ public:
void reply_command(MMonCommand *m, int rc, const string &rs, version_t version);
void reply_command(MMonCommand *m, int rc, const string &rs, bufferlist& rdata, version_t version);
void reply_command(MonOpRequestRef op, int rc, const string &rs, bufferlist& rdata, version_t version);
void handle_probe(MonOpRequestRef op);
@ -803,6 +804,7 @@ public:
void handle_forward(MonOpRequestRef op);
void try_send_message(Message *m, const entity_inst_t& to);
void send_reply(PaxosServiceMessage *req, Message *reply);
void send_reply(MonOpRequestRef op, Message *reply);
void no_reply(PaxosServiceMessage *req);
void resend_routed_requests();
void remove_session(MonSession *s);