pub struct EffectJournal { /* private fields */ }Expand description
Reads and writes effect results.
Cloning is cheap; the stores are shared.
Implementations§
Source§impl EffectJournal
impl EffectJournal
Sourcepub fn new(actions: Arc<dyn ActionCache>, blobs: Arc<dyn BlobStore>) -> Self
pub fn new(actions: Arc<dyn ActionCache>, blobs: Arc<dyn BlobStore>) -> Self
A journal over the same two-table store the cache uses: action records (kept) and content blobs (evictable).
Sourcepub fn disabled(
actions: Arc<dyn ActionCache>,
blobs: Arc<dyn BlobStore>,
) -> Self
pub fn disabled( actions: Arc<dyn ActionCache>, blobs: Arc<dyn BlobStore>, ) -> Self
A journal that records nothing. The run still works; it just cannot be replayed.
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Whether this journal records and replays at all.
Sourcepub fn with_enabled(self, enabled: bool) -> Self
pub fn with_enabled(self, enabled: bool) -> Self
Toggle recording, e.g. per step.
Sourcepub fn key(&self, site: EffectSite<'_>, effect: &Effect) -> Result<CacheKey>
pub fn key(&self, site: EffectSite<'_>, effect: &Effect) -> Result<CacheKey>
The record key for an effect at a site.
Pure effects key on content alone, so any run may reuse them. Impure effects additionally key on the site, which is what confines their reuse to a replay of the same run.
Sourcepub fn lookup(
&self,
site: EffectSite<'_>,
effect: &Effect,
) -> Result<Option<EffectResult>>
pub fn lookup( &self, site: EffectSite<'_>, effect: &Effect, ) -> Result<Option<EffectResult>>
Fetch a recorded result, if there is one.
A record whose blob has been evicted reads as absent: the effect is
performed again. For a pure effect that is merely slower; for an
impure one it means a replay diverges, which is why
Self::record marks impure blobs as expensive so GC keeps them.
Sourcepub fn record(
&self,
site: EffectSite<'_>,
effect: &Effect,
result: &EffectResult,
compute_ms: u64,
) -> Result<()>
pub fn record( &self, site: EffectSite<'_>, effect: &Effect, result: &EffectResult, compute_ms: u64, ) -> Result<()>
Write down what an effect produced.
Trait Implementations§
Source§impl Clone for EffectJournal
impl Clone for EffectJournal
Source§fn clone(&self) -> EffectJournal
fn clone(&self) -> EffectJournal
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more