pub struct CypherDatabase { /* private fields */ }Expand description
The concrete incremental database (Salsa 2022-style, spec §11.1).
§Send + Sync via snapshots (spec §11.5)
CypherDatabase is Send but not Sync — ZalsaLocal contains
per-thread UnsafeCell state by design. Thread-safety is achieved via
snapshots: clone() shares the Arc<Zalsa> backing store and produces a
fresh ZalsaLocal, allowing the clone to be sent to another thread and
queried concurrently. The LSP server clones once per request; the CLI
never needs to.
Implementations§
Source§impl CypherDatabase
impl CypherDatabase
Sourcepub fn new() -> CypherDatabase
pub fn new() -> CypherDatabase
Construct a new, empty database.
Sourcepub fn new_source_file(&mut self, source: impl Into<String>) -> SourceFile
pub fn new_source_file(&mut self, source: impl Into<String>) -> SourceFile
Create a new SourceFile input with the given source text,
using the default dialect and a zero options digest.
Sourcepub fn new_source_file_with(
&mut self,
source: impl Into<String>,
dialect: DialectMode,
options_digest: u64,
) -> SourceFile
pub fn new_source_file_with( &mut self, source: impl Into<String>, dialect: DialectMode, options_digest: u64, ) -> SourceFile
Create a new SourceFile input with explicit dialect and digest.
Sourcepub fn set_source(&mut self, file: SourceFile, source: impl Into<String>)
pub fn set_source(&mut self, file: SourceFile, source: impl Into<String>)
Update the source text of an existing SourceFile, bumping the
Salsa revision so that derived queries are invalidated.
Always clears any cy-li6 precomputed_parse
hint, because a fresh source string must produce a fresh parse —
reusing a stale hint would silently desync the published CST from
source.
Sourcepub fn set_source_with_parse(
&mut self,
file: SourceFile,
source: impl Into<String>,
parse: ParseOutput,
)
pub fn set_source_with_parse( &mut self, file: SourceFile, source: impl Into<String>, parse: ParseOutput, )
Atomically replace source and publish a precomputed Parse
(cy-li6).
Used by workspace::Database::edit_file after
cyrs_syntax::incremental_reparse has produced a spliced tree
for new_source. Bumps the Salsa revision once for both fields,
so the next parse_cst query returns parse directly without
re-parsing.
Sourcepub fn set_dialect(&mut self, file: SourceFile, dialect: DialectMode)
pub fn set_dialect(&mut self, file: SourceFile, dialect: DialectMode)
Update the dialect of an existing SourceFile.
Sourcepub fn new_file_options(&mut self, options: AnalysisOptions) -> FileOptions
pub fn new_file_options(&mut self, options: AnalysisOptions) -> FileOptions
Create a new FileOptions input with the given AnalysisOptions.
Sourcepub fn set_options(&mut self, file_opts: FileOptions, options: AnalysisOptions)
pub fn set_options(&mut self, file_opts: FileOptions, options: AnalysisOptions)
Update the AnalysisOptions of an existing FileOptions input.
Bumps the Salsa revision for file_opts, which cascades through
options_digest and all derived queries that read it.
Sourcepub fn new_workspace_inputs(
&mut self,
schema: Option<Arc<dyn SchemaProvider>>,
) -> WorkspaceInputs
pub fn new_workspace_inputs( &mut self, schema: Option<Arc<dyn SchemaProvider>>, ) -> WorkspaceInputs
Create a new WorkspaceInputs input.
There should be exactly one WorkspaceInputs per database.
Call this once at database initialisation; update it with
set_schema.
Sourcepub fn set_schema(
&mut self,
ws: WorkspaceInputs,
schema: Option<Arc<dyn SchemaProvider>>,
)
pub fn set_schema( &mut self, ws: WorkspaceInputs, schema: Option<Arc<dyn SchemaProvider>>, )
Update the workspace-scoped schema.
Invalidates all derived queries that depend on the schema.
Trait Implementations§
Source§impl Clone for CypherDatabase
impl Clone for CypherDatabase
Source§fn clone(&self) -> CypherDatabase
fn clone(&self) -> CypherDatabase
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Database for CypherDatabase
impl Database for CypherDatabase
Source§fn trigger_lru_eviction(&mut self)
fn trigger_lru_eviction(&mut self)
Source§fn synthetic_write(&mut self, durability: Durability)
fn synthetic_write(&mut self, durability: Durability)
durability has changed, triggering a new revision.
This is mostly useful for profiling scenarios. Read moreSource§fn trigger_cancellation(&mut self)
fn trigger_cancellation(&mut self)
Source§fn cancellation_token(&self) -> CancellationToken
fn cancellation_token(&self) -> CancellationToken
CancellationToken for the current database handle.Source§fn report_untracked_read(&self)
fn report_untracked_read(&self)
Source§fn ingredient_debug_name(
&self,
ingredient_index: IngredientIndex,
) -> Cow<'_, str>
fn ingredient_debug_name( &self, ingredient_index: IngredientIndex, ) -> Cow<'_, str>
Source§fn unwind_if_revision_cancelled(&self)
fn unwind_if_revision_cancelled(&self)
Source§impl Debug for CypherDatabase
impl Debug for CypherDatabase
Source§impl Default for CypherDatabase
impl Default for CypherDatabase
Source§fn default() -> CypherDatabase
fn default() -> CypherDatabase
impl CypherDb for CypherDatabase
Auto Trait Implementations§
impl !Freeze for CypherDatabase
impl RefUnwindSafe for CypherDatabase
impl Send for CypherDatabase
impl !Sync for CypherDatabase
impl Unpin for CypherDatabase
impl UnsafeUnpin for CypherDatabase
impl !UnwindSafe for CypherDatabase
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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