Skip to main content

Crate cyrs_db

Crate cyrs_db 

Source
Expand description

cyrs-db — incremental analysis database (spec 0001 §11).

This crate builds on the Salsa skeleton from cy-zx6 and adds the complete input-query surface from spec §11.2 (cy-nk7), plus the FileId model, snapshot API, and workspace-scoped SchemaProvider wiring from spec §11.4–§11.5 (cy-amr).

§Primary API (spec §11.4–§11.5)

See workspace for the high-level Database + FileId + snapshot API intended for consumers (cyrs-lsp, cyrs-agent, cyrs-cli, cyrs-tck).

§Salsa internals (low-level, for crate authors)

§Input query surface (spec §11.2)

QuerySalsa kindScope
source_text(file) -> &str#[input] fieldper-file
dialect(file) -> DialectMode#[input] fieldper-file
options(file) -> AnalysisOptions#[input] fieldper-file
options_digest(file) -> u64#[tracked]per-file
schema() -> Option<Arc<dyn …>>#[input] fieldworkspace

§Legacy facade API (preserved for backward compat)

The legacy LegacyDatabase / legacy FileId (u32 newtype) remain exported under their old names for backward compatibility while binary crates migrate to the new workspace::Database API.

§Send + Sync / snapshot semantics (spec §11.5)

CypherDatabase is Clone. Cloning shares the Arc<Zalsa> backing store and creates a fresh ZalsaLocal, producing a snapshot. The clone can be sent to another thread for concurrent read queries (Send). Writes require &mut self and block until all clones are dropped.

Re-exports§

pub use inputs::AnalysisOptions;
pub use inputs::FileOptions;
pub use inputs::WorkspaceInputs;
pub use inputs::options_digest;
pub use options::DatabaseOptions;
pub use queries::Analysis;
pub use queries::AstOutput;
pub use queries::DiagnosticsOutput;
pub use queries::PlanOutput;
pub use queries::ResolvedNamesOutput;
pub use queries::all_diagnostics;
pub use queries::analyse_file;
pub use queries::parse_ast;
pub use queries::plan_of;
pub use queries::resolved_names;
pub use queries::sema_diagnostics;
pub use workspace::Database;
pub use workspace::DatabaseSnapshot;
pub use workspace::FileId;
pub use workspace::UnknownFileId;

Modules§

inputs
Input queries for the incremental analysis database (spec §11.2).
options
Per-query LRU capacity options for the incremental database (spec §11.X).
queries
Derived Salsa query chain (spec 0001 §11.3).
workspace
Workspace-level Database API — FileId model, snapshot semantics, and the SchemaProvider wiring (spec 0001 §11.4, §11.5).

Structs§

CypherDatabase
The concrete incremental database (Salsa 2022-style, spec §11.1).
LegacyDatabase
Legacy analysis database (non-incremental). Preserved for backward compatibility while binary crates migrate to workspace::Database.
LegacyFileId
File identity within the legacy LegacyDatabase.
ParseOutput
Memoised result of parsing a SourceFile.
SourceFile
A single source file tracked by the incremental database.

Enums§

DialectMode
Dialect mode selected at parse time. Spec §9.

Traits§

CypherDb
Trait that all concrete databases in this workspace implement.

Functions§

parse_cst
Parse a SourceFile into a lossless CST.
set_parse_cst_lru
Adjust the LRU capacity of parse_cst at runtime.