Conversation
PagedSplats can page a RAD that is a plain ranged URL, or one already whole in memory, and fetchRange is module-private, so there is no way to sit in front of the reads. Two open needs run into that: decrypting or otherwise customising the fetch of a URL that Spark still owns (sparkjsdev#423, where the reporter patches dist by hand on every release), and paging a RAD that has no URL at all - a member inside a container, a picked File, OPFS, a page opened from file:// with no server to range against. One hook serves both. fetchRange(req) is handed the file to read - rootUrl, or a chunked RAD's sibling - the range, the requestHeader and withCredentials PagedSplats was built with, and its own abort signal. The url is undefined when there is no rootUrl, which is the case where the consumer itself is the source. A short return means the file ended, which lets the header probe stop backing off on a small file. Every RAD read now goes through one routing helper, so the hook covers the header probe, single-file chunks and sibling-file chunks alike, and the built-in path picks up the abort signal on the header probe, which it did not pass before.
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.
Why
Every RAD read in
PagedSplatsgoes throughfetchRange, which is module-private. Two open needs run into that wall from opposite sides:.radfiles with an encryption layer, signed requests, or a custom CDN. The URL is still Spark's; what's needed is to sit in front of the fetch. The reporter is patchingdist/spark.module.jsby hand on every release..radinside a container at an offset, in OPFS or IndexedDB, or a local file the user picked, readable only throughFile.slice. On a page opened fromfile://there is no server to range against either.requestHeaderandwithCredentialscover neither case.What
requestHeaderandwithCredentialsthePagedSplatswas built with, so a replacement can honour them rather than reimplement them.rootUrl,fileTypemust be given — there are no bytes to sniff before the first read — and the error says so.rootUrlandfileBytespaths are untouched; nothing changes for anyone who does not pass the hook.Every RAD read now goes through one routing helper, so the hook covers the header probe, single-file chunks and sibling-file chunks alike. One fix falls out of that: the built-in path now passes the abort signal on the header probe, which it did not before.
Verified
Built from this branch and driven in headless Chromium (SwiftShader) against a 106 MB archive holding a
.radmember, with norootUrl: the hook supplies the header and the chunk reads, the first chunk decodes to 48,196 splats, and opening the file costs 18 KB of reads. The same hook backs afile://page with no server, throughFile.slice.