pub enum Volatility {
Stable,
Grows,
Rewritten,
}Expand description
How much a region’s contents move between requests.
This exists because a provider caches by prefix: an entry is readable next time only when every byte in front of it is unchanged, so a block that moves invalidates everything behind it however stable that later content is. The arrangement that pays is stable content first and churn last.
A region’s RegionKind cannot answer this. A pinned region sounds
immutable and is written constantly - context_write into a findings region
is an ordinary move, and tool routing sends read results straight into one.
A compact-history region sounds settled and gains an entry every time
compaction fires. Inferring stability from the kind put churn at the front of
the prefix and cost a measured 456,860 cache-write tokens against zero reads
(issue #474).
So the blueprint says. The author knows whether a region is set once at spawn or written every turn, and nothing else does.
Variants§
Stable
Written rarely or never after setup: a task, a system prompt, a convention the run does not revise. Sorted to the front, where it forms the prefix everything else caches behind.
Grows
Appended to, with existing entries left alone: a findings list, a bibliography, a transcript of what has been read. Sorted after the stable content, and split into chunks so the settled head of it can be cached while only the tail is re-sent.
Rewritten
Existing content changes in place: a scratchpad, a key-value store whose keys are overwritten, anything rebuilt each turn. Sorted last, where it invalidates nothing but itself.
The default, and deliberately the pessimistic one: a blueprint that declares nothing must never be made worse by this, and an optimistic default is exactly how inferring stability from the kind went wrong.
Trait Implementations§
Source§impl Clone for Volatility
impl Clone for Volatility
Source§fn clone(&self) -> Volatility
fn clone(&self) -> Volatility
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Volatility
Source§impl Debug for Volatility
impl Debug for Volatility
Source§impl Default for Volatility
impl Default for Volatility
Source§fn default() -> Volatility
fn default() -> Volatility
Source§impl<'de> Deserialize<'de> for Volatility
impl<'de> Deserialize<'de> for Volatility
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Volatility
Source§impl PartialEq for Volatility
impl PartialEq for Volatility
Source§impl Serialize for Volatility
impl Serialize for Volatility
impl StructuralPartialEq for Volatility
Auto Trait Implementations§
impl Freeze for Volatility
impl RefUnwindSafe for Volatility
impl Send for Volatility
impl Sync for Volatility
impl Unpin for Volatility
impl UnsafeUnpin for Volatility
impl UnwindSafe for Volatility
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.