Skip to main content

DaemonConfig

Struct DaemonConfig 

Source
pub struct DaemonConfig {
Show 22 fields pub memory_limit_mb: u64, pub idle_timeout_minutes: u64, pub debounce_ms: u64, pub incremental_threshold: usize, pub closure_limit_percent: u32, pub stale_serve_max_age_hours: u32, pub rebuild_drain_timeout_ms: u64, pub ipc_shutdown_drain_secs: u64, pub tool_timeout_secs: u64, pub max_shim_connections: usize, pub interner_compaction_threshold: f32, pub log_file: LogFileSetting, pub log_level: String, pub log_max_size_mb: u64, pub socket: SocketConfig, pub workspaces: Vec<WorkspaceConfig>, pub auto_start_ready_timeout_secs: u64, pub log_keep_rotations: u32, pub install_user_service: bool, pub cost_gate_node_limit: Option<usize>, pub cost_gate_min_prefix: Option<usize>, pub cost_gate_min_literal: Option<usize>,
}
Expand description

Top-level daemon configuration.

Loaded from ~/.config/sqry/daemon.toml by default. Env-var overrides (see the ENV_* constants) are layered on top by DaemonConfig::load.

Fields§

§memory_limit_mb: u64

Hard cap on total resident graph memory across every loaded workspace.

§idle_timeout_minutes: u64

Workspace idle-timeout before it becomes eligible for LRU eviction.

§debounce_ms: u64

Filesystem-watcher debounce window (ms) for coalescing bursts of changes.

§incremental_threshold: usize

If > incremental_threshold files changed in one window, full-rebuild instead of incremental-rebuild.

§closure_limit_percent: u32

If the reverse-dep closure covers > closure_limit_percent% of the graph’s files, full-rebuild instead of incremental-rebuild.

§stale_serve_max_age_hours: u32

Cap on how long a Failed workspace may keep serving its last-good snapshot as stale: true. 0 disables the cap (serve indefinitely).

§rebuild_drain_timeout_ms: u64

Retention-reaper WARN threshold, not an accounting deadline. Retained bytes are released when Arc::strong_count drops to 1 — regardless of wall-clock time.

§ipc_shutdown_drain_secs: u64

Grace window (seconds) for the IPC accept loop to drain active connections during shutdown. Task 8 Phase 8a.

§tool_timeout_secs: u64

Per-tool invocation timeout. Bounds the response latency of any single tool call; exceeding this returns DaemonError::ToolTimeout (JSON-RPC -32000 / MCP internal_error with kind = "deadline_exceeded").

Important contract: this bounds RESPONSE LATENCY, not the detached OS-thread lifetime. When the timeout fires, the tokio::task::spawn_blocking tokio::task::JoinHandle is dropped; the OS thread running the tool closure continues until the closure itself returns. A buggy/runaway tool closure can keep its thread alive past daemon/stop. Default 60 seconds. Task 8 Phase 8c U6.

§max_shim_connections: usize

Cap on the number of concurrently-registered shim byte-pump connections. Every accepted ShimRegister frame must pass crate::ipc::shim_registry::ShimRegistry::try_register_bounded against this cap under a single mutex-guard — over-cap admissions reply ShimRegisterAck { accepted: false, reason: "shim registry full (N / cap)" } and the connection closes. Default 256. Task 8 Phase 8c U10.

§interner_compaction_threshold: f32

Interner housekeeping: if the live-ratio drops below this, the next debounce tick schedules a mandatory full rebuild.

§log_file: LogFileSetting

Structured-log file destination (cluster-G §5.3).

Defaults to LogFileSetting::Path(<runtime_dir>/sqryd.log) so a fresh install logs to a tailable file under $XDG_RUNTIME_DIR/sqry/sqryd.log (Linux/macOS) or %LOCALAPPDATA%\sqry\sqryd.log (Windows). Operators opt out of file logging by setting log_file = "stderr" or log_file = "-" in TOML, or SQRY_DAEMON_LOG_FILE=- in the environment — both produce LogFileSetting::Special and disable the rolling appender so the daemon writes only to stderr.

§log_level: String

Log verbosity (matches tracing_subscriber::EnvFilter syntax).

§log_max_size_mb: u64

