Skip to main content

DaemonClient

Trait DaemonClient 

Source
pub trait DaemonClient: Send + Sync {
    // Required methods
    fn is_available(&self) -> bool;
    fn query_call_graph(&self) -> Option<ProjectCallGraph>;
    fn query_cfg(&self, function_id: &FunctionId) -> Option<CfgInfo>;
    fn query_dfg(&self, function_id: &FunctionId) -> Option<DfgInfo>;
    fn query_ssa(&self, function_id: &FunctionId) -> Option<SsaFunction>;
    fn notify_changed_files(&self, changed_files: &[PathBuf]);
}
Expand description

Trait for communicating with the tldr-daemon process.

Provides query methods for IR artifacts that the daemon may have cached from prior analysis runs. All methods return Option<T>None means the daemon does not have the artifact cached (or no daemon is running), and the caller should compute it locally.

Implementations must be Send + Sync so they can be stored in L2Context (which is shared across threads via Arc or moved to a background thread).

Required Methods§

Source

fn is_available(&self) -> bool

Check whether a daemon is currently running and reachable.

Returns true if the daemon is available for queries, false otherwise. This is a lightweight check (e.g., socket existence) that does not perform a full handshake.

Source

fn query_call_graph(&self) -> Option<ProjectCallGraph>

Query the daemon for a cached project call graph.

Returns Some(graph) if the daemon has a cached call graph for the project, None if unavailable or the daemon is not running.

Source

fn query_cfg(&self, function_id: &FunctionId) -> Option<CfgInfo>

Query the daemon for a cached CFG for a specific function.

Returns Some(cfg) if the daemon has a cached CFG for the given function, None if unavailable.

Source

fn query_dfg(&self, function_id: &FunctionId) -> Option<DfgInfo>

Query the daemon for a cached DFG for a specific function.

Returns Some(dfg) if the daemon has a cached DFG for the given function, None if unavailable.

Source

fn query_ssa(&self, function_id: &FunctionId) -> Option<SsaFunction>

Query the daemon for cached SSA for a specific function.

Returns Some(ssa) if the daemon has cached SSA for the given function, None if unavailable.

Source

fn notify_changed_files(&self, changed_files: &[PathBuf])

Notify the daemon that files have changed, triggering cache invalidation.

The daemon will invalidate any cached artifacts whose file dependencies overlap with the provided changed_files. This should be called before any queries are made for the current analysis session.

Implementors§