Skip to content

Commit 5958ad7

Browse files
committed
comment nits
1 parent 3b729d8 commit 5958ad7

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

storage/src/qmdb/sync/requests.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ pub(super) struct Requests<Op, D: Digest, E> {
1212
#[allow(clippy::type_complexity)]
1313
futures: FuturesUnordered<Pin<Box<dyn Future<Output = IndexedFetchResult<Op, D, E>> + Send>>>,
1414
/// Start locations of outstanding requests, paired with cancellation
15-
/// senders. Dropping a sender signals the resolver that the request is
16-
/// no longer needed. Entries are removed when a request completes or is
17-
/// discarded, but the corresponding future remains in `futures`
18-
/// (removing from FuturesUnordered is expensive).
15+
/// senders. When an entry is removed (via [`Self::remove`] or
16+
/// [`Self::remove_before`]), the sender is dropped, causing the
17+
/// resolver's `cancel_rx.await` to return `Err` as a cancellation
18+
/// signal. The corresponding future remains in `futures` (removing
19+
/// from FuturesUnordered is expensive).
1920
locations: BTreeMap<Location, oneshot::Sender<()>>,
2021
}
2122

storage/src/qmdb/sync/resolver.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ pub trait Resolver: Send + Sync + Clone + 'static {
6161
/// `op_count` operations. If `include_pinned_nodes` is true, the result will include the
6262
/// pinned MMR nodes at `start_loc`.
6363
///
64-
/// The `cancel_rx` receiver fires when the engine no longer needs this request (e.g. due
65-
/// to a target update). Implementations may use it to abort in-flight work early.
64+
/// The corresponding `cancel_tx` is dropped when the engine no longer needs this
65+
/// request (e.g. due to a target update), causing `cancel_rx.await` to return
66+
/// `Err`. Implementations may `select!` on it to abort in-flight work early.
6667
#[allow(clippy::type_complexity)]
6768
fn get_operations<'a>(
6869
&'a self,

0 commit comments

Comments
 (0)