Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb::TemporaryDirectoryHandle Class Reference
Collaboration diagram for duckdb::TemporaryDirectoryHandle:

Public Member Functions

 TemporaryDirectoryHandle (DatabaseInstance &db, string path_p, atomic< idx_t > &size_on_disk, optional_idx max_swap_space)
TemporaryFileManager & GetTempFile () const

Private Attributes

DatabaseInstance & db
string temp_directory
bool created_directory = false
unique_ptr< TemporaryFileManager > temp_file

Constructor & Destructor Documentation

◆ TemporaryDirectoryHandle()

duckdb::TemporaryDirectoryHandle::TemporaryDirectoryHandle ( DatabaseInstance & db,
string path_p,
atomic< idx_t > & size_on_disk,
optional_idx max_swap_space )
443392 : db(db), temp_directory(std::move(path_p)),
443393 temp_file(make_uniq<TemporaryFileManager>(db, temp_directory, size_on_disk)) {
443394 auto &fs = FileSystem::GetFileSystem(db);
443395 D_ASSERT(!temp_directory.empty());

◆ ~TemporaryDirectoryHandle()

duckdb::TemporaryDirectoryHandle::~TemporaryDirectoryHandle ( )
443403 {
443404 // first release any temporary files
443405 temp_file.reset();
443406 // then delete the temporary file directory
443407 auto &fs = FileSystem::GetFileSystem(db);
443408 if (!temp_directory.empty()) {
443409 bool delete_directory = created_directory;
443410 vector<string> files_to_delete;
443411 if (!created_directory) {
443412 bool deleted_everything = true;
443413 fs.ListFiles(temp_directory, [&](const string &path, bool isdir) {
443414 if (isdir) {
443415 deleted_everything = false;
443416 return;
443417 }
443418 if (!StringUtil::StartsWith(path, "duckdb_temp_")) {
443419 deleted_everything = false;
443420 return;
443421 }
443422 files_to_delete.push_back(path);
443423 });
443424 }
443425 if (delete_directory) {
443426 // we want to remove all files in the directory
443427 fs.RemoveDirectory(temp_directory);
443428 } else {
443429 vector<string> full_path_files_to_delete;
443430 full_path_files_to_delete.reserve(files_to_delete.size());
443431 for (auto &file : files_to_delete) {
static DUCKDB_API bool StartsWith(string str, string prefix)
Returns true if the target string starts with the given prefix.
Definition duckdb.cpp:109377

Member Function Documentation

◆ GetTempFile()

TemporaryFileManager & duckdb::TemporaryDirectoryHandle::GetTempFile ( ) const

The documentation for this class was generated from the following file: