From 00746b32c0c28bd8f0dbb114b380fb10f6121d54 Mon Sep 17 00:00:00 2001 From: Louis Dureuil Date: Tue, 10 Jan 2023 09:46:28 +0100 Subject: [PATCH] Add Index::map_size --- milli/src/index.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/milli/src/index.rs b/milli/src/index.rs index 50a4e909f..46f8eb6a3 100644 --- a/milli/src/index.rs +++ b/milli/src/index.rs @@ -255,6 +255,16 @@ impl Index { Ok(self.env.real_disk_size()?) } + /// Returns the map size the underlying environment was opened with, in bytes. + /// + /// This value does not represent the current on-disk size of the index. + /// + /// This value is the maximum between the map size passed during the opening of the index + /// and the on-disk size of the index at the time of opening. + pub fn map_size(&self) -> Result { + Ok(self.env.map_size()?) + } + pub fn copy_to_path>(&self, path: P, option: CompactionOption) -> Result { self.env.copy_to_path(path, option).map_err(Into::into) }