Trait salsa::Database

source ·
pub trait Database: DatabaseOps {
    // Provided methods
    fn salsa_event(&self, event_fn: Event) { ... }
    fn unwind_if_cancelled(&self) { ... }
    fn salsa_runtime(&self) -> &Runtime { ... }
    fn synthetic_write(&mut self, durability: Durability) { ... }
}
Expand description

The base trait which your “query context” must implement. Gives access to the salsa runtime, which you must embed into your query context (along with whatever other state you may require).

Provided Methods§

source

fn salsa_event(&self, event_fn: Event)

This function is invoked at key points in the salsa runtime. It permits the database to be customized and to inject logging or other custom behavior.

source

fn unwind_if_cancelled(&self)

Starts unwinding the stack if the current revision is cancelled.

This method can be called by query implementations that perform potentially expensive computations, in order to speed up propagation of cancellation.

Cancellation will automatically be triggered by salsa on any query invocation.

This method should not be overridden by Database implementors. A salsa_event is emitted when this method is called, so that should be used instead.

source

fn salsa_runtime(&self) -> &Runtime

Gives access to the underlying salsa runtime.

This method should not be overridden by Database implementors.

source

fn synthetic_write(&mut self, durability: Durability)

A “synthetic write” causes the system to act as though some input of durability durability has changed. This is mostly useful for profiling scenarios.

WARNING: Just like an ordinary write, this method triggers cancellation. If you invoke it while a snapshot exists, it will block until that snapshot is dropped – if that snapshot is owned by the current thread, this could trigger deadlock.

Implementors§