Skip to main content

Mountain/Vine/Server/Notification/
UnregisterFileSystemProvider.rs

1#![allow(non_snake_case)]
2//! Cocoon → Mountain `unregister_file_system_provider` notification.
3//! Emitted by `Cocoon/.../WorkspaceNamespace/Providers.ts:78` on
4//! `FileSystemProvider` disposal. Scheme-bound: the paired
5//! `register_file_system_provider` stores the scheme in the provider
6//! selector so filesystem router lookups stop routing to this handle.
7
8use serde_json::Value;
9
10use crate::{Vine::Server::MountainVinegRPCService::MountainVinegRPCService, dev_log};
11
12pub async fn UnregisterFileSystemProvider(Service:&MountainVinegRPCService, Parameter:&Value) {
13	let Handle = Parameter.get("handle").and_then(Value::as_u64).unwrap_or(0) as u32;
14	let Scheme = Parameter.get("scheme").and_then(Value::as_str).unwrap_or("");
15	if Handle == 0 {
16		dev_log!(
17			"provider-register",
18			"[ProviderUnregister] file_system skip: missing handle (scheme={})",
19			Scheme
20		);
21		return;
22	}
23	Service
24		.RunTime()
25		.Environment
26		.ApplicationState
27		.Extension
28		.ProviderRegistration
29		.UnregisterProvider(Handle);
30	dev_log!(
31		"provider-register",
32		"[ProviderUnregister] file_system handle={} scheme={}",
33		Handle,
34		Scheme
35	);
36}