Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::project_package::AtomicPublisher Class Reference

Builds a private sibling directory and publishes it at a previously absent destination. More...

#include <atomic_publisher.hpp>

Public Member Functions

 ~AtomicPublisher ()
 AtomicPublisher (AtomicPublisher &&) noexcept
AtomicPublisher & operator= (AtomicPublisher &&) noexcept
 AtomicPublisher (const AtomicPublisher &)=delete
AtomicPublisher & operator= (const AtomicPublisher &)=delete
const std::filesystem::path & staging_directory () const noexcept
 Returns the private root for a directory publication.
const std::filesystem::path & staging_file () const noexcept
 Returns the pre-created private file slot for a file publication.
runtime::Result< bool, PackageError > write (std::string_view relative_utf8, std::span< const std::uint8_t > bytes) noexcept
 Writes and durably fences one lexically safe relative file.
runtime::Result< bool, PackageError > write (std::string_view relative_utf8, std::string_view text) noexcept
 Writes and durably fences one UTF-8 text file.
runtime::Result< AtomicPublishOutcome, PackageError > commit_file (const std::filesystem::path &staged_file) noexcept
 Publishes the pre-created staging_file() at the destination.
runtime::Result< AtomicPublishOutcome, PackageError > commit_directory () noexcept
 Publishes the complete staged tree without replacing an existing path.
void cancel () noexcept
 Removes unpublished staging on a best-effort basis.

Static Public Member Functions

static runtime::Result< AtomicPublisher, PackageError > create (const std::filesystem::path &destination) noexcept
 Creates a private staging sibling for a destination that must not exist.
static runtime::Result< AtomicPublisher, PackageError > create_file (const std::filesystem::path &destination) noexcept
 Creates a private, pre-permissioned file slot for one external writer.

Detailed Description

Builds a private sibling directory and publishes it at a previously absent destination.

Every staged file and directory entry is fenced before the destination name becomes visible. The private stage coordinates trusted writers; another process running as the same account must not rename or replace its entries behind the publisher.

Constructor & Destructor Documentation

◆ ~AtomicPublisher()

pulp::project_package::AtomicPublisher::~AtomicPublisher ( )

◆ AtomicPublisher() [1/2]

pulp::project_package::AtomicPublisher::AtomicPublisher ( AtomicPublisher && )
noexcept

◆ AtomicPublisher() [2/2]

pulp::project_package::AtomicPublisher::AtomicPublisher ( const AtomicPublisher & )
delete

Member Function Documentation

◆ cancel()

void pulp::project_package::AtomicPublisher::cancel ( )
noexcept

Removes unpublished staging on a best-effort basis.

◆ commit_directory()

runtime::Result< AtomicPublishOutcome, PackageError > pulp::project_package::AtomicPublisher::commit_directory ( )
noexcept

Publishes the complete staged tree without replacing an existing path.

All file bytes and nested directory entries are durable before the destination name becomes visible. A post-publication finalization failure returns PublishedDurabilityUncertain, never NotPublished.

◆ commit_file()

runtime::Result< AtomicPublishOutcome, PackageError > pulp::project_package::AtomicPublisher::commit_file ( const std::filesystem::path & staged_file)
noexcept

Publishes the pre-created staging_file() at the destination.

The destination must not exist. A post-publication finalization failure returns PublishedDurabilityUncertain, never NotPublished.

◆ create()

runtime::Result< AtomicPublisher, PackageError > pulp::project_package::AtomicPublisher::create ( const std::filesystem::path & destination)
staticnoexcept

Creates a private staging sibling for a destination that must not exist.

◆ create_file()

runtime::Result< AtomicPublisher, PackageError > pulp::project_package::AtomicPublisher::create_file ( const std::filesystem::path & destination)
staticnoexcept

Creates a private, pre-permissioned file slot for one external writer.

◆ operator=() [1/2]

AtomicPublisher & pulp::project_package::AtomicPublisher::operator= ( AtomicPublisher && )
noexcept

◆ operator=() [2/2]

AtomicPublisher & pulp::project_package::AtomicPublisher::operator= ( const AtomicPublisher & )
delete

◆ staging_directory()

const std::filesystem::path & pulp::project_package::AtomicPublisher::staging_directory ( ) const
noexcept

Returns the private root for a directory publication.

External writers must stop before commit_directory() or cancel() begins.

◆ staging_file()

const std::filesystem::path & pulp::project_package::AtomicPublisher::staging_file ( ) const
noexcept

Returns the pre-created private file slot for a file publication.

The external writer may truncate and fill this file, but must stop before commit_file() or cancel() begins.

◆ write() [1/2]

runtime::Result< bool, PackageError > pulp::project_package::AtomicPublisher::write ( std::string_view relative_utf8,
std::span< const std::uint8_t > bytes )
noexcept

Writes and durably fences one lexically safe relative file.

◆ write() [2/2]

runtime::Result< bool, PackageError > pulp::project_package::AtomicPublisher::write ( std::string_view relative_utf8,
std::string_view text )
noexcept

Writes and durably fences one UTF-8 text file.


The documentation for this class was generated from the following file:
  • /home/runner/work/pulp/pulp/core/project_package/include/pulp/project_package/atomic_publisher.hpp