pub struct Runtime<DB: Database> { /* fields omitted */ }
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.
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.
Returns the "default value" for a type. Read more
Formats the value using the given formatter. Read more
impl<DB> Send for Runtime<DB> where <DB as DatabaseStorageTypes>::DatabaseStorage: Send + Sync, <DB as DatabaseStorageTypes>::QueryDescriptor: Send, | |
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Mutably borrows from an owned value. Read more