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
15	let Scheme = Parameter.get("scheme").and_then(Value::as_str).unwrap_or("");
16
17	if Handle == 0 {
18		dev_log!(
19			"provider-register",
20			"[ProviderUnregister] file_system skip: missing handle (scheme={})",
21			Scheme
22		);
23
24		return;
25	}
26
27	Service
28		.RunTime()
29		.Environment
30		.ApplicationState
31		.Extension
32		.ProviderRegistration
33		.UnregisterProvider(Handle);
34
35	dev_log!(
36		"provider-register",
37		"[ProviderUnregister] file_system handle={} scheme={}",
38		Handle,
39		Scheme
40	);
41}