diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-11 14:20:49 +0200 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-06-11 14:20:49 +0200 |
| commit | 199563550dd41c3dfb703bd3747604a8a03cdbc5 (patch) | |
| tree | 30cfa3e5539f782b7571091c742ee1c219e138fb /crates/turtle/src/command/client/daemon.rs | |
| parent | chore: Restore db migrations (diff) | |
| download | atuin-199563550dd41c3dfb703bd3747604a8a03cdbc5.zip | |
chore: Remove all `pub`s
They will not be marked by rustc/cargo as unused, and as atuin doesn't
expose an API all of them _should_ be `pub(crate)`
Diffstat (limited to 'crates/turtle/src/command/client/daemon.rs')
| -rw-r--r-- | crates/turtle/src/command/client/daemon.rs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/turtle/src/command/client/daemon.rs b/crates/turtle/src/command/client/daemon.rs index 2ee9b759..2fb090aa 100644 --- a/crates/turtle/src/command/client/daemon.rs +++ b/crates/turtle/src/command/client/daemon.rs @@ -21,7 +21,7 @@ use fs4::fs_std::FileExt; use tokio::time::sleep; #[derive(clap::Args, Debug)] -pub struct Cmd { +pub(crate) struct Cmd { /// Internal flag for daemonization #[arg(long, hide = true)] daemonize: bool, @@ -36,7 +36,7 @@ pub struct Cmd { #[derive(Subcommand, Debug)] #[command(infer_subcommands = true)] -pub enum SubCmd { +pub(crate) enum SubCmd { /// Start the daemon server Start { #[arg(long, hide = true)] @@ -65,7 +65,7 @@ impl Cmd { /// Returns `true` when the process should daemonize before creating the /// async runtime or opening any database connections. #[cfg(unix)] - pub fn should_daemonize(&self) -> bool { + pub(crate) fn should_daemonize(&self) -> bool { match &self.subcmd { Some(SubCmd::Start { daemonize, .. }) => *daemonize, None => self.daemonize, @@ -74,7 +74,7 @@ impl Cmd { } /// Returns `true` when logs should also be written to the console. - pub fn show_logs(&self) -> bool { + pub(crate) fn show_logs(&self) -> bool { match &self.subcmd { Some(SubCmd::Start { show_logs, .. }) => *show_logs, None => self.show_logs, @@ -82,7 +82,7 @@ impl Cmd { } } - pub async fn run( + pub(crate) async fn run( self, settings: Settings, store: SqliteStore, @@ -350,7 +350,7 @@ fn ensure_autostart_supported(settings: &Settings) -> Result<()> { /// process and wait for it to become ready. /// /// Returns an error if the daemon could not be started. -pub async fn ensure_daemon_running(settings: &Settings) -> Result<()> { +pub(crate) async fn ensure_daemon_running(settings: &Settings) -> Result<()> { ensure_autostart_supported(settings)?; let timeout = startup_timeout(settings); @@ -404,7 +404,7 @@ fn ensure_reply_compatible(settings: &Settings, version: &str, protocol: u32) -> bail!("{message}. Enable `daemon.autostart = true` or restart the daemon manually"); } -pub async fn start_history(settings: &Settings, history: History) -> Result<String> { +pub(crate) async fn start_history(settings: &Settings, history: History) -> Result<String> { match async { connect_client(settings) .await? @@ -438,7 +438,7 @@ pub async fn start_history(settings: &Settings, history: History) -> Result<Stri Ok(resp.id) } -pub async fn end_history(settings: &Settings, id: String, duration: u64, exit: i64) -> Result<()> { +pub(crate) async fn end_history(settings: &Settings, id: String, duration: u64, exit: i64) -> Result<()> { match async { connect_client(settings) .await? @@ -482,7 +482,7 @@ pub async fn end_history(settings: &Settings, id: String, duration: u64, exit: i /// If the daemon is not reachable and `daemon.autostart` is enabled, this /// will start the daemon and retry the event. If the daemon cannot be /// started or the retry fails, a warning is printed to stderr. -pub async fn emit_event(settings: &Settings, event: DaemonEvent) { +pub(crate) async fn emit_event(settings: &Settings, event: DaemonEvent) { // Try to connect and send match ControlClient::from_settings(settings).await { Ok(mut client) => { @@ -516,7 +516,7 @@ pub async fn emit_event(settings: &Settings, event: DaemonEvent) { } } -pub async fn tail_client(settings: &Settings) -> Result<HistoryClient> { +pub(crate) async fn tail_client(settings: &Settings) -> Result<HistoryClient> { match probe(settings).await { Probe::Ready(client) => return Ok(client), Probe::NeedsRestart(reason) if !settings.daemon.autostart => { @@ -619,7 +619,7 @@ async fn restart_cmd(settings: &Settings) -> Result<()> { /// runtime or opening database connections, since `fork()` inside an async /// runtime corrupts its internal state. #[cfg(unix)] -pub fn daemonize_current_process() -> Result<()> { +pub(crate) fn daemonize_current_process() -> Result<()> { let cwd = std::env::current_dir().wrap_err("could not determine current directory for daemon")?; |
