#[path = "benchmark_protocol.rs"]
mod protocol;
use std::io::{Read, Write};
use std::num::NonZeroUsize;
fn main() {
let executor = tokio::runtime::Builder::new_multi_thread().worker_threads(4).enable_all().build().unwrap();
executor.block_on(async {
let preparation_bytes = NonZeroUsize::new(64 * 1024 * 1024).unwrap();
let settings = harmos_runtime::operations::Settings {
queued: NonZeroUsize::new(64).unwrap(),
lifecycle_queued: NonZeroUsize::new(16).unwrap(),
preparation_bytes: Some(preparation_bytes),
};
let runtime = harmos_runtime::Runtime::<protocol::Model>::builder((), ())
.register(protocol::Lanes::catalog())
.operation_settings(settings)
.runtime()
.await
.unwrap();
runtime
.operations
.register(harmos_runtime::RegistrationExt::lane(
harmos_runtime::RegistrationBatch::new(harmos_runtime::Dependencies::new()).operation::<protocol::EchoDeclaration>(),
protocol::Lanes::Open,
))
.await
.unwrap();
let attached = runtime.grpc().attach(protocol::settings()).await.unwrap();
println!("{}", attached.local_addr());
std::io::stdout().flush().unwrap();
tokio::task::spawn_blocking(|| {
let mut bytes = [0_u8; 1];
while std::io::stdin().read(&mut bytes).unwrap() != 0 {}
})
.await
.unwrap();
drop(attached);
runtime.stop().await.unwrap();
});
}