userver: userver/fs/write.hpp File Reference
Loading...
Searching...
No Matches
write.hpp File Reference

Detailed Description

filesystem write functions

Definition in file write.hpp.

Go to the source code of this file.

#include <string>
#include <boost/filesystem/operations.hpp>
#include <userver/engine/task/task_processor_fwd.hpp>
+ Include dependency graph for write.hpp:

Namespaces

namespace  fs
 filesystem support
 

Functions

void fs::RewriteFileContents (engine::TaskProcessor &async_tp, const std::string &path, std::string_view contents)
 Rewrite file contents asynchronously It doesn't provide strict atomic guarantees. If you need them, use fs::RewriteFileContentsAtomically.
 
void fs::Rename (engine::TaskProcessor &async_tp, const std::string &source, const std::string &destination)
 Renames existing file.
 
void fs::RewriteFileContentsAtomically (engine::TaskProcessor &async_tp, const std::string &path, std::string_view contents, boost::filesystem::perms perms)
 Rewrite file contents atomically Write contents to temporary file in the same directory, then atomically replaces the destination file with the temporary file. Effectively does write()+sync()+rename()+sync(directory). It does both sync(2) for file and on the directory, so after successful return the file must persist on the filesystem.
 
void fs::Chmod (engine::TaskProcessor &async_tp, const std::string &path, boost::filesystem::perms perms)
 Change file mode.
 
bool fs::RemoveSingleFile (engine::TaskProcessor &async_tp, const std::string &path)
 Remove existing file.
 
void fs::CreateDirectories (engine::TaskProcessor &async_tp, std::string_view path, boost::filesystem::perms perms)
 Create directory and all necessary parent elements. Condition when path already exists and is a directory treated as "success" and no exception is thrown.
 
void fs::CreateDirectories (engine::TaskProcessor &async_tp, std::string_view path)