pub struct Memory { /* private fields */ }Expand description
What is remembered about each node. The ones not listed have nothing said about them, which is the same as nothing being kept.
Implementations§
Source§impl Memory
impl Memory
Sourcepub fn identify(
&mut self,
id: impl Into<NodeId>,
what: impl Into<String>,
) -> Option<String>
pub fn identify( &mut self, id: impl Into<NodeId>, what: impl Into<String>, ) -> Option<String>
Says what implements this node, returning what it was called before.
Sourcepub fn identity_of(&self, id: &NodeId) -> Option<&str>
pub fn identity_of(&self, id: &NodeId) -> Option<&str>
What implements it, if it was said.
Sourcepub fn declared_as(
&mut self,
id: impl Into<NodeId>,
declaration: impl Into<String>,
)
pub fn declared_as( &mut self, id: impl Into<NodeId>, declaration: impl Into<String>, )
Says what this node was built with, as a digest of the arguments that made it. The class is half of what a node is; this is the other half.
Sourcepub fn declaration_of(&self, id: &NodeId) -> Option<&str>
pub fn declaration_of(&self, id: &NodeId) -> Option<&str>
What it was built with, if anybody could say. Absent is not a reason to
refuse a key; refusing is cacheable’s side of it.
Sourcepub fn freeze(&mut self, id: impl Into<NodeId>, state: Option<String>)
pub fn freeze(&mut self, id: impl Into<NodeId>, state: Option<String>)
Says this node’s state does not change from here on, with the digest of
the state it is settled at. Called twice on purpose: .frozen() says it
with no digest, and whoever can hash the weights says it again with one.
Sourcepub fn state_of(&self, id: &NodeId) -> Option<&str>
pub fn state_of(&self, id: &NodeId) -> Option<&str>
The digest of the state it is frozen at, if it is frozen and has one.
Sourcepub fn cache(&mut self, id: impl Into<NodeId>, salt: Option<String>)
pub fn cache(&mut self, id: impl Into<NodeId>, salt: Option<String>)
Says this node’s output is worth keeping, with the caller’s salt if they gave one — how you tell apart two runs the key cannot.
Sourcepub fn is_cached(&self, id: &NodeId) -> bool
pub fn is_cached(&self, id: &NodeId) -> bool
Whether this node’s output is kept. Not being kept is no break in the chain: its key is still computed and passed on.
Sourcepub fn salt_of(&self, id: &NodeId) -> Option<&str>
pub fn salt_of(&self, id: &NodeId) -> Option<&str>
The salt it is cached under, if it is cached and has one.
Sourcepub fn map(&mut self, id: impl Into<NodeId>)
pub fn map(&mut self, id: impl Into<NodeId>)
Says this node maps over the items of its input: a list in, a list as
long out, item i out from item i in.
What makes a cache work item by item — one new document among a thousand runs once instead of missing all thousand. Declared and not asked.
Sourcepub fn written_as(
&mut self,
id: impl Into<NodeId>,
fingerprint: impl Into<String>,
) -> Option<String>
pub fn written_as( &mut self, id: impl Into<NodeId>, fingerprint: impl Into<String>, ) -> Option<String>
Notes which version of the code this graph was written against. Metadata: never in a key, only compared on a hit.
Sourcepub fn fingerprint_of(&self, id: &NodeId) -> Option<&str>
pub fn fingerprint_of(&self, id: &NodeId) -> Option<&str>
Which version of the code it was written against, if it was noted.