LLVM 22.0.0git
llvm::cas::ondisk Namespace Reference

Classes

class  DatabaseFile
 Encapsulate a database file, which: More...
class  TableHandle
 Generic handle for a table. More...

Typedefs

using MappedFileRegion = MappedFileRegionArena::RegionT

Functions

Error createTableConfigError (std::errc ErrC, StringRef Path, StringRef TableName, const Twine &Msg)
Error checkTable (StringRef Label, size_t Expected, size_t Observed, StringRef Path, StringRef TrieName)
std::error_code lockFileThreadSafe (int FD, llvm::sys::fs::LockKind Kind)
 Thread-safe alternative to sys::fs::lockFile.
std::error_code unlockFileThreadSafe (int FD)
 Thread-safe alternative to sys::fs::unlockFile.
std::error_code tryLockFileThreadSafe (int FD, std::chrono::milliseconds Timeout=std::chrono::milliseconds(0), llvm::sys::fs::LockKind Kind=llvm::sys::fs::LockKind::Exclusive)
 Thread-safe alternative to sys::fs::tryLockFile.
Expected< size_t > preallocateFileTail (int FD, size_t CurrentSize, size_t NewSize)
 Allocate space for the file FD on disk, if the filesystem supports it.

Typedef Documentation

◆ MappedFileRegion

Function Documentation

◆ checkTable()

Error llvm::cas::ondisk::checkTable ( StringRef Label,
size_t Expected,
size_t Observed,
StringRef Path,
StringRef TrieName )

Definition at line 25 of file DatabaseFile.cpp.

References createTableConfigError(), and llvm::Error::success().

◆ createTableConfigError()

Error llvm::cas::ondisk::createTableConfigError ( std::errc ErrC,
StringRef Path,
StringRef TableName,
const Twine & Msg )

◆ lockFileThreadSafe()

std::error_code llvm::cas::ondisk::lockFileThreadSafe ( int FD,
llvm::sys::fs::LockKind Kind )

Thread-safe alternative to sys::fs::lockFile.

This does not support all the platforms that sys::fs::lockFile does, so keep it in the CAS library for now.

Definition at line 30 of file OnDiskCommon.cpp.

References llvm::sys::fs::Exclusive, llvm::sys::fs::lockFile(), and llvm::make_error_code().

◆ preallocateFileTail()

Expected< size_t > llvm::cas::ondisk::preallocateFileTail ( int FD,
size_t CurrentSize,
size_t NewSize )

Allocate space for the file FD on disk, if the filesystem supports it.

On filesystems that support this operation, this ensures errors such as std::errc::no_space_on_device are detected before we write data.

Returns
the new size of the file, or an Error.

Definition at line 84 of file OnDiskCommon.cpp.

References assert(), llvm::createStringError(), and llvm::errnoAsErrorCode().

Referenced by llvm::cas::MappedFileRegionArena::allocateOffset().

◆ tryLockFileThreadSafe()

std::error_code llvm::cas::ondisk::tryLockFileThreadSafe ( int FD,
std::chrono::milliseconds Timeout = std::chrono::milliseconds(0),
llvm::sys::fs::LockKind Kind = llvm::sys::fs::LockKind::Exclusive )

Thread-safe alternative to sys::fs::tryLockFile.

This does not support all the platforms that sys::fs::lockFile does, so keep it in the CAS library for now.

Definition at line 58 of file OnDiskCommon.cpp.

References llvm::sys::fs::Exclusive, llvm::make_error_code(), llvm::Timeout, and llvm::sys::fs::tryLockFile().

◆ unlockFileThreadSafe()

std::error_code llvm::cas::ondisk::unlockFileThreadSafe ( int FD)

Thread-safe alternative to sys::fs::unlockFile.

This does not support all the platforms that sys::fs::lockFile does, so keep it in the CAS library for now.

Definition at line 44 of file OnDiskCommon.cpp.

References llvm::make_error_code(), and llvm::sys::fs::unlockFile().