Implement capability event queue processing (#55)
Some checks failed
Native code generation / deterministic (push) Failing after 1m15s
Imaging and meshing gate / native (push) Successful in 3m58s
Native Rust workspace compile / compile (push) Successful in 4m1s

This commit is contained in:
2026-08-09 16:49:20 +00:00
parent 3032b16e7b
commit aa269f1785
11 changed files with 5041 additions and 919 deletions

View File

@@ -1,4 +1,4 @@
# Capability HTTP, rate limiting, and downloads
# Capability HTTP, event queues, rate limiting, and downloads
`HttpCapsClient`, `CapsRateLimiter`, and `Http::DownloadManager` are native Rust
implementations of the corresponding LibreMetaverse classes. They do not call
@@ -7,6 +7,27 @@ client using rustls, its category limiter, and their shutdown order. Tests and
embedders can inject either a `reqwest::Client` or an executor-neutral
`HttpMessageHandler`, plus a `TimeProvider` for deterministic token-bucket time.
## Seed capabilities and EventQueueGet
`Simulator::SetSeedCaps` owns a native `Caps` instance. It posts the complete
reference capability-name array as LLSD/XML, accepts only HTTP(S) capability
URIs, registers every accepted URI with the category limiter, and starts
`EventQueueGet` when advertised. Seed requests retry transient failures with
bounded exponential backoff, stop permanently on HTTP 404, and are cancelled
and joined when a simulator changes seed capability or disconnects.
The event queue sends the reference `{ ack, done }` LLSD/XML shape, begins with
acknowledgement zero, and advances the acknowledgement only after a complete,
valid `{ id, events }` response. Responses are limited to 1,024 events, 100,000
nodes per body, and 8 MiB of binary data per body. Raw events are invoked in
wire order, including unknown names. Known messages use the native Linden LLSD
codecs and the same named/default CAPS callback registry as UDP; otherwise the
generic packet catalog translates the body and feeds the bounded incoming UDP
dispatch queue. Transient HTTP failures use bounded deterministic-jitter
backoff, 404/410/499 close the poller, and graceful shutdown posts one final
`done = true` acknowledgement. Cancellation interrupts an outstanding poll and
joins its owned thread promptly.
## HTTP policy
Only absolute `http` and `https` request URIs are accepted. Response headers
@@ -76,6 +97,9 @@ Run the deterministic issue gate with:
```sh
cargo test -p libremetaverse --test caps_http
cargo test -p libremetaverse --lib event_queue::tests
cargo test -p libremetaverse --lib caps::tests
cargo test -p libremetaverse --lib message_decoder::tests
cargo test -p libremetaverse-compat-tests --test network_semantics queue_download
cargo test -p libremetaverse-compat-tests --test network_semantics put_response_with_non_http_location
```