Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
staging.hpp
Go to the documentation of this file.
1#pragma once
2
11
16
17#include <cstdint>
18#include <filesystem>
19#include <functional>
20#include <memory>
21#include <string>
22#include <vector>
23
25
30public:
31 static runtime::Result<StagingArea, CapsuleError> create(const std::filesystem::path& parent);
32
34 StagingArea& operator=(StagingArea&&) noexcept;
35 StagingArea(const StagingArea&) = delete;
36 StagingArea& operator=(const StagingArea&) = delete;
38
39 const std::filesystem::path& root() const noexcept;
40
44 runtime::Result<void, CapsuleError> publish_no_replace(const std::filesystem::path& destination);
45
46private:
47 struct Impl;
48 explicit StagingArea(std::unique_ptr<Impl> impl);
49 std::unique_ptr<Impl> impl_;
50};
51
54using ExtractionProgress = std::function<bool(std::size_t member_index, std::size_t member_count)>;
55
60 const Manifest& manifest,
61 const StagingArea& staging,
62 const ExtractionProgress& progress = {});
63
95read_staged_member(const StagingArea& staging, const FileEntry& entry);
96
110read_staged_member(const std::filesystem::path& staging_root, const FileEntry& entry);
111
112} // namespace pulp::authoring_capsule
Bounded, deterministic capsule archive access.
A reader over an admitted archive.
Definition archive.hpp:37
A private directory that is removed when it goes out of scope unless it was published.
Definition staging.hpp:29
static runtime::Result< StagingArea, CapsuleError > create(const std::filesystem::path &parent)
runtime::Result< void, CapsuleError > publish_no_replace(const std::filesystem::path &destination)
Rename the staged tree to destination, which must not exist.
StagingArea(StagingArea &&) noexcept
const std::filesystem::path & root() const noexcept
Result<T, E> — either holds a T or an E, never both.
Definition result.hpp:76
The capsule envelope: the only authority for what a capsule is.
Definition archive.hpp:24
runtime::Result< std::vector< std::uint8_t >, CapsuleError > read_staged_member(const StagingArea &staging, const FileEntry &entry)
Read one member back out of a staged tree.
runtime::Result< void, CapsuleError > extract_declared(const CapsuleArchive &archive, const Manifest &manifest, const StagingArea &staging, const ExtractionProgress &progress={})
Extract only the members the manifest declares, verifying each digest as it lands.
std::function< bool(std::size_t member_index, std::size_t member_count)> ExtractionProgress
Progress and cancellation.
Definition staging.hpp:54
Definition generated_event_source.hpp:33
STL namespace.
Result<T, E> — success / failure union for fallible operations.
Admission failure vocabulary for authoring capsules.
A rejection with the exact subject that caused it.
Definition status.hpp:69
One row of the archive closure.
Definition component.hpp:110
Definition manifest.hpp:47