Browse Source

feat(rust-volume-server): add native mode bootstrap entrypoint

codex-rust-volume-server-bootstrap
Chris Lu 4 weeks ago
parent
commit
70ddbee370
  1. 14
      rust/volume_server/src/main.rs

14
rust/volume_server/src/main.rs

@ -83,8 +83,9 @@ fn run() -> Result<(), String> {
match mode.as_str() {
"exec" => run_exec_mode(&forwarded),
"proxy" => run_proxy_mode(&forwarded),
"native" => run_native_mode(&forwarded),
other => Err(format!(
"unsupported VOLUME_SERVER_RUST_MODE {:?} (supported: exec, proxy)",
"unsupported VOLUME_SERVER_RUST_MODE {:?} (supported: exec, proxy, native)",
other
)),
}
@ -189,6 +190,13 @@ fn run_proxy_mode(forwarded: &[String]) -> Result<(), String> {
}
}
fn run_native_mode(forwarded: &[String]) -> Result<(), String> {
eprintln!(
"weed-volume-rs: native mode bootstrap active; delegating to Go backend while Rust handlers are implemented"
);
run_proxy_mode(forwarded)
}
fn spawn_backend(weed_binary: &PathBuf, backend_args: &[String]) -> Result<Child, String> {
Command::new(weed_binary)
.args(backend_args)
@ -416,14 +424,16 @@ fn print_help() {
println!("Modes:");
println!(" - exec (default): exec Go weed volume process directly");
println!(" - proxy: run Rust TCP proxy front-end and supervise Go weed backend");
println!(" - native: bootstrap native mode entrypoint (currently supervises/proxies Go backend)");
println!();
println!("Environment:");
println!(" VOLUME_SERVER_RUST_MODE=exec|proxy");
println!(" VOLUME_SERVER_RUST_MODE=exec|proxy|native");
println!(" WEED_BINARY=/path/to/weed");
println!();
println!("Examples:");
println!(" weed-volume-rs -config_dir=/tmp/cfg volume -ip=127.0.0.1 -port=8080 ...");
println!(" VOLUME_SERVER_RUST_MODE=proxy weed-volume-rs -config_dir=/tmp/cfg volume -ip=127.0.0.1 -port=8080 ...");
println!(" VOLUME_SERVER_RUST_MODE=native weed-volume-rs -config_dir=/tmp/cfg volume -ip=127.0.0.1 -port=8080 ...");
}
fn resolve_weed_binary() -> Result<PathBuf, String> {

Loading…
Cancel
Save