mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 01:50:35 +00:00
Commitlog: do more extensive dir entry probes to determine type
Since directory_entry "type" might not be set. Ensuring that code does not remain future free or easy to read. Fixes #157.
This commit is contained in:
@@ -167,11 +167,19 @@ public:
|
||||
}
|
||||
|
||||
future<> process(directory_entry de) {
|
||||
if (de.type && de.type == directory_entry_type::regular) {
|
||||
descriptor d(de.name);
|
||||
_ids = std::max(_ids, d.id);
|
||||
}
|
||||
return make_ready_future<>();
|
||||
auto entry_type = [this](const directory_entry & de) {
|
||||
if (!de.type && !de.name.empty()) {
|
||||
return engine().file_type(cfg.commit_log_location + "/" + de.name);
|
||||
}
|
||||
return make_ready_future<std::experimental::optional<directory_entry_type>>(de.type);
|
||||
};
|
||||
return entry_type(de).then([de, this](auto type) {
|
||||
if (type == directory_entry_type::regular) {
|
||||
descriptor d(de.name);
|
||||
_ids = std::max(_ids, d.id);
|
||||
}
|
||||
return make_ready_future<>();
|
||||
});
|
||||
}
|
||||
|
||||
future<> init();
|
||||
|
||||
Reference in New Issue
Block a user