Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
processor_restore.hpp
Go to the documentation of this file.
1#pragma once
2
4
5#include <cstdint>
6#include <functional>
7#include <map>
8#include <memory>
9#include <span>
10#include <string>
11#include <vector>
12
13namespace pulp::format {
15}
16
17namespace pulp::host {
18
20 std::string type_id;
21 int type_version = 1;
22 friend bool operator==(const ProcessorTypeKey&, const ProcessorTypeKey&) = default;
23};
24
40
43
57 std::function<std::shared_ptr<format::ProcessorNodeInstance>()> create;
58};
59
64 std::uint32_t node_id = 0;
69 std::span<const std::uint8_t> parameters;
70 std::span<const std::uint8_t> custom;
71};
72
74 std::uint32_t node_id = 0;
75 std::shared_ptr<format::ProcessorNodeInstance> instance;
76};
77
80 std::uint32_t node_id = 0;
84 std::vector<RestoredProcessor> processors;
85 bool ok() const noexcept {
87 }
88};
89
100 public:
101 static constexpr std::size_t max_nodes = 4096;
102 static constexpr std::size_t max_state_part_bytes = 8 * 1024 * 1024;
103 static constexpr std::size_t max_total_state_bytes = 32 * 1024 * 1024;
104
106
112 ProcessorRestoreResult restore_batch(std::span<const ProcessorRestoreRecord> records,
113 std::span<const ProcessorTypeKey> allowlist) const;
114
115 private:
116 std::map<std::pair<std::string, int>, ProcessorRestoreDescriptor> descriptors_;
117};
118
119} // namespace pulp::host
Retained, self-contained lifetime for an authored in-process graph node.
Definition processor_node_adapter.hpp:114
Control-thread building block for hosts restoring a set of Processor nodes.
Definition processor_restore.hpp:99
static constexpr std::size_t max_total_state_bytes
Definition processor_restore.hpp:103
static constexpr std::size_t max_state_part_bytes
Definition processor_restore.hpp:102
ProcessorRestoreCode register_type(ProcessorRestoreDescriptor descriptor)
static constexpr std::size_t max_nodes
Definition processor_restore.hpp:101
ProcessorRestoreResult restore_batch(std::span< const ProcessorRestoreRecord > records, std::span< const ProcessorTypeKey > allowlist) const
Validates the entire batch and its explicit allowlist before executing factories; constructs and chec...
What the product grants a device: the quota table indexed by capability tier and live thermal state.
Definition aax_editor.hpp:31
Bounded event contracts shared by host ingress and graph-authored nodes.
Definition anticipation_eligibility.hpp:9
const char * processor_restore_code_name(ProcessorRestoreCode code) noexcept
Stable names for machine-readable diagnostics; messages are supplementary.
ProcessorRestoreCode
Definition processor_restore.hpp:25
@ UnknownProcessorType
Definition processor_restore.hpp:31
@ UnsupportedVersion
Definition processor_restore.hpp:33
@ ProcessorCapabilityMismatch
Definition processor_restore.hpp:37
@ InvalidDescriptor
Definition processor_restore.hpp:27
@ Restored
Definition processor_restore.hpp:26
@ ProcessorStateRestoreFailed
Definition processor_restore.hpp:38
@ ProcessorConstructionFailed
Definition processor_restore.hpp:34
@ InvalidRecord
Definition processor_restore.hpp:29
@ StateLimitExceeded
Definition processor_restore.hpp:30
@ ProcessorTypeDisallowed
Definition processor_restore.hpp:32
@ ProcessorInstanceNotFresh
Definition processor_restore.hpp:35
@ ProcessorPortMismatch
Definition processor_restore.hpp:36
@ DuplicateProcessorType
Definition processor_restore.hpp:28
Capability sidecar for the node ABI.
Definition plugin_descriptor.hpp:217
Application-owned, exact-version registration.
Definition processor_restore.hpp:48
int input_channels
Definition processor_restore.hpp:51
ProcessorTypeKey type
Definition processor_restore.hpp:49
std::function< std::shared_ptr< format::ProcessorNodeInstance >()> create
Trusted control-thread code.
Definition processor_restore.hpp:57
format::NodeCapabilities capabilities
Definition processor_restore.hpp:53
int output_channels
Definition processor_restore.hpp:52
int state_schema_version
Definition processor_restore.hpp:50
Already decoded two-part state.
Definition processor_restore.hpp:63
std::span< const std::uint8_t > custom
Definition processor_restore.hpp:70
std::uint32_t node_id
Definition processor_restore.hpp:64
int input_channels
Definition processor_restore.hpp:67
int state_schema_version
Definition processor_restore.hpp:66
std::span< const std::uint8_t > parameters
Definition processor_restore.hpp:69
int output_channels
Definition processor_restore.hpp:68
ProcessorTypeKey type
Definition processor_restore.hpp:65
Definition processor_restore.hpp:78
bool ok() const noexcept
Definition processor_restore.hpp:85
std::uint32_t node_id
Definition processor_restore.hpp:80
ProcessorRestoreCode code
Definition processor_restore.hpp:79
ProcessorTypeKey type
Definition processor_restore.hpp:81
std::vector< RestoredProcessor > processors
Empty on every failure, including a failure after an earlier restore.
Definition processor_restore.hpp:84
Definition processor_restore.hpp:19
friend bool operator==(const ProcessorTypeKey &, const ProcessorTypeKey &)=default
std::string type_id
Definition processor_restore.hpp:20
int type_version
Definition processor_restore.hpp:21
Definition processor_restore.hpp:73
std::shared_ptr< format::ProcessorNodeInstance > instance
Definition processor_restore.hpp:75
std::uint32_t node_id
Definition processor_restore.hpp:74