LogCabin
Classes | Namespaces | Functions
Storage/FilesystemUtil.h File Reference

Contains utilities for working with the filesystem. More...

#include <cinttypes>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

class  LogCabin::Storage::FilesystemUtil::File
 A File object is just a wrapper around a file descriptor; it represents either an open file, an open directory, or an empty placeholder. More...
class  LogCabin::Storage::FilesystemUtil::FileContents
 Provides random access to a file. More...

Namespaces

namespace  LogCabin
namespace  LogCabin::Storage
namespace  LogCabin::Storage::FilesystemUtil

Functions

void LogCabin::Storage::FilesystemUtil::allocate (const File &file, uint64_t offset, uint64_t bytes)
 Allocate a contiguous range of a file, padding with zeros if necessary.
File LogCabin::Storage::FilesystemUtil::dup (const File &file)
 Clones a file descriptor.
void LogCabin::Storage::FilesystemUtil::fsync (const File &file)
 Flush changes to a File to its underlying storage device.
void LogCabin::Storage::FilesystemUtil::fdatasync (const File &file)
 Flush changes to a File to its underlying storage device, except for atime/mtime.
void LogCabin::Storage::FilesystemUtil::flock (const File &file, int operation)
 Apply or remove an advisory lock on a file or directory.
std::string LogCabin::Storage::FilesystemUtil::tryFlock (const File &file, int operation)
 Apply or remove an advisory lock on a file or directory.
uint64_t LogCabin::Storage::FilesystemUtil::getSize (const File &file)
 Returns the size of the file in bytes.
std::vector< std::string > LogCabin::Storage::FilesystemUtil::ls (const std::string &path)
 List the contents of a directory by path.
std::vector< std::string > LogCabin::Storage::FilesystemUtil::ls (const File &dir)
 List the contents of an open directory.
File LogCabin::Storage::FilesystemUtil::openDir (const std::string &path)
 Open a directory, creating it if it doesn't exist.
File LogCabin::Storage::FilesystemUtil::openDir (const File &dir, const std::string &child)
 Open a directory relative to an already open directory, creating it if it doesn't exist.
File LogCabin::Storage::FilesystemUtil::openFile (const File &dir, const std::string &child, int flags)
 Open a file.
File LogCabin::Storage::FilesystemUtil::tryOpenFile (const File &dir, const std::string &child, int flags)
 Open a file.
void LogCabin::Storage::FilesystemUtil::remove (const std::string &path)
 Remove the file or directory at path.
void LogCabin::Storage::FilesystemUtil::removeFile (const File &dir, const std::string &path)
 Remove the file relative to an open directory.
void LogCabin::Storage::FilesystemUtil::rename (const File &oldDir, const std::string &oldChild, const File &newDir, const std::string &newChild)
 Rename a file.
void LogCabin::Storage::FilesystemUtil::syncDir (const std::string &path)
 Open a directory, fsync it, and close it.
void LogCabin::Storage::FilesystemUtil::truncate (const File &file, uint64_t bytes)
 Shrink or grow a file to the specified length, padding with zeros if necessary.
std::string LogCabin::Storage::FilesystemUtil::mkdtemp ()
 Return a path to a temporary directory.
ssize_t LogCabin::Storage::FilesystemUtil::write (int fildes, const void *data, uint64_t dataLen)
 A wrapper around write that retries interrupted calls.
ssize_t LogCabin::Storage::FilesystemUtil::write (int fildes, std::initializer_list< std::pair< const void *, uint64_t >> data)
 A wrapper around write that retries interrupted calls.

Detailed Description

Contains utilities for working with the filesystem.

Definition in file FilesystemUtil.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines