tuwunel_database/engine/files.rs
1use rocksdb::LiveFile as SstFile;
2use tuwunel_core::{Result, implement};
3
4use super::Engine;
5use crate::util::map_err;
6
7/// Lists the live SST files belonging to this database.
8///
9/// RocksDB produces the inventory before the iterator is returned. Each yielded
10/// entry describes one table file from that in-memory inventory.
11#[implement(Engine)]
12pub fn file_list(&self) -> impl Iterator<Item = Result<SstFile>> + Send + use<> {
13 self.db
14 .live_files()
15 .map_err(map_err)
16 .into_iter()
17 .flat_map(Vec::into_iter)
18 .map(Ok)
19}