Skip to content

ludus::foundation::filesystem::WriteDirectory

Ludus Wiki · API overview · Browse API

Class

Explicit host-selected write capability on Windows, Linux and macOS. Other targets return Unsupported. Operates outside virtual mounts. Refuses child symlinks, Windows reparse points and non-regular destinations. Root selection is trusted; hostile renames, hard links and mounts are outside this boundary. Concurrent Publish calls require a stable owner lifetime and disjoint source buffers.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

#include <ludus/foundation/filesystem/persistence.hpp>
class ludus::foundation::filesystem::WriteDirectory final

Methods

WriteDirectory

ludus::foundation::filesystem::WriteDirectory::WriteDirectory() noexcept=default
Creates an empty capability.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

~WriteDirectory

ludus::foundation::filesystem::WriteDirectory::~WriteDirectory() noexcept
Releases the root best-effort.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

WriteDirectory

ludus::foundation::filesystem::WriteDirectory::WriteDirectory(const WriteDirectory &)=delete
Write capability ownership is move-only.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

operator=

WriteDirectory & ludus::foundation::filesystem::WriteDirectory::operator=(const WriteDirectory &)=delete
Write capability ownership is move-only.

Related types: WriteDirectory

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

WriteDirectory

ludus::foundation::filesystem::WriteDirectory::WriteDirectory(WriteDirectory &&other) noexcept
Transfers ownership, leaving other empty.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

operator=

WriteDirectory & ludus::foundation::filesystem::WriteDirectory::operator=(WriteDirectory &&other) noexcept
Releases the old capability and transfers ownership; self-move preserves it.

Related types: WriteDirectory

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

Open

Result ludus::foundation::filesystem::WriteDirectory::Open(std::string_view nativeRoot) noexcept
Pins a trusted nonempty native root; failure preserves the existing capability.

Related types: Result

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

IsOpen

bool ludus::foundation::filesystem::WriteDirectory::IsOpen() const noexcept
Returns whether a root is pinned.

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

Publish

PublicationResult ludus::foundation::filesystem::WriteDirectory::Publish(std::string_view relativePath, std::span< const uint8 > bytes, const WriteOptions &options={}) const noexcept
Writes a complete bounded buffer into an exclusive same-directory temporary. Checks the condition before and after preparation, then atomically renames. Linux and macOS use a 0600 temporary and an advisory directory lock. Windows inherits the directory ACL and takes a nonblocking write share on the reserved .ludus-write-lock file. Leave that file in place. Pre-publication failure preserves the destination; owned temporary cleanup is reported. Open File readers retain previous revisions. Publish allocates no C++ storage. FileAndDirectory reports a failed parent flush with Published still true. Native sync acknowledgments depend on the OS, filesystem and storage device.

Related types: uint8 · PublicationResult · WriteOptions

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp

Close

Result ludus::foundation::filesystem::WriteDirectory::Close() noexcept
Releases ownership even on error; repeated calls succeed. Requires exclusive access.

Related types: Result

Declared in modules/foundation/filesystem/include/ludus/foundation/filesystem/persistence.hpp