Log-rotation trigger.

§socket: SocketConfig

IPC listener binding (UDS on Unix, named pipe on Windows).

§workspaces: Vec<WorkspaceConfig>

Pre-declared workspaces — pinned workspaces load at daemon startup.

§auto_start_ready_timeout_secs: u64

Timeout (seconds) used in two places:

  1. --detach parent wait loop (run_start_detach): how long the launching parent process waits for the grandchild to signal ready via the self-pipe before giving up and killing the grandchild.
  2. lifecycle::start_detached (Task 10 auto-spawn): how long the client helper polls the daemon socket before returning DaemonError::AutoStartTimeout.

Valid range (enforced by DaemonConfig::validate): 1..=60.

§log_keep_rotations: u32

Number of rotated log archives to keep alongside the live log file.

When RollingSizeAppender rotates, it shifts existing .1.N files one position and deletes any file beyond this limit. A value of 5 means .1.5 are retained; .6 and beyond are removed.

Valid range (enforced by DaemonConfig::validate): 1..=100.

§install_user_service: bool

Reserved for future use — will drive automated systemd user-service installation on first sqryd start when set to true. Currently a no-op; stored in config to avoid breaking changes when the feature lands. Defaults to false.

§cost_gate_node_limit: Option<usize>

Pre-flight cost-gate arena-size cap (per B_cost_gate.md §1.4 + 00_contracts.md §3.CC-3). When Some(n), prohibitive query shapes (unanchored regex with no scope coupling) are rejected once the snapshot’s node count exceeds n. When None (or Some(0)), the cap is disabled and all shapes are allowed regardless of arena size — the gate degenerates to a shape-only check. Default DEFAULT_COST_GATE_NODE_LIMIT (50_000).

§cost_gate_min_prefix: Option<usize>

Pre-flight cost-gate minimum literal-prefix length. When Some(n), an anchored regex passes the gate iff its longest required literal prefix has length ≥ n. Default DEFAULT_COST_GATE_MIN_PREFIX (3).

§cost_gate_min_literal: Option<usize>

Pre-flight cost-gate minimum Hir::minimum_len. When Some(n), a regex with no usable prefix passes the gate iff its Hir::properties().minimum_len() is ≥ n. Default DEFAULT_COST_GATE_MIN_LITERAL (4).

Implementations§

Source§

impl DaemonConfig

Source

pub fn load() -> DaemonResult<Self>

Load the effective config: start from defaults, apply the TOML file at the canonical path (or the one named by ENV_CONFIG_PATH), then layer environment-variable overrides.

A missing config file is not an error — the defaults plus env-var overrides are returned. A malformed file is always an error.

Source

pub fn load_from_path(path: &Path) -> DaemonResult<Self>

Load a config file from an explicit path, ignoring env overrides. Useful for tests and documentation examples.

Source

pub fn from_toml_str(text: &str) -> Result<Self>

Parse a TOML string into a DaemonConfig. Defaults fill any missing fields.

Source

pub fn apply_env_overrides(&mut self) -> DaemonResult<()>

Apply SQRY_DAEMON_* environment-variable overrides. See the ENV_* constants for the full list.

Source

pub fn validate(&self) -> DaemonResult<()>

Sanity-check invariants that admission accounting and the rebuild dispatcher depend on.

Source

pub fn resolve_config_path() -> DaemonResult<PathBuf>

Resolve the config-file path, respecting ENV_CONFIG_PATH.

Falls back to $XDG_CONFIG_HOME/sqry/daemon.toml, then $HOME/.config/sqry/daemon.toml.

Source

pub fn socket_path(&self) -> PathBuf

Path the IPC server binds to.

  • Unix: explicit socket.path, else $XDG_RUNTIME_DIR/sqry/sqryd.sock, else $TMPDIR/sqry-<uid>/sqryd.sock.
  • Windows: \\\\.\\pipe\\<socket.pipe_name> (default sqry).
Source

pub fn pid_path(&self) -> PathBuf

Where to write the daemon pidfile. One per user.

Source

pub fn lock_path(&self) -> PathBuf

Flock target — held exclusively by the running daemon, and briefly by clients during auto-start to avoid racing two sqry processes.

Source

