From 1e4ded860c56b7e7142425e736d1858862331efa Mon Sep 17 00:00:00 2001 From: Joonas Koivunen Date: Mon, 21 Aug 2023 22:28:41 +0300 Subject: [PATCH] refactor: move LayerE::get --- pageserver/src/tenant/storage_layer.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pageserver/src/tenant/storage_layer.rs b/pageserver/src/tenant/storage_layer.rs index f9d03acff8..e3d859a501 100644 --- a/pageserver/src/tenant/storage_layer.rs +++ b/pageserver/src/tenant/storage_layer.rs @@ -604,6 +604,15 @@ impl LayerE { } } + /// Access the current state without waiting for the file to be downloaded. + /// + /// Used by eviction only. Requires that we've initialized to state which is respective to the + /// actual residency state. + fn get(&self) -> Option> { + let locked = self.inner.get(); + Self::get_or_apply_evictedness(locked, &self.wanted_evicted) + } + /// Delete the layer file when the `self` gets dropped, also schedule a remote index upload /// then perhaps. pub(crate) fn garbage_collect(&self) { @@ -656,11 +665,7 @@ impl LayerE { }) } - fn get(&self) -> Option> { - let locked = self.inner.get(); - Self::get_or_apply_evictedness(locked, &self.wanted_evicted) - } fn get_or_apply_evictedness( guard: Option>,