Repository navigation
assets.fetch: AssetFetcher in the library (feature assets), used by play - #283
Merged
Merged
Conversation
assets.fetch / assets.fetched / assets.cancel on the host channel: a download into <--assets>/cache/ (path checked, .part then renamed, recorded beside it), cached by the same url or sha256, a wrong sha256 refused, 64 MiB a body, 16 at once then queued, a canceled request forgotten; caps "assets". readAsset then reads it. RUNTIME.md "Assets". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
src/assets.rs: a HostServices any app holding a GameSession can use (https only by default, the embedder's policy and agent as hooks); play uses it with http allowed. net.rs is main's again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
assets.*is a host-channel family for games that stream files they do not ship (a globe's tiles, a place's models). The app downloads each file into the asset root'scache/, and the game reads it withreadAsset. Files stay there across runs, socache/is the game's offline cache. Any app that holds aGameSessioncan use it from the library:threert-render playis one user, an embedding native app (EarthRT for macOS) is another.{ t: "assets.fetch", id, url, path, sha256? }{ t: "assets.fetched", id, path, status, size, cached, error? }{ t: "assets.cancel", id }renderer/src/assets.rs(cargo featureassets: ureq on rustls; on withnet, so by default):AssetFetcher::new(asset_root)is aHostServices(post/poll/caps=["assets"]).cache/: no./..parts, backslashes,:, or a download's own files.<path>.part, renames it, and records{url, sha256, size}beside it (.<name>.fetched).cached: truefor the sameurl, or for the samesha256(a file without a record is hashed).sha256; at most 64 MiB a body.erroron failure.https://only by default.with_policy(Fn(&str) -> Result<(), String>)checks an address before it is queued.with_agent(ureq::Agent)gives the embedder's resolver, proxy and redirect rule.counts()/pending()feed a status page.threert-render playadds it to its services withhttp_or_https()and<--assets>as the root.src/net.rsis unchanged.Merge gate (tier T: host services; nothing the renderer draws)
cargo test --release --lib assets::(2 tests).assets_come_into_the_cacheruns against an HTTP server on the machine and covers:cachedby address and by hash;cargo build --release,cargo check --no-default-features,cargo check --lib --no-default-features --features assets.🤖 Generated with Claude Code