From 6399647e6461c3985164a280f3d9b080348ab2bc Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang <93241502+yhchiang-sol@users.noreply.github.com> Date: Fri, 11 Feb 2022 10:04:26 -0800 Subject: [PATCH] (Ledger Store) Add code comments for SlotMetaWorkingSetEntry. (#22662) --- ledger/src/blockstore.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/ledger/src/blockstore.rs b/ledger/src/blockstore.rs index 6527ac8be..145cb2cd5 100644 --- a/ledger/src/blockstore.rs +++ b/ledger/src/blockstore.rs @@ -202,11 +202,18 @@ pub struct IndexMetaWorkingSetEntry { did_insert_occur: bool, } +/// The in-memory data structure for updating entries in the column family +/// [`cf::SlotMeta`]. pub struct SlotMetaWorkingSetEntry { + /// The dirty version of the `SlotMeta` which might not be persisted + /// to the blockstore yet. new_slot_meta: Rc>, + /// The latest version of the `SlotMeta` that was persisted in the + /// blockstore. If None, it means the current slot is new to the + /// blockstore. old_slot_meta: Option, - // True only if at least one shred for this SlotMeta was inserted since the time this - // struct was created. + /// True only if at least one shred for this SlotMeta was inserted since + /// this struct was created. did_insert_occur: bool, } @@ -246,6 +253,8 @@ pub struct BlockstoreInsertionMetrics { } impl SlotMetaWorkingSetEntry { + /// Construct a new SlotMetaWorkingSetEntry with the specified `new_slot_meta` + /// and `old_slot_meta`. `did_insert_occur` is set to false. fn new(new_slot_meta: Rc>, old_slot_meta: Option) -> Self { Self { new_slot_meta,