mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-04 02:06:22 -04:00
refactor(block_manager): make map_logical_blocks
const
This commit is contained in:
parent
4a71c7a4a5
commit
8d0b00a8b0
@ -39,7 +39,7 @@ class block_manager {
|
|||||||
size_t get_logical_block() const;
|
size_t get_logical_block() const;
|
||||||
void set_written_block(size_t logical_block, size_t written_block,
|
void set_written_block(size_t logical_block, size_t written_block,
|
||||||
fragment_category::value_type category);
|
fragment_category::value_type category);
|
||||||
void map_logical_blocks(std::vector<chunk_type>& vec);
|
void map_logical_blocks(std::vector<chunk_type>& vec) const;
|
||||||
std::vector<fragment_category::value_type>
|
std::vector<fragment_category::value_type>
|
||||||
get_written_block_categories() const;
|
get_written_block_categories() const;
|
||||||
|
|
||||||
|
@ -47,12 +47,12 @@ void block_manager::set_written_block(size_t logical_block,
|
|||||||
block_map_[logical_block] = std::make_pair(written_block, category);
|
block_map_[logical_block] = std::make_pair(written_block, category);
|
||||||
}
|
}
|
||||||
|
|
||||||
void block_manager::map_logical_blocks(std::vector<chunk_type>& vec) {
|
void block_manager::map_logical_blocks(std::vector<chunk_type>& vec) const {
|
||||||
std::lock_guard lock{mx_};
|
std::lock_guard lock{mx_};
|
||||||
for (auto& c : vec) {
|
for (auto& c : vec) {
|
||||||
size_t block = c.block().value();
|
size_t block = c.block().value();
|
||||||
assert(block < num_blocks_);
|
assert(block < num_blocks_);
|
||||||
c.block() = block_map_[block].value().first;
|
c.block() = block_map_.at(block).value().first;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user