pub fn runtime_dir(&self) -> PathBuf

Platform-specific per-user runtime directory where the socket, pidfile, and lockfile live.

This is the public accessor for the private [runtime_dir] free function. The return value is the same as socket_path().parent() when the socket path uses the default (not the explicit socket.path override).

Source

pub const fn memory_limit_bytes(&self) -> u64

Memory budget in bytes, derived from Self::memory_limit_mb.

Trait Implementations§

Source§

impl Clone for DaemonConfig

Source§

fn clone(&self) -> DaemonConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DaemonConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DaemonConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for DaemonConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for DaemonConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<D> OwoColorize for D

Source§

fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>
where C: Color,

Set the foreground color generically Read more
Source§

fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>
where C: Color,

Set the background color generically. Read more
Source§

fn black(&self) -> FgColorDisplay<'_, Black, Self>

Change the foreground color to black
Source§

fn on_black(&self) -> BgColorDisplay<'_, Black, Self>

Change the background color to black
Source§

fn red(&self) -> FgColorDisplay<'_, Red, Self>

Change the foreground color to red
Source§

fn on_red(&self) -> BgColorDisplay<'_, Red, Self>

Change the background color to red
Source§

fn green(&self) -> FgColorDisplay<'_, Green, Self>

Change the foreground color to green
Source§

fn on_green(&self) -> BgColorDisplay<'_, Green, Self>

Change the background color to green
Source§

fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>

Change the foreground color to yellow
Source§

fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>

Change the background color to yellow
Source§

fn blue(&self) -> FgColorDisplay<'_, Blue, Self>

Change the foreground color to blue
Source§

fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>

Change the background color to blue
Source§

fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to magenta
Source§

fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to magenta
Source§

fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>

Change the foreground color to purple
Source§

fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>

Change the background color to purple
Source§

fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>

Change the foreground color to cyan
Source§

fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>

Change the background color to cyan
Source§

fn white(&self) -> FgColorDisplay<'_, White, Self>

Change the foreground color to white
Source§

fn on_white(&self) -> BgColorDisplay<'_, White, Self>

Change the background color to white
Source§

fn default_color(&self) -> FgColorDisplay<'_, Default, Self>

Change the foreground color to the terminal default
Source§

fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>

Change the background color to the terminal default
Source§

fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>

Change the foreground color to bright black
Source§

fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>

Change the background color to bright black
Source§

fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>

Change the foreground color to bright red
Source§

fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>

Change the background color to bright red
Source§

fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>

Change the foreground color to bright green
Source§

fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>

Change the background color to bright green
Source§

fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>

Change the foreground color to bright yellow
Source§

fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>

Change the background color to bright yellow
Source§

fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>

Change the foreground color to bright blue
Source§

fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>

Change the background color to bright blue
Source§

fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright magenta
Source§

fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright magenta
Source§

fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>

Change the foreground color to bright purple
Source§

fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>

Change the background color to bright purple
Source§

fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>

Change the foreground color to bright cyan
Source§

fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>

Change the background color to bright cyan
Source§

fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>

Change the foreground color to bright white
Source§

fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>

Change the background color to bright white
Source§

fn bold(&self) -> BoldDisplay<'_, Self>

Make the text bold
Source§

fn dimmed(&self) -> DimDisplay<'_, Self>

Make the text dim
Source§

fn italic(&self) -> ItalicDisplay<'_, Self>

Make the text italicized
Source§

fn underline(&self) -> UnderlineDisplay<'_, Self>

Make the text underlined
Make the text blink
Make the text blink (but fast!)
Source§

fn reversed(&self) -> ReversedDisplay<'_, Self>

Swap the foreground and background colors
Source§

fn hidden(&self) -> HiddenDisplay<'_, Self>

Hide the text
Source§

fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>

Cross out the text
Source§

fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more
Source§

fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>
where Color: DynColor,

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more
Source§

fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the foreground color to a specific RGB value.
Source§

fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>

Set the background color to a specific RGB value.
Source§

fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>

Sets the foreground color to an RGB value.
Source§

fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>

Sets the background color to an RGB value.
Source§

fn style(&self, style: Style) -> Styled<&Self>

Apply a runtime-determined style
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,