mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 11:10:40 +00:00
sstable_directory: Move most of .commit_directory_changes() on lister
Committing any changes made while scanning the storage is storage-specific. Just like .process() was moved on lister, the .commit() now does the same. Signed-off-by: Pavel Emelyanov <xemul@scylladb.com>
This commit is contained in:
@@ -248,12 +248,13 @@ future<> sstable_directory::components_lister::process(sstable_directory& direct
|
||||
}
|
||||
}
|
||||
|
||||
future<>
|
||||
sstable_directory::commit_directory_changes() {
|
||||
auto files_for_removal = std::exchange(_lister->_state->files_for_removal, {});
|
||||
_lister.reset();
|
||||
future<> sstable_directory::commit_directory_changes() {
|
||||
return _lister->commit().finally([x = std::move(_lister)] {});
|
||||
}
|
||||
|
||||
future<> sstable_directory::components_lister::commit() {
|
||||
// Remove all files scheduled for removal
|
||||
return parallel_for_each(std::move(files_for_removal), [] (sstring path) {
|
||||
return parallel_for_each(std::exchange(_state->files_for_removal, {}), [] (sstring path) {
|
||||
dirlog.info("Removing file {}", path);
|
||||
return remove_file(std::move(path));
|
||||
});
|
||||
|
||||
@@ -93,6 +93,7 @@ public:
|
||||
future<> close();
|
||||
|
||||
future<> process(sstable_directory& directory, fs::path location, process_flags flags);
|
||||
future<> commit();
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user