Simple mechanism to prevent and immediate commit (until the caller does
more stuff, presumably).
Signed-off-by: Sage Weil <sage@redhat.com>
bool Paxos::trigger_propose()
{
- if (is_active()) {
+ if (plugged) {
+ dout(10) << __func__ << " plugged, not proposing now" << dendl;
+ return false;
+ } else if (is_active()) {
dout(10) << __func__ << " active, proposing now" << dendl;
propose_pending();
return true;
*/
bool trimming;
+ /**
+ * true if we want trigger_propose to *not* propose (yet)
+ */
+ bool plugged = false;
+
/**
* @defgroup Paxos_h_callbacks Callback classes.
* @{
return true;
}
-
+
+ bool is_plugged() const {
+ return plugged;
+ }
+ void plug() {
+ assert(plugged == false);
+ plugged = true;
+ }
+ void unplug() {
+ assert(plugged == true);
+ plugged = false;
+ }
+
// read
/**
* @defgroup Paxos_h_read_funcs Read-related functions