mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-04 02:06:22 -04:00
feat(filesystem_v2): add cache_all_blocks
method
This commit is contained in:
parent
5717afa562
commit
2ad8ae4cdf
@ -361,6 +361,8 @@ class filesystem_v2 {
|
||||
return impl_->cache_blocks_by_category(category);
|
||||
}
|
||||
|
||||
void cache_all_blocks() const { impl_->cache_all_blocks(); }
|
||||
|
||||
class impl {
|
||||
public:
|
||||
virtual ~impl() = default;
|
||||
@ -457,6 +459,7 @@ class filesystem_v2 {
|
||||
virtual std::optional<std::string>
|
||||
get_block_category(size_t block_number) const = 0;
|
||||
virtual void cache_blocks_by_category(std::string_view category) const = 0;
|
||||
virtual void cache_all_blocks() const = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -105,6 +105,8 @@ class inode_reader_v2 {
|
||||
impl_->cache_blocks(blocks);
|
||||
}
|
||||
|
||||
void cache_all_blocks() const { impl_->cache_all_blocks(); }
|
||||
|
||||
class impl {
|
||||
public:
|
||||
virtual ~impl() = default;
|
||||
@ -127,6 +129,7 @@ class inode_reader_v2 {
|
||||
virtual void set_cache_tidy_config(cache_tidy_config const& cfg) = 0;
|
||||
virtual size_t num_blocks() const = 0;
|
||||
virtual void cache_blocks(std::span<size_t const> blocks) const = 0;
|
||||
virtual void cache_all_blocks() const = 0;
|
||||
};
|
||||
|
||||
private:
|
||||
|
@ -316,6 +316,8 @@ class filesystem_ final : public filesystem_v2::impl {
|
||||
ir_.cache_blocks(meta_.get_block_numbers_by_category(category));
|
||||
}
|
||||
|
||||
void cache_all_blocks() const override { ir_.cache_all_blocks(); }
|
||||
|
||||
private:
|
||||
filesystem_info const* get_info(fsinfo_options const& opts) const;
|
||||
void check_section(fs_section const& section) const;
|
||||
|
@ -158,6 +158,12 @@ class inode_reader_ final : public inode_reader_v2::impl {
|
||||
}
|
||||
}
|
||||
|
||||
void cache_all_blocks() const override {
|
||||
for (size_t i = 0; i < cache_.block_count(); ++i) {
|
||||
cache_.get(i, 0, 1);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
using offset_cache_type =
|
||||
basic_offset_cache<uint32_t, file_off_t, size_t,
|
||||
|
Loading…
x
Reference in New Issue
Block a user