From 165c77eed924d28cdad0f5432908821850447133 Mon Sep 17 00:00:00 2001 From: Jie Yao Date: Thu, 24 Oct 2024 03:50:55 -0700 Subject: [PATCH] give a chance for the last obj to retry --- include/libnuraft/state_machine.hxx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/include/libnuraft/state_machine.hxx b/include/libnuraft/state_machine.hxx index ca326849..d1d17391 100644 --- a/include/libnuraft/state_machine.hxx +++ b/include/libnuraft/state_machine.hxx @@ -200,13 +200,20 @@ public: * this parameter. * @param data Payload of given object. * @param is_first_obj `true` if this is the first object. - * @param is_last_obj `true` if this is the last object. + * @param is_last_obj[in,out] + * when [in] + * `true` if this is the last object indicated by the sender. + * + * when [out] + * As a result of this API call, if the receiver wants the sender + * to resend the last object, it should set this parameter to `false`, + * so that apply_snapshot() will not be called. */ virtual void save_logical_snp_obj(snapshot& s, ulong& obj_id, buffer& data, bool is_first_obj, - bool is_last_obj) {} + bool& is_last_obj) {} /** * Apply received snapshot to state machine.