refactor: Begin migration to nyash.toml v2 plugin system

- Rename legacy plugin files to *_legacy.rs for protection
- Comment out old plugin loader and Host VTable dependencies
- Add temporary stub for create_plugin_box during migration
- Fix doc comment placement in io_methods.rs
- Prepare for v2 plugin system with single FFI entry point
This commit is contained in:
Moe Charm
2025-08-19 05:05:21 +09:00
parent e1b148051b
commit 806aece8ad
9 changed files with 805 additions and 26 deletions

View File

@ -75,26 +75,11 @@ impl BoxFactoryRegistry {
}
}
/// プラグインBoxを生成内部使用
/// プラグインBoxを生成v2への移行中の一時的スタブ
fn create_plugin_box(&self, plugin_name: &str, box_name: &str, args: &[Box<dyn NyashBox>]) -> Result<Box<dyn NyashBox>, String> {
use crate::runtime::{get_global_loader, PluginBox};
use crate::bid::{BidHandle, BoxTypeId};
let loader = get_global_loader();
// プラグインの"new"メソッドを呼び出してハンドルを取得
// TODO: 引数をBID-1 TLVでエンコードして渡す
let type_id = match box_name {
"FileBox" => BoxTypeId::FileBox as u32,
"StringBox" => BoxTypeId::StringBox as u32,
_ => return Err(format!("Unknown plugin box type: {}", box_name)),
};
// とりあえずダミーハンドルで作成(実際は"new"メソッド呼び出し結果を使用)
let handle = BidHandle::new(type_id, 1); // TODO: 実際のinstance_id取得
// PluginBoxプロキシを作成
Ok(Box::new(PluginBox::new(plugin_name.to_string(), handle)))
// TODO: v2プラグインシステムへの実装
// 現在は一時的にエラーを返す
Err(format!("Plugin system v2 migration in progress. Cannot create {} from plugin {}", box_name, plugin_name))
}
}

View File

@ -4,14 +4,14 @@
pub mod plugin_config;
pub mod box_registry;
pub mod plugin_box;
pub mod plugin_loader;
// pub mod plugin_box; // legacy - 古いPluginBox
// pub mod plugin_loader; // legacy - Host VTable使用
#[cfg(test)]
mod tests;
pub use plugin_config::PluginConfig;
pub use box_registry::{BoxFactoryRegistry, BoxProvider, get_global_registry};
pub use plugin_box::PluginBox;
// pub use plugin_box::PluginBox; // legacy
// Use unified plugin loader (formerly v2)
pub use plugin_loader::{PluginLoaderV2 as PluginLoader, get_global_loader_v2 as get_global_loader};
// pub use plugin_loader::{PluginLoaderV2 as PluginLoader, get_global_loader_v2 as get_global_loader}; // legacy