Complete milestone 09 world integration gate (#75)
Some checks failed
Native code generation / deterministic (push) Failing after 8m37s
Imaging and meshing gate / native (push) Successful in 5m24s
Native Rust workspace compile / compile (push) Failing after 6m15s

This commit is contained in:
2026-08-10 21:19:43 +00:00
parent 55424dbd7f
commit fdda05b53f
18 changed files with 767 additions and 82 deletions

View File

@@ -5,6 +5,7 @@
#![allow(clippy::needless_pass_by_value)]
use crate::agent_manager::EventRegistry;
use crate::client_core::ClientWeakHandle;
use crate::marketplace::{
MarketplaceFolderRole, MarketplaceListingStatus, MarketplaceValidationFlags,
};
@@ -291,8 +292,13 @@ impl MarketplaceListingsSyncedEventArgs {
}
}
enum MarketplaceClient {
Standalone(GridClient),
ClientOwned(ClientWeakHandle),
}
struct MarketplaceState {
client: GridClient,
client: RwLock<MarketplaceClient>,
by_id: RwLock<HashMap<i32, MarketplaceListing>>,
by_folder: RwLock<HashMap<UUID, MarketplaceListing>>,
errors: EventRegistry<MarketplaceErrorEventArgs>,
@@ -306,15 +312,36 @@ pub struct MarketplaceManager(Arc<MarketplaceState>);
impl MarketplaceManager {
pub fn new(client: GridClient) -> Result<Self, Error> {
Ok(Self(Arc::new(MarketplaceState {
client,
Ok(Self::with_client(MarketplaceClient::Standalone(client)))
}
fn with_client(client: MarketplaceClient) -> Self {
Self(Arc::new(MarketplaceState {
client: RwLock::new(client),
by_id: RwLock::new(HashMap::new()),
by_folder: RwLock::new(HashMap::new()),
errors: EventRegistry::default(),
changed: EventRegistry::default(),
synced: EventRegistry::default(),
live_mutations: AtomicBool::new(false),
})))
}))
}
pub(crate) fn native_new_client_owned(client: &GridClient) -> Self {
Self::with_client(MarketplaceClient::ClientOwned(client.native_weak_handle()))
}
pub(crate) fn native_bind_to_client(&self, client: &GridClient) {
*write(&self.0.client) = MarketplaceClient::ClientOwned(client.native_weak_handle());
}
fn client(&self) -> Result<GridClient, Error> {
match &*read(&self.0.client) {
MarketplaceClient::Standalone(client) => Ok(client.clone()),
MarketplaceClient::ClientOwned(client) => {
client.upgrade().ok_or(Error::InvalidOperation)
}
}
}
/// Explicitly enables mutation requests to non-test capability hosts.
@@ -366,8 +393,7 @@ impl MarketplaceManager {
async fn base_uri(&self, token: &CancellationToken) -> Result<Uri, Error> {
token.throw_if_cancellation_requested()?;
let simulator = self
.0
.client
.client()?
.native_network()?
.native_current_sim()
.ok_or(Error::InvalidOperation)?;
@@ -412,7 +438,7 @@ impl MarketplaceManager {
return Err(Error::InvalidOperation);
}
let uri = Uri(format!("{}/{}", base.0.trim_end_matches('/'), path));
let client = self.0.client.native_http_caps_client();
let client = self.client()?.native_http_caps_client();
match method {
"GET" => client.get(uri, token, None).await,
"POST" => {