Skip to main content

PreparedLiteralCache

Trait PreparedLiteralCache 

Source
pub trait PreparedLiteralCache: Send + Sync {
    // Required methods
    fn prepared_value(
        &self,
        key: &StrHash,
    ) -> Option<Arc<dyn Any + Send + Sync>>;
    fn insert_prepared_value(
        &self,
        key: StrHash,
        value: Arc<dyn Any + Send + Sync>,
        cost: usize,
    ) -> bool;
    fn resolved_string(&self, key: &StrHash) -> Option<&str>;
    fn blob_payload(&self, key: &StrHash) -> Option<&[u8]>;
}
Expand description

Query-local source data and prepared values available to a cache-aware encoded custom function.

The prepared-value slot is type-erased so waratah_compute does not depend on plugin geometry types. Values are keyed by the plugin’s deterministic term key and shared across parallel query workspaces.

Required Methods§

Source

fn prepared_value(&self, key: &StrHash) -> Option<Arc<dyn Any + Send + Sync>>

Clone a prepared value from the query-local cache.

Source

fn insert_prepared_value( &self, key: StrHash, value: Arc<dyn Any + Send + Sync>, cost: usize, ) -> bool

Insert a prepared value with an approximate retained-byte cost. Returns false when the query-local byte limit refuses admission.

Source

fn resolved_string(&self, key: &StrHash) -> Option<&str>

Resolved lexical string under a plugin-defined key.

Source

fn blob_payload(&self, key: &StrHash) -> Option<&[u8]>

Query-local blob payload under its content address.

Implementors§