From 882f886450c908b6b23400b64c117375c7949afb Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang <93241502+yhchiang-sol@users.noreply.github.com> Date: Wed, 15 Dec 2021 13:12:50 -0800 Subject: [PATCH] Add comment block for commit_slot_meta_working_set in blockstore.rs (#21852) --- ledger/src/blockstore.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 45ec68672..c4dc4e74c 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -3360,6 +3360,23 @@ fn send_signals( } } +/// For each slot in the slot_meta_working_set which has any change, include +/// corresponding updates to cf::SlotMeta via the specified `write_batch`. +/// The `write_batch` will later be atomically committed to the blockstore. +/// +/// Arguments: +/// - `slot_meta_working_set`: a map that maintains slot-id to its `SlotMeta` +/// mapping. +/// - `completed_slot_senders`: the units which are responsible for sending +/// signals for completed slots. +/// - `write_batch`: the write batch which includes all the updates of the +/// the current write and ensures their atomicity. +/// +/// On success, the function returns an Ok result with pair where: +/// - `should_signal`: a boolean flag indicating whether to send signal. +/// - `newly_completed_slots`: a subset of slot_meta_working_set which are +/// newly completed. fn commit_slot_meta_working_set( slot_meta_working_set: &HashMap, completed_slots_senders: &[SyncSender>],