Make backupContainer's listFiles step asynchronous

This commit is contained in:
David Youngworth 2020-05-04 17:21:00 -07:00
parent 5877994f53
commit a09f30e48e
1 changed files with 10 additions and 5 deletions

View File

@ -18,6 +18,7 @@
* limitations under the License.
*/
#include "Platform.actor.h"
#include "fdbclient/BackupContainer.h"
#include "fdbclient/BackupAgent.actor.h"
#include "fdbclient/FDBTypes.h"
@ -1687,11 +1688,11 @@ public:
return Void();
}
Future<FilesAndSizesT> listFiles(std::string path, std::function<bool(std::string const&)>) final {
FilesAndSizesT results;
ACTOR static Future<FilesAndSizesT> listFiles_impl(std::string path, std::string m_path) {
state std::vector<std::string> files;
wait(findFilesRecursivelyAsync(joinPath(m_path, path), &files));
std::vector<std::string> files;
platform::findFilesRecursively(joinPath(m_path, path), files);
FilesAndSizesT results;
// Remove .lnk files from results, they are a side effect of a backup that was *read* during simulation. See openFile() above for more info on why they are created.
if(g_network->isSimulated())
@ -1707,7 +1708,11 @@ public:
return results;
}
Future<Void> deleteContainer(int* pNumDeleted) final {
Future<FilesAndSizesT> listFiles(std::string path, std::function<bool(std::string const &)>) final {
return listFiles_impl(path, m_path);
}
Future<Void> deleteContainer(int *pNumDeleted) final {
// In order to avoid deleting some random directory due to user error, first describe the backup
// and make sure it has something in it.
return map(describeBackup(false, invalidVersion), [=](BackupDescription const &desc) {