diff options
author | Determinant <[email protected]> | 2019-04-17 14:54:24 -0400 |
---|---|---|
committer | Determinant <[email protected]> | 2019-04-17 14:54:24 -0400 |
commit | cbfda8ccc88789cd3c83c63b6e18693e7dea718d (patch) | |
tree | 98e114ecc4f923f7e435c7ab94524e512e94fc14 /include | |
parent | d859aa2cd2db03ef66f305a265ae908ef41d6a72 (diff) |
support auto client command for evaluation
Diffstat (limited to 'include')
-rw-r--r-- | include/hotstuff/client.h | 10 | ||||
-rw-r--r-- | include/hotstuff/hotstuff.h | 3 | ||||
-rw-r--r-- | include/hotstuff/liveness.h | 8 |
3 files changed, 21 insertions, 0 deletions
diff --git a/include/hotstuff/client.h b/include/hotstuff/client.h index 95bcacb..37a3a17 100644 --- a/include/hotstuff/client.h +++ b/include/hotstuff/client.h @@ -50,6 +50,16 @@ struct MsgRespCmd { } }; +#ifdef HOTSTUFF_AUTOCLI +struct MsgDemandCmd { + static const opcode_t opcode = 0x6; + DataStream serialized; + size_t ncmd; + MsgDemandCmd(size_t ncmd) { serialized << ncmd; } + MsgDemandCmd(DataStream &&s) { s >> ncmd; } +}; +#endif + class CommandDummy: public Command { uint32_t cid; uint32_t n; diff --git a/include/hotstuff/hotstuff.h b/include/hotstuff/hotstuff.h index 10dcb84..03e5528 100644 --- a/include/hotstuff/hotstuff.h +++ b/include/hotstuff/hotstuff.h @@ -217,6 +217,9 @@ class HotStuffBase: public HotStuffCore { size_t size() const { return peers.size(); } PaceMaker &get_pace_maker() { return *pmaker; } void print_stat() const; +#ifdef HOTSTUFF_AUTOCLI + virtual void do_demand_commands(size_t) {} +#endif /* Helper functions */ /** Returns a promise resolved (with command_t cmd) when Command is fetched. */ diff --git a/include/hotstuff/liveness.h b/include/hotstuff/liveness.h index 6d3c3cf..f4027a2 100644 --- a/include/hotstuff/liveness.h +++ b/include/hotstuff/liveness.h @@ -51,6 +51,7 @@ class PaceMaker { virtual promise_t beat_resp(ReplicaID last_proposer) = 0; /** Impeach the current proposer. */ virtual void impeach() {} + virtual size_t get_pending_size() = 0; }; using pacemaker_bt = BoxObj<PaceMaker>; @@ -166,6 +167,9 @@ class PMWaitQC: public virtual PaceMaker { } public: + + size_t get_pending_size() override { return pending_beats.size(); } + void init() { last_proposed = hsc->get_genesis(); locked = false; @@ -455,6 +459,8 @@ class PMStickyProposer: virtual public PaceMaker { PMStickyProposer(double qc_timeout, const EventContext &ec): qc_timeout(qc_timeout), ec(ec) {} + size_t get_pending_size() override { return pending_beats.size(); } + void init() { to_candidate(); } ReplicaID get_proposer() override { @@ -706,6 +712,8 @@ class PMRoundRobinProposer: virtual public PaceMaker { PMRoundRobinProposer(double qc_timeout, const EventContext &ec): qc_timeout(qc_timeout), ec(ec), proposer(0) {} + size_t get_pending_size() override { return pending_beats.size(); } + void init() { to_candidate(); } |