Struct salsa::Runtime

source ·
pub struct Runtime<DB: Database> { /* private fields */ }
Expand description

The salsa runtime stores the storage for all queries as well as tracking the query stack and dependencies between cycles.

Each new runtime you create (e.g., via Runtime::new or Runtime::default) will have an independent set of query storage associated with it. Normally, therefore, you only do this once, at the start of your application.

Implementations

Create a new runtime; equivalent to Self::default. This is used when creating a new database.

Returns the underlying storage, where the keys/values for all queries are kept.

Returns a “forked” runtime, suitable for use in a forked database. “Forked” runtimes hold a read-lock on the global state, which means that any attempt to set an input will block until the forked runtime is dropped. See ParallelDatabase::snapshot for more information.

Warning. This second handle is intended to be used from a separate thread. Using two database handles from the same thread can lead to deadlock.

Indicates that some input to the system has changed and hence that memoized values may be invalidated. This cannot be invoked while query computation is in progress.

As a user of the system, you would not normally invoke this method directly. Instead, you would use “input” queries and invoke their set method. But it can be useful if you have a “volatile” input that you must poll from time to time; in that case, you can wrap the input with a “no-storage” query and invoke this method from time to time.

Default implementation for Database::sweep_all.

The unique identifier attached to this SalsaRuntime. Each snapshotted runtime has a distinct identifier.

Returns the descriptor for the query that this thread is actively executing (if any).

Check if the current revision is canceled. If this method ever returns true, the currently executing query is also marked as having an untracked read – this means that, in the next revision, we will always recompute its value “as if” some input had changed. This means that, if your revision is canceled (which indicates that current query results will be ignored) your query is free to shortcircuit and return whatever it likes.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.