1
0
mirror of https://github.com/aziascreations/BakaShrot.git synced 2026-11-23 20:58:46 +01:00

Moved the PureBasic version to OldSource/, Started the Rust rewrite in Source/

The rewrite's plan and decisions are in revamp.md. Steps 0 to 10 are done:
the workspace and checks, bakashrot-proto, bakashrot-pki and
bakashrot-cert, bakashrot-config, bakashrot-storage (schema v9), the
server and the client library (every request but replication's,
attachments and retention included), the C DLL with its C, PureBasic and
Python bindings, and the bakashrot tool. Step 11 (replication) is next.

OldSource/ is the old implementation, kept building and passing as the
reference.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RwFeVTGs2SsufaH6zquzcb
This commit is contained in:
2026-11-14 12:47:40 +01:00
parent d0048b17c8
commit e044fcf359
225 changed files with 21849 additions and 123 deletions
@@ -0,0 +1,40 @@
//! `bakashrot-server <config.toml>`: runs a server until Ctrl+C.
use bakashrot_config::Config;
use bakashrot_server::Server;
use std::path::PathBuf;
use std::process::ExitCode;
use tokio::net::TcpListener;
use tracing::{error, info};
#[tokio::main]
async fn main() -> ExitCode {
tracing_subscriber::fmt().with_target(false).init();
let Some(path) = std::env::args_os().nth(1).map(PathBuf::from) else {
eprintln!("usage: bakashrot-server <config.toml>");
return ExitCode::from(2);
};
match run(&path).await {
Ok(()) => ExitCode::SUCCESS,
Err(why) => {
error!("{why}");
ExitCode::FAILURE
}
}
}
async fn run(path: &std::path::Path) -> Result<(), String> {
let config = Config::load(path).map_err(|error| error.to_string())?;
let server = Server::start(config)?;
let listener = TcpListener::bind(server.listen())
.await
.map_err(|error| format!("listening on {}: {error}", server.listen()))?;
info!("{} listening on {}", server.name(), server.listen());
tokio::select! {
served = server.serve(listener) => served.map_err(|error| format!("accepting: {error}"))?,
_ = server.watch_revocations() => {}
_ = server.apply_retention() => {}
_ = tokio::signal::ctrl_c() => info!("stopping"),
}
Ok(())
}