From cd1b548a8fa58a5fd71cb9b0ef030c10d8ced8ae Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Tue, 29 Aug 2023 11:07:14 +0300 Subject: [PATCH] doc: explain DownloadedLayer::get owner param --- pageserver/src/tenant/storage_layer/layer.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pageserver/src/tenant/storage_layer/layer.rs b/pageserver/src/tenant/storage_layer/layer.rs index 00322aa4bd..6e638b82eb 100644 --- a/pageserver/src/tenant/storage_layer/layer.rs +++ b/pageserver/src/tenant/storage_layer/layer.rs @@ -1003,9 +1003,12 @@ impl Drop for DownloadedLayer { } impl DownloadedLayer { - /// The owner is required so that we don't have to upgrade the `Self::owner`, which will only - /// be used on drop. This way, initializing a DownloadedLayer with the owner gone is - /// impossible. + /// Initializes the `DeltaLayerInner` or `ImageLayerInner` within [`LayerKind`], or fails to + /// initialize it permanently. + /// + /// `owner` parameter is a borrow pointing at the same `LayerInner` as the + /// `DownloadedLayer::owner` would point when upgraded. Given how this method ends up called, + /// we will however always have the LayerInner on the callstack, so we can just use it. async fn get(&self, owner: &LayerInner) -> anyhow::Result<&LayerKind> { let init = || async { // there is nothing async here, but it should be async