From: Joao Eduardo Luis Date: Tue, 16 Apr 2013 15:41:57 +0000 (+0100) Subject: mon: PaxosService: add request_proposal() to perform cross-proposals X-Git-Tag: v0.61~117^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fa77e1e732bea025d9920ae2e35adb2d1cab1aa4;p=ceph.git mon: PaxosService: add request_proposal() to perform cross-proposals Instead of allowing services to directly use 'propose_pending()' on other services, we instead add two new functions: - request_proposal() to request 'this' service to propose its pending value; and - request_proposal(PaxosService *other) so that 'this' service can request a proposal to 'other' These functions should allow us to enforce a greater set of constraints at time of a cross-proposal, either by making sure a service will (e.g.) hold-off his own proposals until said proposal is performed, or even that the other service will enforce a tighter set of constraints that wouldn't otherwise be enforced by using 'propose_pending()' directly. Signed-off-by: Joao Eduardo Luis --- diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index cd112e10fed1..dc13ad37a5e8 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -274,6 +274,35 @@ public: * the class that is implementing PaxosService */ void propose_pending(); + + /** + * Let others request us to propose. + * + * At the moment, this is just a wrapper to propose_pending() with an + * extra check for is_writeable(), but it's a good practice to dissociate + * requests for proposals from direct usage of propose_pending() for + * future use -- we might want to perform additional checks or put a + * request on hold, for instance. + */ + void request_proposal() { + assert(is_writeable()); + + propose_pending(); + } + /** + * Request service @p other to perform a proposal. + * + * We could simply use the function above, requesting @p other directly, + * but we might eventually want to do something to the request -- say, + * set a flag stating we're waiting on a cross-proposal to be finished. + */ + void request_proposal(PaxosService *other) { + assert(other != NULL); + assert(other->is_writeable()); + + other->request_proposal(); + } + /** * Dispatch a message by passing it to several different functions that are * either implemented directly by this service, or that should be implemented