Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
project_package.hpp
Go to the documentation of this file.
1#pragma once
2
7
8#include <cstdint>
9#include <filesystem>
10#include <memory>
11#include <span>
12#include <vector>
13
14namespace pulp::project_package {
15
17enum class BlobStore : std::uint8_t { Media, State, Artifact, Receipt };
18
27
31 std::uint64_t max_blob_bytes = 8ull * 1024ull * 1024ull * 1024ull;
33 std::uint64_t max_project_bytes = 64ull * 1024ull * 1024ull;
34};
35
41 std::filesystem::path journal_directory;
43 std::filesystem::path cache_directory;
45 bool cache_recreated = false;
46};
47
52 public:
55 create(const std::filesystem::path& root, timeline::SchemaRegistry registry,
56 const PackageLimits& limits = {}) noexcept;
57
60 PackageWriter& operator=(PackageWriter&&) noexcept;
61 PackageWriter(const PackageWriter&) = delete;
62 PackageWriter& operator=(const PackageWriter&) = delete;
63
65 const std::filesystem::path& root() const noexcept;
67 bool recovered_staging() const noexcept;
68
71 stage_blob(BlobStore store, const timeline::ContentHash& expected,
72 std::span<const std::uint8_t> bytes) noexcept;
75 publish(const timeline::Project& project) noexcept;
76
77 private:
78 struct Impl;
79 explicit PackageWriter(std::unique_ptr<Impl> impl) noexcept;
80 std::unique_ptr<Impl> impl_;
81};
82
85open_package(const std::filesystem::path& root, const timeline::SchemaRegistry& registry,
86 const PackageLimits& limits = {}) noexcept;
87
90read_blob(const std::filesystem::path& root, const BlobReference& reference,
91 std::uint64_t maximum_bytes) noexcept;
92
93} // namespace pulp::project_package
runtime::Result< BlobReference, PackageError > stage_blob(BlobStore store, const timeline::ContentHash &expected, std::span< const std::uint8_t > bytes) noexcept
Hash-verifies, fences, and no-replace publishes one blob before it can be referenced.
PackageWriter(PackageWriter &&) noexcept
static runtime::Result< PackageWriter, PackageError > create(const std::filesystem::path &root, timeline::SchemaRegistry registry, const PackageLimits &limits={}) noexcept
Creates or opens the package layout and acquires its non-blocking writer lock.
runtime::Result< AtomicPublishOutcome, PackageError > publish(const timeline::Project &project) noexcept
Publishes project.json only after validating every packaged asset reference.
const std::filesystem::path & root() const noexcept
Returns the canonical stable package root.
bool recovered_staging() const noexcept
Reports whether opening reclaimed a private temp left by an interrupted writer.
Result<T, E> — either holds a T or an E, never both.
Definition result.hpp:76
Durable SHA-256 identity for sealed media bytes.
Definition assets.hpp:24
Immutable root of a Timeline document and its monotonic identity domain.
Definition model.hpp:1079
Immutable, shareable registry of Timeline schema contracts.
Definition schema_registry.hpp:189
Definition atomic_publisher.hpp:12
runtime::Result< std::vector< std::uint8_t >, PackageError > read_blob(const std::filesystem::path &root, const BlobReference &reference, std::uint64_t maximum_bytes) noexcept
Reads a bounded blob and verifies its bytes against the reference hash.
BlobStore
Content-addressed store within a project package.
Definition project_package.hpp:17
@ Media
Definition project_package.hpp:17
@ State
Definition project_package.hpp:17
@ Artifact
Definition project_package.hpp:17
@ Receipt
Definition project_package.hpp:17
AtomicPublishOutcome
Visibility and finalization state after a namespace-publication attempt.
Definition atomic_publisher.hpp:36
runtime::Result< OpenPackageResult, PackageError > open_package(const std::filesystem::path &root, const timeline::SchemaRegistry &registry, const PackageLimits &limits={}) noexcept
Opens and validates the sole referencing generation in a stable package root.
Definition generated_event_source.hpp:33
Definition program_compiler.hpp:18
STL namespace.
Exact package location of one SHA-256-addressed blob.
Definition project_package.hpp:20
BlobStore store
Store containing the blob.
Definition project_package.hpp:22
constexpr auto operator<=>(const BlobReference &) const =default
timeline::ContentHash hash
SHA-256 identity used as the blob filename.
Definition project_package.hpp:24
Validated package generation and its package-owned working directories.
Definition project_package.hpp:37
timeline::Project project
Fully decoded, reference-validated generation.
Definition project_package.hpp:39
std::filesystem::path journal_directory
Stable directory in which FileJournal state may be opened.
Definition project_package.hpp:41
std::filesystem::path cache_directory
Recoverable derived-data directory.
Definition project_package.hpp:43
bool cache_recreated
Whether this open recreated a missing cache directory.
Definition project_package.hpp:45
Path-bearing package failure.
Definition atomic_publisher.hpp:28
Admission limits for untrusted project and blob bytes.
Definition project_package.hpp:29
std::uint64_t max_project_bytes
Maximum admitted bytes for project.json.
Definition project_package.hpp:33
std::uint64_t max_blob_bytes
Maximum admitted bytes for one content-addressed blob.
Definition project_package.hpp:31