Q-W5: persist → session/ext_state_io/prune_fs (deletion authority concentrated); one GetProjExtState grow-loop in bridge_marshal (T2-04, ×3 rewired); bank_book JSON codec → bank_book_json via private static nameKey; persist.h stays umbrella. 61/61 green.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
#pragma once
|
||||
// ext_state_io — the ext-state ↔ JSON serialization half of the persist seam
|
||||
// (Q-W5 split of the former persist god-TU; session.h holds the ReaSamplerSession
|
||||
// lifecycle, prune_fs.cpp the prune scan + the single file-deletion authority).
|
||||
// This header owns the persist-side key spellings and the channel-derived
|
||||
// namespace accessor; the TU (ext_state_io.cpp) implements the session's
|
||||
// save/load/assignment-request bridge plus the GUID minting and bank-folder
|
||||
// relocation helpers the poll executes.
|
||||
//
|
||||
// The ext-state namespace + the WIRE-SHARED key names are the contract between this
|
||||
// extension (writer) and the VST3 instrument (reader), so they live in ext_keys.h
|
||||
// (pure, REAPER-free) and are included here — not duplicated. The namespace is
|
||||
// CHANNEL-DERIVED (Phase V, V4): ext_keys.h's kProjExtNamespace / this projExtNamespace()
|
||||
// both delegate to app_version's extStateNamespace() — "reasampler" on stable (byte-
|
||||
// identical to the pre-V4 build) or "reasampler_beta" on the isolated beta build. Both
|
||||
// artifacts read the ONE app_version symbol, so the instrument reads exactly the namespace
|
||||
// the extension writes, per channel. Beta reads/writes ONLY its own namespace — a project
|
||||
// saved by stable shows empty/default state in beta and vice versa; that isolation is the
|
||||
// accepted V4 safety property (no cross-namespace read, migration, or fallback), not a bug.
|
||||
// The per-key semantics persist relies on (spellings owned by ext_keys.h):
|
||||
// * kProjExtBanksKey : the whole serialized BankBook (pool + named banks).
|
||||
// AUTHORITATIVE going forward; the VST reads this key to see the live bank.
|
||||
// * kProjExtIndexKey : RETIRED legacy single-bank key. No longer WRITTEN (cleared
|
||||
// on save); READ once on load to migrate a legacy project into the pool.
|
||||
// * kProjExtViewKey : the Design-View ViewModeModel JSON.
|
||||
// * kProjExtTailKey : the docked panel's TailSetting JSON.
|
||||
// * kProjExtGuidKey : the per-project minted GUID (content-based identity; poll()
|
||||
// tells a Save-As from a recycled-pointer project switch by it).
|
||||
// All are FOREVER-STABLE once shipped: changing any strands every already-saved
|
||||
// project's stored state under that key.
|
||||
|
||||
#include "core/version/app_version.h"
|
||||
#include "ext_keys.h"
|
||||
|
||||
namespace reasampler {
|
||||
|
||||
// The accessor form of the namespace: ext_keys.h's kProjExtNamespace is the value; this
|
||||
// is the const char* the SetProjExtState/GetProjExtState calls pass. Kept as an
|
||||
// accessor (not a literal) because the string is channel-derived at build time.
|
||||
inline const char* projExtNamespace() { return version::extStateNamespace().c_str(); }
|
||||
|
||||
// The two EXTENSION-ONLY keys — NOT part of the VST wire contract (the instrument
|
||||
// reads only banks/view/tail/guid), so they stay here rather than in ext_keys.h:
|
||||
//
|
||||
// owned_files — the owned-file manifest JSON (project-relative files the capture path
|
||||
// itself created; Phase B B-cap seam, consumed by Phase R prune to tell the bank system's
|
||||
// own orphans from hand-dropped files). A SIBLING key alongside banks/view/tail — NOT
|
||||
// folded into `banks`, so it stays decoupled from membership. FOREVER-STABLE: changing it
|
||||
// strands every saved project's ownership record (prune falls back to an empty manifest —
|
||||
// graceful, but the attribution safety net is lost until the next capture rebuilds it).
|
||||
inline constexpr const char* kProjExtOwnedKey = "owned_files";
|
||||
|
||||
// version — the ReaSampler version that last WROTE this project (Phase V, V1). Written on
|
||||
// every save, so every saved .rpp records which build produced its state — the seam a
|
||||
// future within-channel forward migration keys off. An absent key is the explicit
|
||||
// pre-versioning case, read silently, never an error. FOREVER-STABLE key string.
|
||||
inline constexpr const char* kProjExtVersionKey = "version";
|
||||
|
||||
} // namespace reasampler
|
||||
Reference in New Issue
Block a user