mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-10 09:52:18 +02:00
Second step of the shared-recording model. A materialization is now identified by what it contains rather than by the first request for it, so two principals asking for the same media converge on one physical file with two library entries and a reference count of two. The identity rule stays in the DVR, which is the only place that knows what makes two requests the same recording. It is supplied as a serialised, field-named key rather than a Debug string, because it is persisted and has to survive a build that reorders the enum. A task with no identity falls back to a file keyed on its own uuid, so unidentified tasks cannot silently collide on one file. Detaching is now meaningful: dropping one entry leaves the file and the other entry intact, and only the last detach removes the file. Six tests cover convergence, per-principal views of one file, distinct media staying distinct, partial detach and last detach. Behaviour is unchanged. The service still rejects a cross-principal duplicate before it reaches persistence, so no two entries share a file in practice yet. Enabling that additionally requires the queue to stop promoting one task at a time into a single `active` slot: two entries on one file would otherwise each be promoted and each run a transfer to the same path. That is the next step, and it is why this one stops at persistence.