···1+#[allow(clippy::all)]
2+pub mod index {
3+ tonic::include_proto!("parakeet");
4+}
5+6+pub use index::*;
7+pub type Client = index_client::IndexClient<tonic::transport::Channel>;
8+9+#[cfg(feature = "server")]
10+pub mod server;
+24
parakeet-index/src/main.rs
···000000000000000000000000
···1+use parakeet_index::index_server::IndexServer;
2+use parakeet_index::server::service::Service;
3+use parakeet_index::server::{GlobalState, config};
4+use std::sync::Arc;
5+use tonic::transport::Server;
6+7+#[tokio::main]
8+async fn main() -> eyre::Result<()> {
9+ tracing_subscriber::fmt::init();
10+11+ let conf = config::load_config()?;
12+13+ let db_root = conf.index_db_path.parse()?;
14+ let addr = std::net::SocketAddr::new(conf.server.bind_address.parse()?, conf.server.port);
15+ let state = Arc::new(GlobalState::new(db_root)?);
16+17+ let service = Service::new(state.clone());
18+ Server::builder()
19+ .add_service(IndexServer::new(service))
20+ .serve(addr)
21+ .await?;
22+23+ Ok(())
24+}