uref: allow a uref to carry multiple ubufs - #1214
Draft
kierank wants to merge 2 commits into
Draft
Conversation
Contributor
Author
|
Maybe I can dump timestamp and duration as by definition of being in a uref they are the same |
Add a chain of additional ubufs to struct uref, linked by their own
uchain (unused while a ubuf is in flight), so that a single uref can
carry e.g. video, audio and subtitles at the same time.
The primary uref->ubuf is entry 0 and is untouched: legacy pipes keep
working unmodified and transparently pass additional entries through,
since uref_free frees the chain and uref_dup/uref_fork duplicate it
(a cheap reference increment). uref_dup_inner deliberately does not
duplicate the chain, so derived urefs (block splice/split, field
split) do not fan out the additional payloads.
Per-entry metadata (flow ID, flow def) is stored in the parent uref
attributes under indexed names ("sub[i].*") and is thus carried and
duplicated by the existing udict handling. All entries share the
dates and duration of the uref by definition, since they are part of
the same uref. The new uref_sub.h API provides
attach/get/detach/replace/find accessors, with lookup by flow ID.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add helpers to move attributes between the plain namespace of a standalone uref and the per-entry "sub[i]." namespace of a carrier uref, built generically on udict_iterate so they cover any attribute type, including ones defined in the future: - uref_sub_merge() consumes a standalone uref and appends its ubuf as a new entry, copying its plain attributes (with shorthands resolved to their canonical names) into the entry namespace. Its dates are discarded since all entries share the dates of the carrier by definition. - uref_sub_extract() creates a standalone uref from an entry, duplicating its ubuf, inheriting the carrier dates and flags, and renaming the entry attributes back to plain names, converted back to shorthand storage where applicable so that legacy typed accessors (uref_flow_get_def() etc.) find them. - uref_sub_delete_attrs() and uref_sub_rename_attrs() manage entry namespaces; uref_sub_detach_ubuf() now uses them to delete the detached entry's attributes and renumber the following entries, keeping indices and attributes consistent. The intended model is that entries are merged into a carrier at one pipe boundary and extracted back at another, so that pipes in between never need per-entry attribute access. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Looks simple enough, I guess use it to see if something is missing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a chain of additional ubufs to struct uref, linked by their own uchain (unused while a ubuf is in flight), so that a single uref can carry e.g. video, audio and subtitles at the same time.
The primary uref->ubuf is entry 0 and is untouched: legacy pipes keep working unmodified and transparently pass additional entries through, since uref_free frees the chain and uref_dup/uref_fork duplicate it (a cheap reference increment). uref_dup_inner deliberately does not duplicate the chain, so derived urefs (block splice/split, field split) do not fan out the additional payloads.
Per-entry metadata (flow ID, flow def, date, duration) is stored in the parent uref attributes under indexed names ("sub[i].*") and is thus carried and duplicated by the existing udict handling. The new uref_sub.h API provides attach/get/detach/replace/find accessors, with lookup by flow ID.