34 explicit PaxosProposer(std::shared_ptr<PaxosContainer> container);
36 void findConsensus(
const PointTimePairs &points,
double seconds_till_start,
37 std::function<
void(uint32_t,
double)> success_cb,
38 std::function<
void(uint32_t)> fail_cb);
41 void processOKMessage(
const OKMessage &msg);
45 std::shared_ptr<PaxosContainer> container_;
47 enum class Phase { kNone, kPrepare, kAccept, kFinished };
51 PointTimePairs points;
52 double start_time = 0.0;
53 uint32_t instance_id = 0;
54 uint32_t proposal_id = 0;
55 uint32_t needed_for_quorum = 0;
56 uint32_t outstanding_oks = 0;
57 ns3::EventId timeout_event;
58 Phase phase = Phase::kNone;
59 std::function<void(uint32_t,
double)> success_cb;
60 std::function<void(uint32_t)> fail_cb;
62 [[nodiscard]]
bool initialized()
const {
return !points.empty(); }
65 double calculatePossibleStartTime(
const PointTimePairs &points,
double seconds_till_start)
const;
67 void prepareTimeout(uint32_t proposal_id);
69 uint32_t remaining_responses_ = 0;
70 Proposal current_proposal_;
72 std::unordered_map<InstanceID, uint32_t>
73 instance_to_proposal_id_;