mirror of
https://github.com/ruvnet/RuView
synced 2026-08-11 20:41:44 +00:00
Squashed 'vendor/ruvector/' content from commit b64c2172
git-subtree-dir: vendor/ruvector git-subtree-split: b64c21726f2bb37286d9ee36a7869fef60cc6900
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
//! `rvf serve` -- Start HTTP/TCP server for an RVF store.
|
||||
|
||||
use clap::Args;
|
||||
|
||||
#[derive(Args)]
|
||||
pub struct ServeArgs {
|
||||
/// Path to the RVF store
|
||||
pub path: String,
|
||||
/// HTTP server port
|
||||
#[arg(short, long, default_value = "8080")]
|
||||
pub port: u16,
|
||||
/// TCP streaming port (defaults to HTTP port + 1000)
|
||||
#[arg(long)]
|
||||
pub tcp_port: Option<u16>,
|
||||
}
|
||||
|
||||
pub fn run(args: ServeArgs) -> Result<(), Box<dyn std::error::Error>> {
|
||||
#[cfg(feature = "serve")]
|
||||
{
|
||||
let rt = tokio::runtime::Runtime::new()?;
|
||||
rt.block_on(async {
|
||||
let config = rvf_server::ServerConfig {
|
||||
http_port: args.port,
|
||||
tcp_port: args.tcp_port.unwrap_or(args.port + 1000),
|
||||
data_path: std::path::PathBuf::from(&args.path),
|
||||
dimension: 0, // auto-detect from file
|
||||
};
|
||||
rvf_server::run(config).await
|
||||
})
|
||||
}
|
||||
#[cfg(not(feature = "serve"))]
|
||||
{
|
||||
let _ = args;
|
||||
eprintln!(
|
||||
"The 'serve' feature is not enabled. Rebuild with: cargo build -p rvf-cli --features serve"
|
||||
);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user