Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
live_swap_transaction.hpp File Reference

One reload session = one atomic unit across UX + DSP. More...

#include <exception>
#include <functional>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  pulp::format::reload::SwapStage
 One half of a live swap. More...
struct  pulp::format::reload::LiveSwapResult
class  pulp::format::reload::SwapUnit
 The contract a swappable subsystem implements to join a live-swap transaction More...

Namespaces

namespace  pulp
namespace  pulp::format
 What the product grants a device: the quota table indexed by capability tier and live thermal state.
namespace  pulp::format::reload

Functions

LiveSwapResult pulp::format::reload::apply_live_swap (const std::vector< SwapStage > &stages)
 Apply stages as one transaction.
LiveSwapResult pulp::format::reload::apply_live_swap (const std::vector< SwapUnit * > &units)
 Run an ordered set of SwapUnits as one transaction: collect each unit's stage (snapshotting current state), then delegate to apply_live_swap.

Detailed Description

One reload session = one atomic unit across UX + DSP.

A content pack can carry BOTH a new scripted UI and new DSP. Applied independently, a failure in one half leaves a mismatched plugin — a new UI bound to old DSP, or vice versa. This coordinator applies the halves as a single transaction: apply stages in order; if ANY stage fails (returns false or throws), roll back the stages that already succeeded, in reverse order, so the plugin returns wholesale to its last-good state. Either everything swaps or nothing does.

Stage ordering is the contract. A stage's apply must be atomic — on failure it leaves NO partial state (the DSP reload keeps the old processor; the scripted-UI reload self-restores its own tree). Order stages easiest-to-roll-back first, so the hardest-to-undo stage is LAST and is therefore never rolled back (nothing runs after it). For UX+DSP that means UX first (rebuild is cheap to re-apply from the previous code + state) and the DSP slot swap last (un-swapping a live processor is expensive; putting it last means a DSP failure only rolls back the already-applied UX, and a DSP success ends the transaction with nothing left to undo).

Control-thread only — this orchestrates the existing atomic reload paths (ReloadSession / ScriptedUiSession); it does no audio-thread work itself.