mirror of
https://github.com/salsa-rs/salsa.git
synced 2025-01-23 13:10:19 +00:00
reorganize to put "how to implement this" at the end
This commit is contained in:
parent
5a88871b9a
commit
341619d20e
1 changed files with 15 additions and 15 deletions
30
src/lib.rs
30
src/lib.rs
|
@ -261,6 +261,21 @@ pub trait ParallelDatabase: Database + Send {
|
||||||
///
|
///
|
||||||
/// [`is_current_revision_canceled`]: struct.Runtime.html#method.is_current_revision_canceled
|
/// [`is_current_revision_canceled`]: struct.Runtime.html#method.is_current_revision_canceled
|
||||||
///
|
///
|
||||||
|
/// # Panics
|
||||||
|
///
|
||||||
|
/// It is not permitted to create a snapshot from inside of a
|
||||||
|
/// query. Attepting to do so will panic.
|
||||||
|
///
|
||||||
|
/// # Deadlock warning
|
||||||
|
///
|
||||||
|
/// The intended pattern for snapshots is that, once created, they
|
||||||
|
/// are sent to another thread and used from there. As such, the
|
||||||
|
/// `snapshot` acquires a "read lock" on the database --
|
||||||
|
/// therefore, so long as the `snapshot` is not dropped, any
|
||||||
|
/// attempt to `set` a value in the database will block. If the
|
||||||
|
/// `snapshot` is owned by the same thread that is attempting to
|
||||||
|
/// `set`, this will cause a problem.
|
||||||
|
///
|
||||||
/// # How to implement this
|
/// # How to implement this
|
||||||
///
|
///
|
||||||
/// Typically, this method will create a second copy of your
|
/// Typically, this method will create a second copy of your
|
||||||
|
@ -287,21 +302,6 @@ pub trait ParallelDatabase: Database + Send {
|
||||||
/// }
|
/// }
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
///
|
|
||||||
/// # Panics
|
|
||||||
///
|
|
||||||
/// It is not permitted to create a snapshot from inside of a
|
|
||||||
/// query. Attepting to do so will panic.
|
|
||||||
///
|
|
||||||
/// # Deadlock warning
|
|
||||||
///
|
|
||||||
/// The intended pattern for snapshots is that, once created, they
|
|
||||||
/// are sent to another thread and used from there. As such, the
|
|
||||||
/// `snapshot` acquires a "read lock" on the database --
|
|
||||||
/// therefore, so long as the `snapshot` is not dropped, any
|
|
||||||
/// attempt to `set` a value in the database will block. If the
|
|
||||||
/// `snapshot` is owned by the same thread that is attempting to
|
|
||||||
/// `set`, this will cause a problem.
|
|
||||||
fn snapshot(&self) -> Snapshot<Self>;
|
fn snapshot(&self) -> Snapshot<Self>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue