feat(simulation): serve atlas layer requests over the bridge — completes #969 (D-225)
Closes the server-side layer-stream loop. serve_atlas_requests (PreInput) drains the AtlasRequestBuffer and runs each through handle_atlas_request (cache hit -> Ready; miss -> resolve via BodySourceResolver + enqueue an Immediate AnalyzeBody -> Pending), buffering AtlasLayerResponses. send_atlas_responses (PostSnapshot) flushes them to the client. main.rs wires BodySourceResolverResource (base root = systems.db's 3rd ancestor; mod roots layer on later). Misses flow through the #968 background tier and a re-request hits the now-warm cache. Full path now live server-side: client request -> receive() demux -> serve -> proxy -> (cache | queue+cascade) -> response -> client. The client half (send request, decode response, render overlays) is #960. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -174,6 +174,30 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Mod-first body source resolver for the atlas layer proxy (#969, D-225).
|
||||
// terrain_reference is repo-root-relative; the repo root is systems.db's
|
||||
// 3rd ancestor (<repo>/server/data/systems.db).
|
||||
let world_root = systems_db_path
|
||||
.canonicalize()
|
||||
.ok()
|
||||
.and_then(|p| p.ancestors().nth(3).map(std::path::Path::to_path_buf))
|
||||
.unwrap_or_else(|| std::path::PathBuf::from(".."));
|
||||
match settled_reach_server::atlas::source_resolver::BodySourceResolver::open(
|
||||
&systems_db_path,
|
||||
vec![world_root.clone()],
|
||||
) {
|
||||
Ok(resolver) => {
|
||||
tracing::info!("Body source resolver opened (root: {:?})", world_root);
|
||||
app.insert_resource(
|
||||
settled_reach_server::atlas::source_resolver::BodySourceResolverResource(resolver),
|
||||
);
|
||||
}
|
||||
Err(e) => tracing::warn!(
|
||||
"Body source resolver unavailable ({}). Atlas layer requests will error.",
|
||||
e
|
||||
),
|
||||
}
|
||||
|
||||
// Initialize SQLite settings store (#627).
|
||||
// Path: alongside save files in the server's working directory.
|
||||
let settings_path = std::path::PathBuf::from("settings.db");
|
||||
|
||||
Reference in New Issue
Block a user