sausage core: modules per topic, journal writer thread with WAL and batches, hash cache by metadata, 49 tests per rule

Blank stdout lines give no warning. core.exit requests the exit in its
own handler.
This commit is contained in:
2026-10-23 00:32:33 +01:00
parent 218a718a3d
commit 8542b9fcb8
17 changed files with 2016 additions and 814 deletions
+5 -15
View File
@@ -4,7 +4,6 @@ use clap::{Parser, Subcommand};
use sausage::{Host, world::World};
use serde_json::json;
use std::{io::Write, path::PathBuf};
use tokio::io::{AsyncBufReadExt, BufReader};
#[derive(Parser)]
#[command(version)]
struct Cli {
@@ -71,24 +70,15 @@ async fn main() -> Result<()> {
println!("{notification}");
}
});
let h = host.clone();
let console = async move {
let mut lines = BufReader::new(tokio::io::stdin()).lines();
loop {
tokio::select! {
line=lines.next_line()=>{let Some(line)=line? else {break;};if line=="quit" {break;}
let (method,params)=line.split_once(' ').unwrap_or((&line,"{}"));
match serde_json::from_str(params) {Ok(p)=>println!("{}",match h.call(method,p).await {Ok(v)=>v,Err(e)=>e}),Err(e)=>eprintln!("{e}")}
}
}
}
Ok::<_, anyhow::Error>(())
};
let console = sausage::console::run_input(host.clone());
let exit = tokio::select! {
_=host.exit_requested()=>true,
_=term.recv()=>false,
_=tokio::signal::ctrl_c()=>false,
r=console,if !cli.headless=>{r?;false},
result = console, if !cli.headless => {
result?;
false
},
};
let exit = exit || host.restart_requested();
host.stop().await;