···11+#[allow(clippy::all)]
22+pub mod index {
33+ tonic::include_proto!("parakeet");
44+}
55+66+pub use index::*;
77+pub type Client = index_client::IndexClient<tonic::transport::Channel>;
88+99+#[cfg(feature = "server")]
1010+pub mod server;
+24
parakeet-index/src/main.rs
···11+use parakeet_index::index_server::IndexServer;
22+use parakeet_index::server::service::Service;
33+use parakeet_index::server::{GlobalState, config};
44+use std::sync::Arc;
55+use tonic::transport::Server;
66+77+#[tokio::main]
88+async fn main() -> eyre::Result<()> {
99+ tracing_subscriber::fmt::init();
1010+1111+ let conf = config::load_config()?;
1212+1313+ let db_root = conf.index_db_path.parse()?;
1414+ let addr = std::net::SocketAddr::new(conf.server.bind_address.parse()?, conf.server.port);
1515+ let state = Arc::new(GlobalState::new(db_root)?);
1616+1717+ let service = Service::new(state.clone());
1818+ Server::builder()
1919+ .add_service(IndexServer::new(service))
2020+ .serve(addr)
2121+ .await?;
2222+2323+ Ok(())
2424+}